]>
Commit | Line | Data |
---|---|---|
ae2638b1 GS |
1 | --- cacti-0.8.7d/lib/ping.php 2009-02-11 21:55:50.000000000 -0500 |
2 | +++ cacti-patched/lib/ping.php 2009-02-17 20:32:21.000000000 -0500 | |
3 | @@ -238,22 +238,23 @@ | |
4 | /* we have to use the real ping */ | |
5 | $pattern = bin2hex("cacti-monitoring-system"); // the actual test data | |
6 | ||
7 | + /* host timeout given in ms, recalculate to sec, but make it an integer */ | |
8 | if (substr_count(strtolower(PHP_OS), "sun")) { | |
9 | $result = shell_exec("ping " . $this->host["hostname"]); | |
10 | }else if (substr_count(strtolower(PHP_OS), "hpux")) { | |
11 | - $result = shell_exec("ping -m " . $this->timeout . " -n 1 " . $this->host["hostname"]); | |
12 | + $result = shell_exec("ping -m " . ceil($this->timeout/1000) . " -n " . $this->retries . " " . $this->host["hostname"]); | |
13 | }else if (substr_count(strtolower(PHP_OS), "mac")) { | |
14 | - $result = shell_exec("ping -t " . $this->timeout . " -c 1 " . $this->host["hostname"]); | |
15 | + $result = shell_exec("ping -t " . ceil($this->timeout/1000) . " -c " . $this->retries . " " . $this->host["hostname"]); | |
16 | }else if (substr_count(strtolower(PHP_OS), "freebsd")) { | |
17 | - $result = shell_exec("ping -t " . $this->timeout . " -c 1 " . $this->host["hostname"]); | |
18 | + $result = shell_exec("ping -t " . ceil($this->timeout/1000) . " -c " . $this->retries . " " . $this->host["hostname"]); | |
19 | }else if (substr_count(strtolower(PHP_OS), "darwin")) { | |
20 | - $result = shell_exec("ping -t " . $this->timeout . " -c 1 " . $this->host["hostname"]); | |
21 | + $result = shell_exec("ping -t " . ceil($this->timeout/1000) . " -c " . $this->retries . " " . $this->host["hostname"]); | |
22 | }else if (substr_count(strtolower(PHP_OS), "bsd")) { | |
23 | - $result = shell_exec("ping -w " . $this->timeout . " -c 1 " . $this->host["hostname"]); | |
24 | + $result = shell_exec("ping -w " . ceil($this->timeout/1000) . " -c " . $this->retries . " " . $this->host["hostname"]); | |
25 | }else if (substr_count(strtolower(PHP_OS), "aix")) { | |
26 | - $result = shell_exec("ping -i " . $this->timeout . " -c 1 " . $this->host["hostname"]); | |
27 | + $result = shell_exec("ping -i " . ceil($this->timeout/1000) . " -c " . $this->retries . " " . $this->host["hostname"]); | |
28 | }else{ | |
29 | - $result = shell_exec("ping -W " . $this->timeout . " -c 1 -p " . $pattern . " " . $this->host["hostname"]); | |
30 | + $result = shell_exec("ping -W " . ceil($this->timeout/1000) . " -c " . $this->retries . " -p " . $pattern . " " . $this->host["hostname"]); | |
31 | } | |
32 | ||
33 | $position = strpos($result, "min/avg/max"); |