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 'Wrt3g.php';
16 if (isset($argv[1]) && $argv[1] == 'autoconf') {
19 } else if (isset($argv[1]) && $argv[1] == 'config') {
21 graph_title WRT3G router status
22 graph_args --base 1000 -l 0 --upper-limit 7
23 graph_vlabel Status values
24 graph_category network
25 graph_info This graph shows the status of WRT3G router
26 conn_connected.label Connected
27 conn_connected.info Router is connected
28 conn_connected.draw LINE2
29 conn_connecting.label Connecting
30 conn_connecting.info Router is connecting
31 conn_connecting.draw LINE2
32 conn_disconnected.label Disconnected
33 conn_disconnected.info Router is disconnected
34 conn_disconnected.draw LINE2
35 notavailable.label Not available
36 notavailable.info Router cannot be reached
37 notavailable.draw LINE2
39 type_gprs.info Connection via GPRS
42 type_umts.info Connection via UMTS
51 $router = new Wrt3g();
52 $router->loadConfig();
54 $arStatus = $router->getConnectionStatus();
56 $conn = $arStatus['connection'];
57 if ($conn == 'disconnected') {
58 echo "conn_disconnected.value 1\n";
59 } else if ($conn == 'connecting') {
60 echo "conn_connecting.value 2\n";
61 } else if ($conn == 'connected') {
62 echo "conn_connected.value 3\n";
65 $type = strtolower($arStatus['type']);
66 if ($type == 'gprs') {
67 echo "type_gprs.value 4.5\n";
68 } else if ($type == 'umts') {
69 echo "type_umts.value 5\n";
71 } catch (Exception $e) {
72 echo "notavailable 0.5\n";