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
56 } else if (isset($argv[1])
57 && ($argv[1] == 'help' || $argv[1] == '--help' || $argv[1] == '-h')
60 munin-node plugin to monitor a linksys wrt3g router
62 autoconf - Check if the plugin would work
63 config - Show munin config values
64 <nothing> - Print status
72 $router = new Wrt3g();
73 $router->loadConfig();
75 $arStatus = $router->getConnectionStatus();
77 $conn = $arStatus['connection'];
78 if ($conn == 'disconnected') {
79 echo "conn_disconnected.value 1\n";
80 } else if ($conn == 'connecting') {
81 echo "conn_connecting.value 2\n";
82 } else if ($conn == 'connected') {
83 echo "conn_connected.value 3\n";
86 $type = strtolower($arStatus['type']);
87 if ($type == 'gprs') {
88 echo "type_gprs.value 4.5\n";
89 } else if ($type == 'umts') {
90 echo "type_umts.value 5\n";
92 } catch (Exception $e) {
93 echo "notavailable 0.5\n";