#!/usr/bin/env php
<?php
/**
-* munin node output for the router status
-*
-* PHP version 5
-*
-* @category Tools
-* @package linksys-wrt3g-tools
-* @author Christian Weiske <cweiske@cweiske.de>
-* @license AGPL v3
-* @link http://cweiske.de/linksys-wrt3g-tools.htm
-*/
+ * Munin node plugin to monitor the router status.
+ * Part of Linksys WRT3G tools
+ *
+ * PHP version 5
+ *
+ * @category Tools
+ * @package linksys-wrt3g-tools
+ * @author Christian Weiske <cweiske@cweiske.de>
+ * @license AGPL v3
+ * @link http://cweiske.de/linksys-wrt3g-tools.htm
+ * @link http://munin-monitoring.org/wiki/ConcisePlugins
+ */
require_once 'Wrt3g.php';
if (isset($argv[1]) && $argv[1] == 'autoconf') {
- echo "yes\n";
+ $router = new Wrt3g();
+ $router->loadConfig();
+ if ($router->config->host === null) {
+ echo "no (no host configured)\n";
+ } else {
+ echo "yes\n";
+ }
exit();
+
} else if (isset($argv[1]) && $argv[1] == 'config') {
echo <<<TXT
graph_title WRT3G router status
graph_args --base 1000 -l 0 --upper-limit 7
graph_vlabel Status values
graph_category network
-graph_info This graph shows the status of WRT3G router
+graph_info This graph shows the status of a WRT3G router
conn_connected.label Connected
conn_connected.info Router is connected
conn_connected.draw LINE2
type_umts.info Connection via UMTS
type_umts.draw LINE2
+TXT;
+ exit();
+} else if (isset($argv[1])
+ && ($argv[1] == 'help' || $argv[1] == '--help' || $argv[1] == '-h')
+) {
+ echo <<<TXT
+munin-node plugin to monitor a linksys wrt3g router
+Commands:
+ autoconf - Check if the plugin would work
+ config - Show munin config values
+ <nothing> - Print status
+
TXT;
exit();
}