Allow configuring statsfile using env.statsfile.

Set the default to /var/lib/munin/plugin-state/huawei-hg612-munin-output.txt
for safety.

Include a crontab file to be placed in /etc/cron.d.

Update readme to match, and simplify.
This commit is contained in:
root
2013-03-21 14:04:49 +00:00
parent d9bd73b8ac
commit c92256cc47
13 changed files with 19 additions and 23 deletions

View File

@@ -28,22 +28,14 @@ to use a different directory you may need to modify the scripts to suit.
tar zxvf huawei-hg612-munin-1.0.tgz tar zxvf huawei-hg612-munin-1.0.tgz
4. A cron job must be set up to run every 5 minutes and the user running the 4. A cron job must be set up to run every 5 minutes and the user running the
plugin must be able to write to /etc/munin/huawei/output.txt: plugin must be able to write to `/var/lib/munin/plugin-state/huawei-hg612-munin-output.txt`.
*/5 * * * * /etc/munin/huawei/getstats.sh
cp /etc/munin/huawei/crontab /etc/cron.d/huawei-hg612-munin
5. If you wish to enable any of the plugins, create a symlink for each one in 5. If you wish to enable any of the plugins, create a symlink for each one in
the munin plugins directory. Or, copy and paste the following: the munin plugins directory. Or, copy and paste the following:
cd /etc/munin/plugins ln -s /etc/munin/huawei/plugins/hg612_* /etc/munin/plugins
ln -s /etc/munin/huawei/plugins/hg612_attenuation
ln -s /etc/munin/huawei/plugins/hg612_current_speed
ln -s /etc/munin/huawei/plugins/hg612_errors
ln -s /etc/munin/huawei/plugins/hg612_max_speed
ln -s /etc/munin/huawei/plugins/hg612_ptm1
ln -s /etc/munin/huawei/plugins/hg612_ptm1_uptime
ln -s /etc/munin/huawei/plugins/hg612_pwr
ln -s /etc/munin/huawei/plugins/hg612_snr
ln -s /etc/munin/huawei/plugins/hg612_sync_speed
6. The huawei.expect script is configured to connect to 192.168.1.1 and use 6. The huawei.expect script is configured to connect to 192.168.1.1 and use
the default username and password. If this isn't what you want, simply modify the default username and password. If this isn't what you want, simply modify

1
crontab Normal file
View File

@@ -0,0 +1 @@
*/5 * * * * munin /etc/munin/plugins/huawei-hg612-munin/getstats.sh

View File

@@ -1,2 +1,5 @@
#!/bin/sh #!/bin/sh
expect /etc/munin/huawei/huawei.expect | tee | tr -d "\015" > /etc/munin/huawei/output.txt
statsfile=${statsfile:-/var/lib/munin/plugin-state/huawei-hg612-munin-output.txt}
expect `dirname $0`/huawei.expect | tee | tr -d "\015" > $statsfile

View File

@@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# -*- sh -*- # -*- sh -*-
statsfile="/etc/munin/huawei/output.txt" statsfile=${statsfile:-/var/lib/munin/plugin-state/huawei-hg612-munin-output.txt}
: << =cut : << =cut

View File

@@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# -*- sh -*- # -*- sh -*-
statsfile="/etc/munin/huawei/output.txt" statsfile=${statsfile:-/var/lib/munin/plugin-state/huawei-hg612-munin-output.txt}
: << =cut : << =cut

View File

@@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# -*- sh -*- # -*- sh -*-
statsfile="/etc/munin/huawei/output.txt" statsfile=${statsfile:-/var/lib/munin/plugin-state/huawei-hg612-munin-output.txt}
: << =cut : << =cut

View File

@@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# -*- sh -*- # -*- sh -*-
statsfile="/etc/munin/huawei/output.txt" statsfile=${statsfile:-/var/lib/munin/plugin-state/huawei-hg612-munin-output.txt}
: << =cut : << =cut

View File

@@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# -*- sh -*- # -*- sh -*-
statsfile="/etc/munin/huawei/output.txt" statsfile=${statsfile:-/var/lib/munin/plugin-state/huawei-hg612-munin-output.txt}
: << =cut : << =cut

View File

@@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# -*- sh -*- # -*- sh -*-
statsfile="/etc/munin/huawei/output.txt" statsfile=${statsfile:-/var/lib/munin/plugin-state/huawei-hg612-munin-output.txt}
: << =cut : << =cut

View File

@@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# -*- sh -*- # -*- sh -*-
statsfile="/etc/munin/huawei/output.txt" statsfile=${statsfile:-/var/lib/munin/plugin-state/huawei-hg612-munin-output.txt}
: << =cut : << =cut

View File

@@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# -*- sh -*- # -*- sh -*-
statsfile="/etc/munin/huawei/output.txt" statsfile=${statsfile:-/var/lib/munin/plugin-state/huawei-hg612-munin-output.txt}
: << =cut : << =cut

View File

@@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# -*- sh -*- # -*- sh -*-
statsfile="/etc/munin/huawei/output.txt" statsfile=${statsfile:-/var/lib/munin/plugin-state/huawei-hg612-munin-output.txt}
: << =cut : << =cut

View File

@@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# -*- sh -*- # -*- sh -*-
statsfile="/etc/munin/huawei/output.txt" statsfile=${statsfile:-/var/lib/munin/plugin-state/huawei-hg612-munin-output.txt}
: << =cut : << =cut