From: Christian Weiske Date: Tue, 28 Dec 2010 22:04:12 +0000 (+0100) Subject: support configuration of munin plugin through environment variables X-Git-Tag: 1.0.0~3 X-Git-Url: https://git.cweiske.de/linksys-wrt3g-tools.git/commitdiff_plain/b148da6e40e33dcffd322a299b2e30170af12869 support configuration of munin plugin through environment variables --- diff --git a/scripts/munin.php b/scripts/munin.php index 4872e90..dc7d050 100755 --- a/scripts/munin.php +++ b/scripts/munin.php @@ -15,9 +15,16 @@ */ require_once 'Wrt3g.php'; +$options = array(); +foreach (array('host', 'user', 'password') as $variable) { + if (isset($_SERVER[$variable])) { + $options[$variable] = $_SERVER[$variable]; + } +} + if (isset($argv[1]) && $argv[1] == 'autoconf') { $router = new Wrt3g(); - $router->loadConfig(); + $router->loadConfig($options); if ($router->config->host === null) { echo "no (no host configured)\n"; } else { @@ -53,15 +60,19 @@ type_umts.draw LINE2 TXT; exit(); + } else if (isset($argv[1]) && ($argv[1] == 'help' || $argv[1] == '--help' || $argv[1] == '-h') ) { echo << - Print status + - Print status for munin-node consumption TXT; exit(); @@ -70,7 +81,7 @@ TXT; try { $router = new Wrt3g(); - $router->loadConfig(); + $router->loadConfig($options); $arStatus = $router->getConnectionStatus();