mirror of
https://github.com/Tafkas/fritzbox-munin.git
synced 2023-10-10 11:36:55 +00:00
Merge 617ce230b44ad6c422a53aa2bd2b42819c9393c3 into eee98feeacb0266e31a509cbb34abaa6c2a5f12c
This commit is contained in:
commit
1faff02cb0
@ -23,6 +23,7 @@ import sys
|
|||||||
import fritzbox_helper as fh
|
import fritzbox_helper as fh
|
||||||
|
|
||||||
locale = os.environ.get('locale', 'de')
|
locale = os.environ.get('locale', 'de')
|
||||||
|
activeLoc = {"de": "aktiv", "en": "active"}
|
||||||
patternLoc = {"de": r"(\d+)\s(Tag|Stunden|Minuten)",
|
patternLoc = {"de": r"(\d+)\s(Tag|Stunden|Minuten)",
|
||||||
"en": r"(\d+)\s(days|hours|minutes)"}
|
"en": r"(\d+)\s(days|hours|minutes)"}
|
||||||
dayLoc = {"de": "Tag", "en": "days"}
|
dayLoc = {"de": "Tag", "en": "days"}
|
||||||
@ -43,7 +44,10 @@ def get_uptime():
|
|||||||
xhr_data = fh.get_xhr_content(server, session_id, PAGE)
|
xhr_data = fh.get_xhr_content(server, session_id, PAGE)
|
||||||
data = json.loads(xhr_data)
|
data = json.loads(xhr_data)
|
||||||
for d in data['data']['drain']:
|
for d in data['data']['drain']:
|
||||||
if 'aktiv' in d['statuses']:
|
if type(d['statuses']) != str and type(d['statuses']) != unicode:
|
||||||
|
continue
|
||||||
|
|
||||||
|
if activeLoc[locale] in d['statuses'].lower():
|
||||||
matches = re.finditer(pattern, d['statuses'])
|
matches = re.finditer(pattern, d['statuses'])
|
||||||
if matches:
|
if matches:
|
||||||
hours = 0.0
|
hours = 0.0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user