mirror of
https://github.com/Tafkas/fritzbox-munin.git
synced 2023-10-10 13:36:55 +02:00
update scripts for FRITZ!OS:131.06.36-32026 BETA
This commit is contained in:
parent
9e6446a08c
commit
c776ef25a9
61
.gitignore
vendored
Normal file
61
.gitignore
vendored
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
# Created by .ignore support plugin (hsz.mobi)
|
||||||
|
### Python template
|
||||||
|
# Byte-compiled / optimized / DLL files
|
||||||
|
__pycache__/
|
||||||
|
*.py[cod]
|
||||||
|
*$py.class
|
||||||
|
|
||||||
|
# C extensions
|
||||||
|
*.so
|
||||||
|
|
||||||
|
# Distribution / packaging
|
||||||
|
.Python
|
||||||
|
env/
|
||||||
|
build/
|
||||||
|
develop-eggs/
|
||||||
|
dist/
|
||||||
|
downloads/
|
||||||
|
eggs/
|
||||||
|
.eggs/
|
||||||
|
lib/
|
||||||
|
lib64/
|
||||||
|
parts/
|
||||||
|
sdist/
|
||||||
|
var/
|
||||||
|
*.egg-info/
|
||||||
|
.installed.cfg
|
||||||
|
*.egg
|
||||||
|
|
||||||
|
# PyInstaller
|
||||||
|
# Usually these files are written by a python script from a template
|
||||||
|
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||||
|
*.manifest
|
||||||
|
*.spec
|
||||||
|
|
||||||
|
# Installer logs
|
||||||
|
pip-log.txt
|
||||||
|
pip-delete-this-directory.txt
|
||||||
|
|
||||||
|
# Unit test / coverage reports
|
||||||
|
htmlcov/
|
||||||
|
.tox/
|
||||||
|
.coverage
|
||||||
|
.coverage.*
|
||||||
|
.cache
|
||||||
|
nosetests.xml
|
||||||
|
coverage.xml
|
||||||
|
*,cover
|
||||||
|
|
||||||
|
# Translations
|
||||||
|
*.mo
|
||||||
|
*.pot
|
||||||
|
|
||||||
|
# Django stuff:
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# Sphinx documentation
|
||||||
|
docs/_build/
|
||||||
|
|
||||||
|
# PyBuilder
|
||||||
|
target/
|
||||||
|
|
@ -1,5 +1,10 @@
|
|||||||
# fritzbox-munin
|
# 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 running FRITZ!OS 06.30.
|
A collection of munin plugins to monitor your AVM FRITZ!Box router. The scripts have been developed using a
|
||||||
|
FRITZ!Box 7362 SL running FRITZ!OS:131.06.36-32026 BETA. AVM has modified the web interface if the Fritz!Box
|
||||||
|
in the current version that the old scripts do not work anymore. This branch also only works if the language
|
||||||
|
of the Fritz!Box is set to German.
|
||||||
|
|
||||||
|
If you are using FRITZ!OS 6.30 use the master branch.
|
||||||
|
|
||||||
## Introduction
|
## Introduction
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ import sys
|
|||||||
import fritzbox_helper as fh
|
import fritzbox_helper as fh
|
||||||
|
|
||||||
PAGE = '/system/ecostat.lua'
|
PAGE = '/system/ecostat.lua'
|
||||||
pattern = re.compile(".*/(StatTemperature)\".*=.*\"(.*?)\"")
|
pattern = re.compile('Query\s=\s"(\d{1,3})')
|
||||||
|
|
||||||
|
|
||||||
def get_cpu_temperature():
|
def get_cpu_temperature():
|
||||||
@ -36,7 +36,7 @@ def get_cpu_temperature():
|
|||||||
|
|
||||||
m = re.search(pattern, data)
|
m = re.search(pattern, data)
|
||||||
if m:
|
if m:
|
||||||
print 'temp.value %d' % (int(m.group(2).split(',')[0]))
|
print 'temp.value %d' % (int(m.group(1)))
|
||||||
|
|
||||||
|
|
||||||
def print_config():
|
def print_config():
|
||||||
|
@ -22,7 +22,7 @@ import sys
|
|||||||
import fritzbox_helper as fh
|
import fritzbox_helper as fh
|
||||||
|
|
||||||
PAGE = '/system/ecostat.lua'
|
PAGE = '/system/ecostat.lua'
|
||||||
pattern = re.compile(".*/(StatCPU)\".*=.*\"(.*?)\"")
|
pattern = re.compile('Query1\s=\s"(\d{1,3})')
|
||||||
|
|
||||||
|
|
||||||
def get_cpu_usage():
|
def get_cpu_usage():
|
||||||
@ -36,7 +36,7 @@ def get_cpu_usage():
|
|||||||
|
|
||||||
m = re.search(pattern, data)
|
m = re.search(pattern, data)
|
||||||
if m:
|
if m:
|
||||||
print 'cpu.value %d' % (int(m.group(2).split(',')[0]))
|
print 'cpu.value %d' % (int(m.group(1)))
|
||||||
|
|
||||||
|
|
||||||
def print_config():
|
def print_config():
|
||||||
|
@ -22,8 +22,8 @@ import sys
|
|||||||
import fritzbox_helper as fh
|
import fritzbox_helper as fh
|
||||||
|
|
||||||
PAGE = '/system/ecostat.lua'
|
PAGE = '/system/ecostat.lua'
|
||||||
pattern = re.compile(".*/(StatRAM.*?)\".*=.*\"(.*?)\"")
|
pattern = re.compile('Query[1-3]\s="(\d{1,3})')
|
||||||
USAGE_MAPPING = {'StatRAMCacheUsed': 'cache', 'StatRAMPhysFree': 'free', 'StatRAMStrictlyUsed': 'strict'}
|
USAGE = ['free', 'cache', 'strict']
|
||||||
|
|
||||||
|
|
||||||
def get_memory_usage():
|
def get_memory_usage():
|
||||||
@ -36,8 +36,9 @@ def get_memory_usage():
|
|||||||
data = fh.get_page(server, sid, PAGE)
|
data = fh.get_page(server, sid, PAGE)
|
||||||
matches = re.finditer(pattern, data)
|
matches = re.finditer(pattern, data)
|
||||||
if matches:
|
if matches:
|
||||||
for m in matches:
|
data = zip(USAGE, [m.group(1) for m in matches])
|
||||||
print'%s.value %d' % (USAGE_MAPPING[m.group(1)], int(m.group(2).split(',')[0]))
|
for d in data:
|
||||||
|
print'%s.value %s' % (d[0], d[1])
|
||||||
|
|
||||||
|
|
||||||
def print_config():
|
def print_config():
|
||||||
|
@ -22,9 +22,8 @@ import sys
|
|||||||
import fritzbox_helper as fh
|
import fritzbox_helper as fh
|
||||||
|
|
||||||
PAGE = '/system/energy.lua'
|
PAGE = '/system/energy.lua'
|
||||||
pattern = re.compile(".*/(.*act?)\".*=.*\"(.*?)\"")
|
pattern = re.compile('<td>(.+?)"bar\s(act|fillonly)"(.+?)\s(\d{1,3})\s%')
|
||||||
DEVICE_MAPPING = {'rate_abact': 'ab', 'rate_dspact': 'dsl', 'rate_sumact': 'system',
|
DEVICES = ['system', 'cpu', 'wifi', 'dsl', 'ab', 'usb']
|
||||||
'rate_systemact': 'cpu', 'rate_usbhostact': 'usb', 'rate_wlanact': 'wifi'}
|
|
||||||
|
|
||||||
|
|
||||||
def get_power_consumption():
|
def get_power_consumption():
|
||||||
@ -37,8 +36,9 @@ def get_power_consumption():
|
|||||||
data = fh.get_page(server, sid, PAGE)
|
data = fh.get_page(server, sid, PAGE)
|
||||||
matches = re.finditer(pattern, data)
|
matches = re.finditer(pattern, data)
|
||||||
if matches:
|
if matches:
|
||||||
for m in matches:
|
data = zip(DEVICES, [m.group(4) for m in matches])
|
||||||
print'%s.value %d' % (DEVICE_MAPPING[m.group(1)], int(m.group(2)))
|
for d in data:
|
||||||
|
print'%s.value %s' % (d[0], d[1])
|
||||||
|
|
||||||
|
|
||||||
def print_config():
|
def print_config():
|
||||||
|
@ -22,7 +22,7 @@ import sys
|
|||||||
import fritzbox_helper as fh
|
import fritzbox_helper as fh
|
||||||
|
|
||||||
PAGE = '/system/energy.lua'
|
PAGE = '/system/energy.lua'
|
||||||
pattern = re.compile(".*/(.*uptime_\w+?)\".*=.*\"(.*?)\"")
|
pattern = re.compile("(\d+)\s(Tagen|Stunden|Minuten)")
|
||||||
|
|
||||||
|
|
||||||
def get_uptime():
|
def get_uptime():
|
||||||
@ -37,10 +37,12 @@ def get_uptime():
|
|||||||
if matches:
|
if matches:
|
||||||
hours = 0.0
|
hours = 0.0
|
||||||
for m in matches:
|
for m in matches:
|
||||||
if m.group(1) == "uptime_hours":
|
if m.group(2) == 'Tagen':
|
||||||
hours += int(m.group(2))
|
hours += 24 * int(m.group(1))
|
||||||
if m.group(1) == "uptime_minutes":
|
if m.group(2) == "Stunden":
|
||||||
hours += int(m.group(2)) / 60.0
|
hours += int(m.group(1))
|
||||||
|
if m.group(2) == "Minuten":
|
||||||
|
hours += int(m.group(1)) / 60.0
|
||||||
uptime = hours / 24
|
uptime = hours / 24
|
||||||
print "uptime.value %.2f" % uptime
|
print "uptime.value %.2f" % uptime
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user