mirror of
				https://github.com/Tafkas/fritzbox-munin.git
				synced 2023-10-10 11:36:55 +00:00 
			
		
		
		
	support dynamic hostnames
This commit is contained in:
		| @@ -19,6 +19,9 @@ import sys | |||||||
|  |  | ||||||
| from fritzconnection import FritzConnection | from fritzconnection import FritzConnection | ||||||
|  |  | ||||||
|  | # bet box name from first part before '_' in (symlink) file name | ||||||
|  | boxname = os.path.basename(__file__).rsplit('_')[0] | ||||||
|  |  | ||||||
|  |  | ||||||
| def print_values(): | def print_values(): | ||||||
|     try: |     try: | ||||||
| @@ -31,7 +34,7 @@ def print_values(): | |||||||
|  |  | ||||||
|  |  | ||||||
| def print_config(): | def print_config(): | ||||||
|     print "host_name fritzbox" |     print "host_name %s" % boxname | ||||||
|     print "graph_title AVM Fritz!Box Connection Uptime" |     print "graph_title AVM Fritz!Box Connection Uptime" | ||||||
|     print "graph_args --base 1000 -l 0" |     print "graph_args --base 1000 -l 0" | ||||||
|     print 'graph_vlabel uptime in days' |     print 'graph_vlabel uptime in days' | ||||||
|   | |||||||
| @@ -25,6 +25,9 @@ import fritzbox_helper as fh | |||||||
| PAGE = '/system/ecostat.lua' | PAGE = '/system/ecostat.lua' | ||||||
| pattern = re.compile('Query\s=\s"(\d{1,3})') | pattern = re.compile('Query\s=\s"(\d{1,3})') | ||||||
|  |  | ||||||
|  | # bet box name from first part before '_' in (symlink) file name | ||||||
|  | boxname = os.path.basename(__file__).rsplit('_')[0] | ||||||
|  |  | ||||||
|  |  | ||||||
| def get_cpu_temperature(): | def get_cpu_temperature(): | ||||||
|     """get the current cpu temperature""" |     """get the current cpu temperature""" | ||||||
| @@ -42,7 +45,7 @@ def get_cpu_temperature(): | |||||||
|  |  | ||||||
|  |  | ||||||
| def print_config(): | def print_config(): | ||||||
|     print "host_name fritzbox" |     print "host_name %s" % boxname | ||||||
|     print "graph_title AVM Fritz!Box CPU temperature" |     print "graph_title AVM Fritz!Box CPU temperature" | ||||||
|     print "graph_vlabel degrees Celsius" |     print "graph_vlabel degrees Celsius" | ||||||
|     print "graph_category sensors" |     print "graph_category sensors" | ||||||
|   | |||||||
| @@ -25,6 +25,9 @@ import fritzbox_helper as fh | |||||||
| PAGE = '/system/ecostat.lua' | PAGE = '/system/ecostat.lua' | ||||||
| pattern = re.compile('Query1\s=\s"(\d{1,3})') | pattern = re.compile('Query1\s=\s"(\d{1,3})') | ||||||
|  |  | ||||||
|  | # bet box name from first part before '_' in (symlink) file name | ||||||
|  | boxname = os.path.basename(__file__).rsplit('_')[0] | ||||||
|  |  | ||||||
|  |  | ||||||
| def get_cpu_usage(): | def get_cpu_usage(): | ||||||
|     """get the current cpu usage""" |     """get the current cpu usage""" | ||||||
| @@ -42,7 +45,7 @@ def get_cpu_usage(): | |||||||
|  |  | ||||||
|  |  | ||||||
| def print_config(): | def print_config(): | ||||||
|     print "host_name fritzbox" |     print "host_name %s" % boxname | ||||||
|     print "graph_title AVM Fritz!Box CPU usage" |     print "graph_title AVM Fritz!Box CPU usage" | ||||||
|     print "graph_vlabel %" |     print "graph_vlabel %" | ||||||
|     print "graph_category system" |     print "graph_category system" | ||||||
|   | |||||||
| @@ -26,6 +26,9 @@ PAGE = '/system/ecostat.lua' | |||||||
| pattern = re.compile('Query[1-3]\s="(\d{1,3})') | pattern = re.compile('Query[1-3]\s="(\d{1,3})') | ||||||
| USAGE = ['free', 'cache', 'strict'] | USAGE = ['free', 'cache', 'strict'] | ||||||
|  |  | ||||||
|  | # bet box name from first part before '_' in (symlink) file name | ||||||
|  | boxname = os.path.basename(__file__).rsplit('_')[0] | ||||||
|  |  | ||||||
|  |  | ||||||
| def get_memory_usage(): | def get_memory_usage(): | ||||||
|     """get the current memory usage""" |     """get the current memory usage""" | ||||||
| @@ -44,7 +47,7 @@ def get_memory_usage(): | |||||||
|  |  | ||||||
|  |  | ||||||
| def print_config(): | def print_config(): | ||||||
|     print "host_name fritzbox" |     print "host_name %s" % boxname | ||||||
|     print "graph_title AVM Fritz!Box Memory" |     print "graph_title AVM Fritz!Box Memory" | ||||||
|     print "graph_vlabel %" |     print "graph_vlabel %" | ||||||
|     print "graph_args --base 1000 -r --lower-limit 0 --upper-limit 100" |     print "graph_args --base 1000 -r --lower-limit 0 --upper-limit 100" | ||||||
|   | |||||||
| @@ -26,6 +26,9 @@ PAGE = '/system/energy.lua' | |||||||
| pattern = re.compile('<td>(.+?)"bar\s(act|fillonly)"(.+?)\s(\d{1,3})\s%') | pattern = re.compile('<td>(.+?)"bar\s(act|fillonly)"(.+?)\s(\d{1,3})\s%') | ||||||
| DEVICES = ['system', 'cpu', 'wifi', 'dsl', 'ab', 'usb'] | DEVICES = ['system', 'cpu', 'wifi', 'dsl', 'ab', 'usb'] | ||||||
|  |  | ||||||
|  | # bet box name from first part before '_' in (symlink) file name | ||||||
|  | boxname = os.path.basename(__file__).rsplit('_')[0] | ||||||
|  |  | ||||||
|  |  | ||||||
| def get_power_consumption(): | def get_power_consumption(): | ||||||
|     """get the current power consumption usage""" |     """get the current power consumption usage""" | ||||||
| @@ -44,7 +47,7 @@ def get_power_consumption(): | |||||||
|  |  | ||||||
|  |  | ||||||
| def print_config(): | def print_config(): | ||||||
|     print "host_name fritzbox" |     print "host_name %s" % boxname | ||||||
|     print "graph_title AVM Fritz!Box Power Consumption" |     print "graph_title AVM Fritz!Box Power Consumption" | ||||||
|     print "graph_vlabel %" |     print "graph_vlabel %" | ||||||
|     print "graph_category network" |     print "graph_category network" | ||||||
|   | |||||||
| @@ -19,6 +19,9 @@ import sys | |||||||
|  |  | ||||||
| from fritzconnection import FritzConnection | from fritzconnection import FritzConnection | ||||||
|  |  | ||||||
|  | # bet box name from first part before '_' in (symlink) file name | ||||||
|  | boxname = os.path.basename(__file__).rsplit('_')[0] | ||||||
|  |  | ||||||
|  |  | ||||||
| def print_values(): | def print_values(): | ||||||
|     try: |     try: | ||||||
| @@ -42,7 +45,7 @@ def print_values(): | |||||||
|  |  | ||||||
|  |  | ||||||
| def print_config(): | def print_config(): | ||||||
|     print "host_name fritzbox" |     print "host_name %s" % boxname | ||||||
|     print "graph_title AVM Fritz!Box WAN traffic" |     print "graph_title AVM Fritz!Box WAN traffic" | ||||||
|     print "graph_args --base 1000" |     print "graph_args --base 1000" | ||||||
|     print "graph_vlabel bits in (-) / out (+) per \${graph_period}" |     print "graph_vlabel bits in (-) / out (+) per \${graph_period}" | ||||||
|   | |||||||
| @@ -25,6 +25,9 @@ import fritzbox_helper as fh | |||||||
| PAGE = '/system/energy.lua' | PAGE = '/system/energy.lua' | ||||||
| pattern = re.compile("(\d+)\s(Tag|Stunden|Minuten)") | pattern = re.compile("(\d+)\s(Tag|Stunden|Minuten)") | ||||||
|  |  | ||||||
|  | # bet box name from first part before '_' in (symlink) file name | ||||||
|  | boxname = os.path.basename(__file__).rsplit('_')[0] | ||||||
|  |  | ||||||
|  |  | ||||||
| def get_uptime(): | def get_uptime(): | ||||||
|     """get the current uptime""" |     """get the current uptime""" | ||||||
| @@ -50,7 +53,7 @@ def get_uptime(): | |||||||
|  |  | ||||||
|  |  | ||||||
| def print_config(): | def print_config(): | ||||||
|     print "host_name fritzbox" |     print "host_name %s" % boxname | ||||||
|     print "graph_title AVM Fritz!Box Uptime" |     print "graph_title AVM Fritz!Box Uptime" | ||||||
|     print "graph_args --base 1000 -l 0" |     print "graph_args --base 1000 -l 0" | ||||||
|     print 'graph_vlabel uptime in days' |     print 'graph_vlabel uptime in days' | ||||||
|   | |||||||
| @@ -25,6 +25,9 @@ import fritzbox_helper as fh | |||||||
| PAGE = '/system/energy.lua' | PAGE = '/system/energy.lua' | ||||||
| pattern = re.compile("(\d+) WLAN") | pattern = re.compile("(\d+) WLAN") | ||||||
|  |  | ||||||
|  | # bet box name from first part before '_' in (symlink) file name | ||||||
|  | boxname = os.path.basename(__file__).rsplit('_')[0] | ||||||
|  |  | ||||||
|  |  | ||||||
| def get_connected_wifi_devices(): | def get_connected_wifi_devices(): | ||||||
|     """gets the numbrer of currently connected wifi devices""" |     """gets the numbrer of currently connected wifi devices""" | ||||||
| @@ -42,7 +45,7 @@ def get_connected_wifi_devices(): | |||||||
|  |  | ||||||
|  |  | ||||||
| def print_config(): | def print_config(): | ||||||
|     print "host_name fritzbox" |     print "host_name %s" % boxname | ||||||
|     print 'graph_title AVM Fritz!Box Connected Wifi Devices' |     print 'graph_title AVM Fritz!Box Connected Wifi Devices' | ||||||
|     print 'graph_vlabel Number of devices' |     print 'graph_vlabel Number of devices' | ||||||
|     print 'graph_args --base 1000' |     print 'graph_args --base 1000' | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user