Hi,
I've just made an update to the 'wap.php' script in the contrib
directory. I should have done this ages ago when the way SYSTEM
information is presented in the XML status report changed back in Monit
version 4.4. Anyway, here's the diff to give an updated wap script for
remote status checking of monit. It's a really useful way to check
status information for just a few kB of data transfer on a mobile phone.
Best wishes,
David.
--- wap.php 2006-01-01 22:01:06.000000000 +0000
+++ wap_updated.php 2007-10-05 11:06:48.000000000 +0100
@@ -47,7 +47,7 @@
// This script requires PHP, and a working webserver! Tested on PHP4.
//
// @author Author David Fletcher, <address@hidden>
-// @version \$Id: wap.php,v 1.2 2004/11/20 23:49:19 hauk Exp $
+// @version \$Id: wap.php,v 1.3 2007/10/11 23:49:19 hauk Exp $
//Configuration data
$addr = 'localhost';
@@ -136,6 +136,11 @@
// Make sure we can access the path array
global $ary_path,$service_no;
+ //Service type 5 is system information, not a standard service
+ if(isset($attrs['TYPE']) && $attrs['TYPE'] == 5){
+ $name = 'SYSTEM';
+ }
+
// Push the tag into the array
array_push($ary_path, $name);
@@ -235,7 +240,7 @@
//Do outputs linked to the machine, not to a specific service
echo '<p>'.date('H:i j-M-y').'</p>';
-echo '<p><b>Hostname</b>:
'.$data_parsed['SYSTEM']['HOSTNAME'].'<br />';
+echo '<p><b>Hostname</b>: '.$data_parsed['SYSTEM']['NAME'].'<br
/>';
$days = floor($data_parsed['SERVER']['UPTIME']/60/60/24);
$hours = $data_parsed['SERVER']['UPTIME']/60/60%24;
-----------------------------
address@hidden
-----------------------------
_______________________________________________
monit-dev mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/monit-dev