Skip to content

Improve support of ping on Windows #5649

@MSS970

Description

@MSS970

Hi There,
If fping is installed in Windows, fping would rung, but the results are check/validated against the logic of Windows ping.

} else {

I suggest to change the code in ping.php starting from line #243 to the following:

		} else {
			// -- START - Modified by MSS on 2024-01-15
			// ------------------------------------
			if ($fping != '' && file_exists($fping) && is_executable($fping)) {
				$position = strpos($result, 'min/avg/max');

				if ($position > 0) {
					$output  = trim(str_replace(' ms', '', substr($result, $position)));
					$pieces  = explode('=', $output);
					$results = explode('/', $pieces[1]);

					$this->ping_status   = $results[1];
					$this->ping_response = __('ICMP Ping Success (%s ms)', $results[1]);

					return true;
				} else {
					$this->status        = 'down';
					$this->ping_response = __('ICMP ping Timed out (' . $this->host['hostname'] . '), Result [' . $result . ']');

					return false;
				}
			} else {
				$position = strpos($result, 'Minimum');

				if ($position > 0) {
					$output  = trim(substr($result, $position));
					$pieces  = explode(',', $output);
					$results = explode('=', $pieces[2]);

					$this->ping_status   = trim(str_replace('ms', '', $results[1]));
					$this->ping_response = __('ICMP Ping Success (%s ms)', $this->ping_status);

					return true;
				} else {
					$this->status        = 'down';
					$this->ping_response = __('ICMP ping Timed out (' . $this->host['hostname'] . '), Result [' . $result . ']');

					return false;
				}
			}
			// -- END - Modified by MSS on 2024-01-15
			// ------------------------------------
		}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugUndesired behaviourconfirmedBug is confirm by dev teamresolvedA fixed issue

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions