mirror of
https://github.com/Tafkas/fritzbox-munin.git
synced 2023-10-10 13:36:55 +02:00
Merge pull request #19 from bobvandevijver/localization-support
Fixes #14. Added localization for english
This commit is contained in:
commit
523b83ce17
18
README.md
18
README.md
@ -1,6 +1,6 @@
|
||||
# fritzbox-munin
|
||||
|
||||
A collection of munin plugins to monitor your AVM FRITZ!Box router. The scripts have been developed using a [FRITZ!Box 7362 SL](http://geni.us/fTyoY)(Amazon link) running FRITZ!OS 06.83. This script also only works if the language of the Fritz!Box is set to German (this holds only for the uptime and wifi devices check).
|
||||
A collection of munin plugins to monitor your AVM FRITZ!Box router. The scripts have been developed using a [FRITZ!Box 7362 SL](http://geni.us/fTyoY)(Amazon link) running FRITZ!OS 06.83.
|
||||
|
||||
If you are using the scripts on a different Fritz!Box model please let me know by
|
||||
|
||||
@ -54,12 +54,12 @@ If you are using the scripts on a different Fritz!Box model please let me know b
|
||||
|
||||
## fritzbox\_uptime
|
||||
|
||||
fritzbox\_uptime shows you the uptime in days (requires password)
|
||||
fritzbox\_uptime shows you the uptime in days (requires password) (language dependant, see below).
|
||||
![http://i.imgur.com/Jr8OibH.png](http://i.imgur.com/Jr8OibH.png)
|
||||
|
||||
## fritzbox\_wifi\_devices
|
||||
|
||||
fritzbox\_wifi\_devices shows you the number of connected wifi clients (requires password)
|
||||
fritzbox\_wifi\_devices shows you the number of connected wifi clients (requires password) (language dependant, see below).
|
||||
![http://i.imgur.com/lqvK1b2.png](http://i.imgur.com/lqvK1b2.png)
|
||||
|
||||
|
||||
@ -83,6 +83,18 @@ If you are using the scripts on a different Fritz!Box model please let me know b
|
||||
|
||||
5. Done. You should now start to see the charts on the Munin pages.
|
||||
|
||||
## Localization
|
||||
|
||||
Two scripts depend on the language selected in your fritzbox: the uptime and wifi\_devices. Currently, two locales are
|
||||
supported:
|
||||
|
||||
1. German: `de` (default)
|
||||
2. English: `en`
|
||||
|
||||
You can change the used locale by setting an environment variable in your plugin configuration:
|
||||
|
||||
env.locale en
|
||||
|
||||
## Environment Settings
|
||||
|
||||
Do not forget to restart the munin-node daemon as described in step 3 of the installation instructions above.
|
||||
|
@ -21,8 +21,15 @@ import re
|
||||
import sys
|
||||
import fritzbox_helper as fh
|
||||
|
||||
locale = os.environ.get('locale', 'de')
|
||||
patternLoc = {"de":"(\d+)\s(Tag|Stunden|Minuten)", \
|
||||
"en":"(\d+)\s(days|hours|minutes)"}
|
||||
dayLoc = {"de":"Tag", "en":"days"}
|
||||
hourLoc = {"de":"Stunden", "en":"hours"}
|
||||
minutesLoc = {"de":"Minuten", "en":"minutes"}
|
||||
|
||||
PAGE = '/system/energy.lua'
|
||||
pattern = re.compile("(\d+)\s(Tag|Stunden|Minuten)")
|
||||
pattern = re.compile(patternLoc[locale])
|
||||
|
||||
|
||||
def get_uptime():
|
||||
@ -37,11 +44,11 @@ def get_uptime():
|
||||
if matches:
|
||||
hours = 0.0
|
||||
for m in matches:
|
||||
if m.group(2) == 'Tag':
|
||||
if m.group(2) == dayLoc[locale]:
|
||||
hours += 24 * int(m.group(1))
|
||||
if m.group(2) == "Stunden":
|
||||
if m.group(2) == hourLoc[locale]:
|
||||
hours += int(m.group(1))
|
||||
if m.group(2) == "Minuten":
|
||||
if m.group(2) == minutesLoc[locale]:
|
||||
hours += int(m.group(1)) / 60.0
|
||||
uptime = hours / 24
|
||||
print "uptime.value %.2f" % uptime
|
||||
|
@ -21,8 +21,11 @@ import re
|
||||
import sys
|
||||
import fritzbox_helper as fh
|
||||
|
||||
locale = os.environ.get('locale', 'de')
|
||||
patternLoc = {"de":"(\d+) WLAN", "en":"(\d+) wireless LAN"}
|
||||
|
||||
PAGE = '/system/energy.lua'
|
||||
pattern = re.compile("(\d+) WLAN")
|
||||
pattern = re.compile(patternLoc[locale])
|
||||
|
||||
|
||||
def get_connected_wifi_devices():
|
||||
|
Loading…
Reference in New Issue
Block a user