4 * munin node output for the router status
9 * @package linksys-wrt3g-tools
10 * @author Christian Weiske <cweiske@cweiske.de>
12 * @link http://cweiske.de/linksys-wrt3g-tools.htm
14 require_once dirname(__FILE__) . '/../config.php';
15 require_once 'Wrt3g.php';
17 if (isset($argv[1]) && $argv[1] == 'autoconf') {
20 } else if (isset($argv[1]) && $argv[1] == 'config') {
22 graph_title WRT3G router status
23 graph_args --base 1000 -l 0 --upper-limit 7
24 graph_vlabel Status values
25 graph_category network
26 graph_info This graph shows the status of WRT3G router
27 conn_connected.label Connected
28 conn_connected.info Router is connected
29 conn_connected.draw LINE2
30 conn_connecting.label Connecting
31 conn_connecting.info Router is connecting
32 conn_connecting.draw LINE2
33 conn_disconnected.label Disconnected
34 conn_disconnected.info Router is disconnected
35 conn_disconnected.draw LINE2
36 notavailable.label Not available
37 notavailable.info Router cannot be reached
38 notavailable.draw LINE2
40 type_gprs.info Connection via GPRS
43 type_umts.info Connection via UMTS
52 $router = new Wrt3g();
53 $router->host = $GLOBALS['linksys-wrt3g-tools']['host'];
54 $router->user = $GLOBALS['linksys-wrt3g-tools']['user'];
55 $router->password = $GLOBALS['linksys-wrt3g-tools']['password'];
57 $arStatus = $router->getStatus();
59 $conn = $arStatus['connection'];
60 if ($conn == 'disconnected') {
61 echo "conn_disconnected.value 1\n";
62 } else if ($conn == 'connecting') {
63 echo "conn_connecting.value 2\n";
64 } else if ($conn == 'connected') {
65 echo "conn_connected.value 3\n";
68 $type = strtolower($arStatus['type']);
69 if ($type == 'gprs') {
70 echo "type_gprs.value 4.5\n";
71 } else if ($type == 'umts') {
72 echo "type_umts.value 5\n";
74 } catch (Exception $e) {
75 echo "notavailable 0.5\n";