4 * Munin node plugin to monitor the router status.
5 * Part of Linksys WRT3G tools
10 * @package linksys-wrt3g-tools
11 * @author Christian Weiske <cweiske@cweiske.de>
13 * @link http://cweiske.de/linksys-wrt3g-tools.htm
14 * @link http://munin-monitoring.org/wiki/ConcisePlugins
16 require_once 'Wrt3g.php';
18 if (isset($argv[1]) && $argv[1] == 'autoconf') {
19 $router = new Wrt3g();
20 $router->loadConfig();
21 if ($router->config->host === null) {
22 echo "no (no host configured)\n";
28 } else if (isset($argv[1]) && $argv[1] == 'config') {
30 graph_title WRT3G router status
31 graph_args --base 1000 -l 0 --upper-limit 7
32 graph_vlabel Status values
33 graph_category network
34 graph_info This graph shows the status of a WRT3G router
35 conn_connected.label Connected
36 conn_connected.info Router is connected
37 conn_connected.draw LINE2
38 conn_connecting.label Connecting
39 conn_connecting.info Router is connecting
40 conn_connecting.draw LINE2
41 conn_disconnected.label Disconnected
42 conn_disconnected.info Router is disconnected
43 conn_disconnected.draw LINE2
44 notavailable.label Not available
45 notavailable.info Router cannot be reached
46 notavailable.draw LINE2
48 type_gprs.info Connection via GPRS
51 type_umts.info Connection via UMTS
57 } else if (isset($argv[1])
58 && ($argv[1] == 'help' || $argv[1] == '--help' || $argv[1] == '-h')
61 munin-node plugin to monitor a linksys wrt3g router.
63 Supports environment variables: host, user, password
66 autoconf - Check if the plugin would work
67 config - Show munin config values
68 <nothing> - Print status for munin-node consumption
76 $router = new Wrt3g();
77 $router->loadConfig();
79 $arStatus = $router->getConnectionStatus();
81 $conn = $arStatus['connection'];
82 if ($conn == 'disconnected') {
83 echo "conn_disconnected.value 1\n";
84 } else if ($conn == 'connecting') {
85 echo "conn_connecting.value 2\n";
86 } else if ($conn == 'connected') {
87 echo "conn_connected.value 3\n";
90 $type = strtolower($arStatus['type']);
91 if ($type == 'gprs') {
92 echo "type_gprs.value 4.5\n";
93 } else if ($type == 'umts') {
94 echo "type_umts.value 5\n";
96 } catch (Exception $e) {
97 echo "notavailable 0.5\n";