git.cweiske.de
/
linksys-wrt3g-tools.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
7f3b4f1
)
support configuration of munin plugin through environment variables
author
Christian Weiske
<cweiske@cweiske.de>
Tue, 28 Dec 2010 22:04:12 +0000
(23:04 +0100)
committer
Christian Weiske
<cweiske@cweiske.de>
Tue, 28 Dec 2010 22:04:12 +0000
(23:04 +0100)
scripts/munin.php
patch
|
blob
|
history
diff --git
a/scripts/munin.php
b/scripts/munin.php
index 4872e90114e5e0dc89a412d2dc53e6241e7a4fbb..dc7d050ff862f0331e9c2a7ece7fe2185e60f6c6 100755
(executable)
--- a/
scripts/munin.php
+++ b/
scripts/munin.php
@@
-15,9
+15,16
@@
*/
require_once 'Wrt3g.php';
*/
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();
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 {
if ($router->config->host === null) {
echo "no (no host configured)\n";
} else {
@@
-53,15
+60,19
@@
type_umts.draw LINE2
TXT;
exit();
TXT;
exit();
+
} else if (isset($argv[1])
&& ($argv[1] == 'help' || $argv[1] == '--help' || $argv[1] == '-h')
) {
echo <<<TXT
} else if (isset($argv[1])
&& ($argv[1] == 'help' || $argv[1] == '--help' || $argv[1] == '-h')
) {
echo <<<TXT
-munin-node plugin to monitor a linksys wrt3g router
+munin-node plugin to monitor a linksys wrt3g router.
+
+Supports environment variables: host, user, password
+
Commands:
autoconf - Check if the plugin would work
config - Show munin config values
Commands:
autoconf - Check if the plugin would work
config - Show munin config values
- <nothing> - Print status
+ <nothing> - Print status
for munin-node consumption
TXT;
exit();
TXT;
exit();
@@
-70,7
+81,7
@@
TXT;
try {
$router = new Wrt3g();
try {
$router = new Wrt3g();
- $router->loadConfig();
+ $router->loadConfig(
$options
);
$arStatus = $router->getConnectionStatus();
$arStatus = $router->getConnectionStatus();