mirror of
				https://github.com/Tafkas/fritzbox-munin.git
				synced 2023-10-10 11:36:55 +00:00 
			
		
		
		
	Compare commits
	
		
			8 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 859fd461e4 | ||
|  | bcfed06c5e | ||
|  | 2a1185612e | ||
|  | a421008e51 | ||
|  | 60fc6e7db1 | ||
|  | d162f8bf83 | ||
|  | 59fba1f701 | ||
|  | 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 @@ | ||||
| # Changelog | ||||
|  | ||||
| ## 6.83.1 | ||||
| *2017-06-11* | ||||
|  | ||||
| - Support for FRITZ!OS 6.83. This version is not compatible with the old FRITZ!OS 6.30. | ||||
|  | ||||
| ## 6.30.1 | ||||
| *2017-06-11* | ||||
|  | ||||
|   | ||||
| @@ -1,5 +1,11 @@ | ||||
| # 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.30. | ||||
|  | ||||
| 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. | ||||
|  | ||||
| If you are using the scripts on a different Fritz!Box model please let me know by | ||||
|  | ||||
|  - opening an issue | ||||
|  - submitting a pull request | ||||
|   | ||||
| ## Introduction | ||||
|  | ||||
|   | ||||
| @@ -14,6 +14,7 @@ | ||||
|   #%# capabilities=autoconf | ||||
| """ | ||||
|  | ||||
| import os | ||||
| import sys | ||||
|  | ||||
| from fritzconnection import FritzConnection | ||||
| @@ -21,7 +22,7 @@ from fritzconnection import FritzConnection | ||||
|  | ||||
| def print_values(): | ||||
|     try: | ||||
|         conn = FritzConnection() | ||||
|         conn = FritzConnection(address=os.environ['fritzbox_ip']) | ||||
|     except Exception as e: | ||||
|         sys.exit("Couldn't get connection uptime") | ||||
|  | ||||
|   | ||||
| @@ -22,7 +22,7 @@ import sys | ||||
| import fritzbox_helper as fh | ||||
|  | ||||
| PAGE = '/system/ecostat.lua' | ||||
| pattern = re.compile(".*/(StatTemperature)\".*=.*\"(.*?)\"") | ||||
| pattern = re.compile('Query\s=\s"(\d{1,3})') | ||||
|  | ||||
|  | ||||
| def get_cpu_temperature(): | ||||
| @@ -36,7 +36,7 @@ def get_cpu_temperature(): | ||||
|  | ||||
|     m = re.search(pattern, data) | ||||
|     if m: | ||||
|         print 'temp.value %d' % (int(m.group(2).split(',')[0])) | ||||
|         print 'temp.value %d' % (int(m.group(1))) | ||||
|  | ||||
|  | ||||
| def print_config(): | ||||
|   | ||||
| @@ -22,7 +22,7 @@ import sys | ||||
| import fritzbox_helper as fh | ||||
|  | ||||
| PAGE = '/system/ecostat.lua' | ||||
| pattern = re.compile(".*/(StatCPU)\".*=.*\"(.*?)\"") | ||||
| pattern = re.compile('Query1\s=\s"(\d{1,3})') | ||||
|  | ||||
|  | ||||
| def get_cpu_usage(): | ||||
| @@ -36,7 +36,7 @@ def get_cpu_usage(): | ||||
|  | ||||
|     m = re.search(pattern, data) | ||||
|     if m: | ||||
|         print 'cpu.value %d' % (int(m.group(2).split(',')[0])) | ||||
|         print 'cpu.value %d' % (int(m.group(1))) | ||||
|  | ||||
|  | ||||
| def print_config(): | ||||
|   | ||||
| @@ -22,8 +22,8 @@ import sys | ||||
| import fritzbox_helper as fh | ||||
|  | ||||
| PAGE = '/system/ecostat.lua' | ||||
| pattern = re.compile(".*/(StatRAM.*?)\".*=.*\"(.*?)\"") | ||||
| USAGE_MAPPING = {'StatRAMCacheUsed': 'cache', 'StatRAMPhysFree': 'free', 'StatRAMStrictlyUsed': 'strict'} | ||||
| pattern = re.compile('Query[1-3]\s="(\d{1,3})') | ||||
| USAGE = ['free', 'cache', 'strict'] | ||||
|  | ||||
|  | ||||
| def get_memory_usage(): | ||||
| @@ -36,8 +36,9 @@ def get_memory_usage(): | ||||
|     data = fh.get_page(server, sid, PAGE) | ||||
|     matches = re.finditer(pattern, data) | ||||
|     if matches: | ||||
|         for m in matches: | ||||
|             print'%s.value %d' % (USAGE_MAPPING[m.group(1)], int(m.group(2).split(',')[0])) | ||||
|         data = zip(USAGE, [m.group(1) for m in matches]) | ||||
|         for d in data: | ||||
|             print'%s.value %s' % (d[0], d[1]) | ||||
|  | ||||
|  | ||||
| def print_config(): | ||||
|   | ||||
| @@ -22,9 +22,8 @@ import sys | ||||
| import fritzbox_helper as fh | ||||
|  | ||||
| PAGE = '/system/energy.lua' | ||||
| pattern = re.compile(".*/(.*act?)\".*=.*\"(.*?)\"") | ||||
| DEVICE_MAPPING = {'rate_abact': 'ab', 'rate_dspact': 'dsl', 'rate_sumact': 'system', | ||||
|                   'rate_systemact': 'cpu', 'rate_usbhostact': 'usb', 'rate_wlanact': 'wifi'} | ||||
| pattern = re.compile('<td>(.+?)"bar\s(act|fillonly)"(.+?)\s(\d{1,3})\s%') | ||||
| DEVICES = ['system', 'cpu', 'wifi', 'dsl', 'ab', 'usb'] | ||||
|  | ||||
|  | ||||
| def get_power_consumption(): | ||||
| @@ -37,8 +36,9 @@ def get_power_consumption(): | ||||
|     data = fh.get_page(server, sid, PAGE) | ||||
|     matches = re.finditer(pattern, data) | ||||
|     if matches: | ||||
|         for m in matches: | ||||
|             print'%s.value %d' % (DEVICE_MAPPING[m.group(1)], int(m.group(2))) | ||||
|         data = zip(DEVICES, [m.group(4) for m in matches]) | ||||
|         for d in data: | ||||
|             print'%s.value %s' % (d[0], d[1]) | ||||
|  | ||||
|  | ||||
| def print_config(): | ||||
|   | ||||
| @@ -14,6 +14,7 @@ | ||||
|   #%# capabilities=autoconf | ||||
| """ | ||||
|  | ||||
| import os | ||||
| import sys | ||||
|  | ||||
| from fritzconnection import FritzConnection | ||||
| @@ -21,7 +22,7 @@ from fritzconnection import FritzConnection | ||||
|  | ||||
| def print_values(): | ||||
|     try: | ||||
|         conn = FritzConnection() | ||||
|         conn = FritzConnection(address=os.environ['fritzbox_ip']) | ||||
|     except Exception as e: | ||||
|         sys.exit("Couldn't get WAN traffic") | ||||
|  | ||||
|   | ||||
| @@ -22,7 +22,7 @@ import sys | ||||
| import fritzbox_helper as fh | ||||
|  | ||||
| PAGE = '/system/energy.lua' | ||||
| pattern = re.compile(".*/(.*uptime_\w+?)\".*=.*\"(.*?)\"") | ||||
| pattern = re.compile("(\d+)\s(Tag|Stunden|Minuten)") | ||||
|  | ||||
|  | ||||
| def get_uptime(): | ||||
| @@ -37,10 +37,12 @@ def get_uptime(): | ||||
|     if matches: | ||||
|         hours = 0.0 | ||||
|         for m in matches: | ||||
|             if m.group(1) == "uptime_hours": | ||||
|                 hours += int(m.group(2)) | ||||
|             if m.group(1) == "uptime_minutes": | ||||
|                 hours += int(m.group(2)) / 60.0 | ||||
|             if m.group(2) == 'Tag': | ||||
|                 hours += 24 * int(m.group(1)) | ||||
|             if m.group(2) == "Stunden": | ||||
|                 hours += int(m.group(1)) | ||||
|             if m.group(2) == "Minuten": | ||||
|                 hours += int(m.group(1)) / 60.0 | ||||
|         uptime = hours / 24 | ||||
|         print "uptime.value %.2f" % uptime | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user