aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2010-08-20 09:04:16 +0300
committerFilipp Lepalaan <filipp@mac.com>2010-08-20 09:04:16 +0300
commit58ed950ac7c7282e6a639cc15c4accac4597665a (patch)
tree9eca7aba4e3d19ffb5f849e853ecfa06f9531b99
parent40964f4747fadb7741113afb7551d584ea390052 (diff)
downloadmtk-58ed950ac7c7282e6a639cc15c4accac4597665a.tar.gz
mtk-58ed950ac7c7282e6a639cc15c4accac4597665a.tar.bz2
mtk-58ed950ac7c7282e6a639cc15c4accac4597665a.zip
fix
-rwxr-xr-xpingraph.php9
1 files changed, 6 insertions, 3 deletions
diff --git a/pingraph.php b/pingraph.php
index 62b2187..c83aa22 100755
--- a/pingraph.php
+++ b/pingraph.php
@@ -14,13 +14,16 @@ $data = array();
$columns = array();
$max_ping = 0;
$min_ping = 0;
+$host = 'ping';
while (!feof($ifh)) {
$line = fgets($ifh, 4096);
- preg_match('/from (\d+\.\d+\.\d+\.\d+) icmp_seq=(\d+) ttl=\d+ time=(\d+\.\d+)/', $line, $m);
+ preg_match('/from (\d+\.\d+\.\d+\.\d+): icmp_seq=(\d+) ttl=\d+ time=(\d+\.\d+)/', $line, $m);
if (!empty($m)) {
+ print_r($m);
$ts += $interval;
- $time = $m[2];
+ $host = $m[1];
+ $time = $m[3];
if ($time > $max_ping) {
$max_ping = $time;
}
@@ -48,7 +51,7 @@ $as =<<<EOT
set theData to {{$data}}
set theSlide to (slide 1) of first slideshow
tell theSlide
- add chart row names {{$columns}} column names {"ping"} ¬
+ add chart row names {{$columns}} column names {"$host"} ¬
data theData type "line_2d" group by "column"
end tell
end tell