#!/usr/bin/env php * @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') { $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 << - Print status for munin-node consumption TXT; exit(); } try { $router = new Wrt3g(); $router->loadConfig(); $arStatus = $router->getConnectionStatus(); $conn = $arStatus['connection']; if ($conn == 'disconnected') { echo "conn_disconnected.value 1\n"; } else if ($conn == 'connecting') { echo "conn_connecting.value 2\n"; } else if ($conn == 'connected') { echo "conn_connected.value 3\n"; } $type = strtolower($arStatus['type']); if ($type == 'gprs') { echo "type_gprs.value 4.5\n"; } else if ($type == 'umts') { echo "type_umts.value 5\n"; } } catch (Exception $e) { echo "notavailable 0.5\n"; } ?>