mirror of
https://github.com/Tafkas/fritzbox-munin.git
synced 2023-10-10 13:36:55 +02:00
make checks language agnostic. Rely on position instead.
This commit is contained in:
parent
883c61e498
commit
2dd4e07013
@ -33,8 +33,8 @@ def get_memory_usage():
|
|||||||
session_id = fh.get_session_id(server, password)
|
session_id = fh.get_session_id(server, password)
|
||||||
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 usage in enumerate(USAGE):
|
for i, usage in enumerate(USAGE):
|
||||||
print('%s.value %s' % (usage[1], data['data']['ramusage']['series'][usage[0]][-1]))
|
print('%s.value %s' % (usage, data['data']['ramusage']['series'][i][-1]))
|
||||||
|
|
||||||
|
|
||||||
def print_config():
|
def print_config():
|
||||||
|
@ -23,12 +23,7 @@ import sys
|
|||||||
import fritzbox_helper as fh
|
import fritzbox_helper as fh
|
||||||
|
|
||||||
PAGE = 'energy'
|
PAGE = 'energy'
|
||||||
DEVICES = {'FRITZ!Box Gesamtsystem': 'system',
|
DEVICES = ['system', 'cpu', 'wifi', 'dsl', 'ab', 'usb']
|
||||||
'FRITZ!Box Hauptprozessor': 'cpu',
|
|
||||||
'WLAN': 'wifi',
|
|
||||||
'DSL': 'dsl',
|
|
||||||
'analoge FON-Anschlüsse': 'ab',
|
|
||||||
'USB-Geräte': 'usb'}
|
|
||||||
|
|
||||||
|
|
||||||
def get_power_consumption():
|
def get_power_consumption():
|
||||||
@ -40,11 +35,9 @@ def get_power_consumption():
|
|||||||
session_id = fh.get_session_id(server, password)
|
session_id = fh.get_session_id(server, password)
|
||||||
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']:
|
devices = data['data']['drain']
|
||||||
try:
|
for i, device in enumerate(DEVICES):
|
||||||
print('%s.value %s' % (DEVICES[d['name']], d['actPerc']))
|
print('%s.value %s' % (device, devices[i]['actPerc']))
|
||||||
except KeyError as e:
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def print_config():
|
def print_config():
|
||||||
|
@ -39,12 +39,10 @@ def get_connected_wifi_devices():
|
|||||||
session_id = fh.get_session_id(server, password)
|
session_id = fh.get_session_id(server, password)
|
||||||
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']:
|
m = re.search(pattern, data['data']['drain'][2]['statuses'][-1])
|
||||||
if d['name'] == 'WLAN':
|
if m:
|
||||||
m = re.search(pattern, d['statuses'][-1])
|
connected_devices = int(m.group(1))
|
||||||
if m:
|
print('wifi.value %d' % connected_devices)
|
||||||
connected_devices = int(m.group(1))
|
|
||||||
print('wifi.value %d' % connected_devices)
|
|
||||||
|
|
||||||
|
|
||||||
def print_config():
|
def print_config():
|
||||||
|
Loading…
Reference in New Issue
Block a user