mirror of
				https://github.com/Tafkas/fritzbox-munin.git
				synced 2023-10-10 11:36:55 +00:00 
			
		
		
		
	Compare commits
	
		
			16 Commits
		
	
	
		
			fritzos6.5
			...
			6.83.2
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					213a64abe7 | ||
| 
						 | 
					78a5a202cf | ||
| 
						 | 
					9fe16979b7 | ||
| 
						 | 
					4e5ede6d12 | ||
| 
						 | 
					ca82415b78 | ||
| 
						 | 
					209eed91ae | ||
| 
						 | 
					523b83ce17 | ||
| 
						 | 
					27ea9ea8eb | ||
| 
						 | 
					c1b1d4bffa | ||
| 
						 | 
					7291edc724 | ||
| 
						 | 
					4e7a583b7a | ||
| 
						 | 
					2c05d20602 | ||
| 
						 | 
					7a051bc5b8 | ||
| 
						 | 
					d8d37e9d91 | ||
| 
						 | 
					b8a8e2c343 | ||
| 
						 | 
					859fd461e4 | 
							
								
								
									
										12
									
								
								Changelog.md
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								Changelog.md
									
									
									
									
									
								
							@@ -1,5 +1,17 @@
 | 
			
		||||
# Changelog
 | 
			
		||||
 | 
			
		||||
## 6.83.2
 | 
			
		||||
*2017-09-05*
 | 
			
		||||
 | 
			
		||||
- Support for German and English user interface (by: [@bobvandevijver](https://github.com/bobvandevijver))
 | 
			
		||||
- Support for running Fritzbox as separate host (by: [@bobvandevijver](https://github.com/bobvandevijver))
 | 
			
		||||
- Make maximum download and upload optional by config (by: [@bobvandevijver](https://github.com/bobvandevijver))
 | 
			
		||||
 | 
			
		||||
## 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*
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										69
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										69
									
								
								README.md
									
									
									
									
									
								
							@@ -1,8 +1,23 @@
 | 
			
		||||
# 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.80. This script also only works if the language 
 | 
			
		||||
of the Fritz!Box is set to German.
 | 
			
		||||
 
 | 
			
		||||
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.
 | 
			
		||||
 | 
			
		||||
If you are using the scripts on a different Fritz!Box model please let me know by
 | 
			
		||||
 | 
			
		||||
 - opening an issue
 | 
			
		||||
 - submitting a pull request
 | 
			
		||||
 | 
			
		||||
 So far the following models (running FRITZ!OS 06.83) have been confirmed working:
 | 
			
		||||
 | 
			
		||||
 - [FRITZ!Box 5490](http://geni.us/ACtUyFt) 
 | 
			
		||||
 - [FRITZ!Box 7362 SL](http://geni.us/fTyoY)
 | 
			
		||||
 - [FRITZ!Box 7390](http://geni.us/BlAP)
 | 
			
		||||
 - [FRITZ!Box 7430](http://geni.us/BlAP)
 | 
			
		||||
 - [FRITZ!Box 7490](http://geni.us/fTyoY)
 | 
			
		||||
 - [FRITZ!Box 7580](http://geni.us/yUYyQTE)
 | 
			
		||||
 | 
			
		||||
 If you are still running Fritz!OS 6.30 check out the [releases section](https://github.com/Tafkas/fritzbox-munin/releases/tag/6.30.1).
 | 
			
		||||
 | 
			
		||||
## Introduction
 | 
			
		||||
 | 
			
		||||
   These python scripts are [Munin](http://munin-monitoring.org) plugins for monitoring the [Fritz!Box](http://avm.de/produkte/fritzbox/) router by AVM.
 | 
			
		||||
@@ -11,6 +26,10 @@ of the Fritz!Box is set to German.
 | 
			
		||||
 | 
			
		||||
  fritzbox\_traffic shows you the traffic of the WAN interface (requires fritzconnection)  
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
  If you do not want to show the interface maximum values, add the following to your plugin-configuration:
 | 
			
		||||
 | 
			
		||||
    env.traffic_remove_max true
 | 
			
		||||
  
 | 
			
		||||
## fritzbox\_connection\_uptime
 | 
			
		||||
 | 
			
		||||
@@ -39,12 +58,12 @@ of the Fritz!Box is set to German.
 | 
			
		||||
 | 
			
		||||
## fritzbox\_uptime
 | 
			
		||||
 | 
			
		||||
  fritzbox\_uptime shows you the uptime in days (requires password)  
 | 
			
		||||
  fritzbox\_uptime shows you the uptime in days (requires password) (language dependant, see below).
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
## fritzbox\_wifi\_devices
 | 
			
		||||
 | 
			
		||||
  fritzbox\_wifi\_devices shows you the number of connected wifi clients (requires password)
 | 
			
		||||
  fritzbox\_wifi\_devices shows you the number of connected wifi clients (requires password) (language dependant, see below).
 | 
			
		||||
  
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
@@ -54,20 +73,52 @@ of the Fritz!Box is set to German.
 | 
			
		||||
    
 | 
			
		||||
        pip install fritzconnection
 | 
			
		||||
 | 
			
		||||
1. Copy all the scripts to =/usr/share/munin/plugins
 | 
			
		||||
1. Copy all the scripts to `/usr/share/munin/plugins`
 | 
			
		||||
   
 | 
			
		||||
2. Create entry in /etc/munin/plugin-conf.d/munin-node:  
 | 
			
		||||
2. Create entry in `/etc/munin/plugin-conf.d/munin-node`:  
 | 
			
		||||
    
 | 
			
		||||
        [fritzbox_*]  
 | 
			
		||||
        env.fritzbox_ip <ip_address_to_your_fritzbox>  
 | 
			
		||||
        env.fritzbox_password <fritzbox_password>  
 | 
			
		||||
 | 
			
		||||
3. Create symbolic links to /etc/munin/plugins.
 | 
			
		||||
3. Create symbolic links to `/etc/munin/plugins`.
 | 
			
		||||
 | 
			
		||||
4. Restart the munin-node daemon: /etc/init.d/munin-node restart.
 | 
			
		||||
4. Restart the munin-node daemon: `/etc/init.d/munin-node restart`.
 | 
			
		||||
 | 
			
		||||
5. Done. You should now start to see the charts on the Munin pages.
 | 
			
		||||
 | 
			
		||||
## Localization
 | 
			
		||||
 | 
			
		||||
Two scripts depend on the language selected in your fritzbox: the uptime and wifi\_devices. Currently, two locales are
 | 
			
		||||
supported:
 | 
			
		||||
 | 
			
		||||
1. German: `de` (default)
 | 
			
		||||
2. English: `en`
 | 
			
		||||
 | 
			
		||||
You can change the used locale by setting an environment variable in your plugin configuration:
 | 
			
		||||
 | 
			
		||||
    env.locale en
 | 
			
		||||
 | 
			
		||||
## Different hosts for the fritzbox and your system
 | 
			
		||||
 | 
			
		||||
You can split the graphs of your fritzbox from the localhost graphs by following the next steps:
 | 
			
		||||
 | 
			
		||||
1. Use the following as your host configuration in `/etc/munin/munin.conf`
 | 
			
		||||
 | 
			
		||||
[home.yourhost.net;server]
 | 
			
		||||
    address 127.0.0.1
 | 
			
		||||
    use_node_name yes
 | 
			
		||||
 | 
			
		||||
[home.yourhost.net;fritzbox]
 | 
			
		||||
    address 127.0.0.1
 | 
			
		||||
    use_node_name no
 | 
			
		||||
 | 
			
		||||
2. Add the following to your munin-node configuration
 | 
			
		||||
 | 
			
		||||
    env.host_name fritzbox
 | 
			
		||||
 | 
			
		||||
3. Restart your munin-node: `systemctl restart munin-node`
 | 
			
		||||
 | 
			
		||||
## Environment Settings
 | 
			
		||||
  
 | 
			
		||||
  Do not forget to restart the munin-node daemon as described in step 3 of the installation instructions above.
 | 
			
		||||
 
 | 
			
		||||
@@ -38,6 +38,8 @@ def print_config():
 | 
			
		||||
    print "graph_category network"
 | 
			
		||||
    print "uptime.label uptime"
 | 
			
		||||
    print "uptime.draw AREA"
 | 
			
		||||
    if os.environ.get('host_name'):
 | 
			
		||||
        print "host_name " + os.environ['host_name']
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if __name__ == "__main__":
 | 
			
		||||
 
 | 
			
		||||
@@ -50,6 +50,8 @@ def print_config():
 | 
			
		||||
    print "temp.graph LINE1"
 | 
			
		||||
    print "temp.min 0"
 | 
			
		||||
    print "temp.info Fritzbox CPU temperature"
 | 
			
		||||
    if os.environ.get('host_name'):
 | 
			
		||||
        print "host_name " + os.environ['host_name']
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if __name__ == '__main__':
 | 
			
		||||
 
 | 
			
		||||
@@ -50,6 +50,8 @@ def print_config():
 | 
			
		||||
    print "cpu.graph AREA"
 | 
			
		||||
    print "cpu.min 0"
 | 
			
		||||
    print "cpu.info Fritzbox CPU usage"
 | 
			
		||||
    if os.environ.get('host_name'):
 | 
			
		||||
        print "host_name " + os.environ['host_name']
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if __name__ == '__main__':
 | 
			
		||||
 
 | 
			
		||||
@@ -58,6 +58,8 @@ def print_config():
 | 
			
		||||
    print "free.label free"
 | 
			
		||||
    print "free.type GAUGE"
 | 
			
		||||
    print "free.draw STACK"
 | 
			
		||||
    if os.environ.get('host_name'):
 | 
			
		||||
        print "host_name " + os.environ['host_name']
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if __name__ == '__main__':
 | 
			
		||||
 
 | 
			
		||||
@@ -44,7 +44,7 @@ def get_power_consumption():
 | 
			
		||||
def print_config():
 | 
			
		||||
    print "graph_title AVM Fritz!Box Power Consumption"
 | 
			
		||||
    print "graph_vlabel %"
 | 
			
		||||
    print "graph_category network"
 | 
			
		||||
    print "graph_category system"
 | 
			
		||||
    print "graph_order system cpu wifi dsl ab usb"
 | 
			
		||||
    print "system.label system"
 | 
			
		||||
    print "system.type GAUGE"
 | 
			
		||||
@@ -82,6 +82,8 @@ def print_config():
 | 
			
		||||
    print "usb.min 0"
 | 
			
		||||
    print "usb.max 100"
 | 
			
		||||
    print "usb.info Fritzbox usb devices power consumption"
 | 
			
		||||
    if os.environ.get('host_name'):
 | 
			
		||||
        print "host_name " + os.environ['host_name']
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if __name__ == '__main__':
 | 
			
		||||
 
 | 
			
		||||
@@ -32,13 +32,14 @@ def print_values():
 | 
			
		||||
    up_traffic = conn.call_action('WANCommonInterfaceConfig', 'GetTotalBytesSent')['NewTotalBytesSent']
 | 
			
		||||
    print ('up.value %d' % up_traffic)
 | 
			
		||||
 | 
			
		||||
    max_down_traffic = conn.call_action('WANCommonInterfaceConfig', 'GetCommonLinkProperties')[
 | 
			
		||||
        'NewLayer1DownstreamMaxBitRate']
 | 
			
		||||
    print ('maxdown.value %d' % max_down_traffic)
 | 
			
		||||
    if not os.environ.get('traffic_remove_max'):
 | 
			
		||||
        max_down_traffic = conn.call_action('WANCommonInterfaceConfig', 'GetCommonLinkProperties')[
 | 
			
		||||
            'NewLayer1DownstreamMaxBitRate']
 | 
			
		||||
        print ('maxdown.value %d' % max_down_traffic)
 | 
			
		||||
 | 
			
		||||
    max_up_traffic = conn.call_action('WANCommonInterfaceConfig', 'GetCommonLinkProperties')[
 | 
			
		||||
        'NewLayer1UpstreamMaxBitRate']
 | 
			
		||||
    print ('maxup.value %d' % max_up_traffic)
 | 
			
		||||
        max_up_traffic = conn.call_action('WANCommonInterfaceConfig', 'GetCommonLinkProperties')[
 | 
			
		||||
            'NewLayer1UpstreamMaxBitRate']
 | 
			
		||||
        print ('maxup.value %d' % max_up_traffic)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def print_config():
 | 
			
		||||
@@ -61,14 +62,17 @@ def print_config():
 | 
			
		||||
    print "up.max 1000000000"
 | 
			
		||||
    print "up.negative down"
 | 
			
		||||
    print "up.info Traffic of the WAN interface."
 | 
			
		||||
    print "maxdown.label received"
 | 
			
		||||
    print "maxdown.type GAUGE"
 | 
			
		||||
    print "maxdown.graph no"
 | 
			
		||||
    print "maxup.label MAX"
 | 
			
		||||
    print "maxup.type GAUGE"
 | 
			
		||||
    print "maxup.negative maxdown"
 | 
			
		||||
    print "maxup.draw LINE1"
 | 
			
		||||
    print "maxup.info Maximum speed of the WAN interface."
 | 
			
		||||
    if not os.environ.get('traffic_remove_max'):
 | 
			
		||||
        print "maxdown.label received"
 | 
			
		||||
        print "maxdown.type GAUGE"
 | 
			
		||||
        print "maxdown.graph no"
 | 
			
		||||
        print "maxup.label MAX"
 | 
			
		||||
        print "maxup.type GAUGE"
 | 
			
		||||
        print "maxup.negative maxdown"
 | 
			
		||||
        print "maxup.draw LINE1"
 | 
			
		||||
        print "maxup.info Maximum speed of the WAN interface."
 | 
			
		||||
    if os.environ.get('host_name'):
 | 
			
		||||
        print "host_name " + os.environ['host_name']
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if __name__ == "__main__":
 | 
			
		||||
 
 | 
			
		||||
@@ -19,10 +19,18 @@
 | 
			
		||||
import os
 | 
			
		||||
import re
 | 
			
		||||
import sys
 | 
			
		||||
 | 
			
		||||
import fritzbox_helper as fh
 | 
			
		||||
 | 
			
		||||
locale = os.environ.get('locale', 'de')
 | 
			
		||||
patternLoc = {"de": "(\d+)\s(Tag|Stunden|Minuten)",
 | 
			
		||||
              "en": "(\d+)\s(days|hours|minutes)"}
 | 
			
		||||
dayLoc = {"de": "Tag", "en": "days"}
 | 
			
		||||
hourLoc = {"de": "Stunden", "en": "hours"}
 | 
			
		||||
minutesLoc = {"de": "Minuten", "en": "minutes"}
 | 
			
		||||
 | 
			
		||||
PAGE = '/system/energy.lua'
 | 
			
		||||
pattern = re.compile("(\d+)\s(Tag|Stunden|Minuten)")
 | 
			
		||||
pattern = re.compile(patternLoc[locale])
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def get_uptime():
 | 
			
		||||
@@ -37,11 +45,11 @@ def get_uptime():
 | 
			
		||||
    if matches:
 | 
			
		||||
        hours = 0.0
 | 
			
		||||
        for m in matches:
 | 
			
		||||
            if m.group(2) == 'Tag':
 | 
			
		||||
            if m.group(2) == dayLoc[locale]:
 | 
			
		||||
                hours += 24 * int(m.group(1))
 | 
			
		||||
            if m.group(2) == "Stunden":
 | 
			
		||||
            if m.group(2) == hourLoc[locale]:
 | 
			
		||||
                hours += int(m.group(1))
 | 
			
		||||
            if m.group(2) == "Minuten":
 | 
			
		||||
            if m.group(2) == minutesLoc[locale]:
 | 
			
		||||
                hours += int(m.group(1)) / 60.0
 | 
			
		||||
        uptime = hours / 24
 | 
			
		||||
        print "uptime.value %.2f" % uptime
 | 
			
		||||
@@ -55,6 +63,8 @@ def print_config():
 | 
			
		||||
    print "graph_category system"
 | 
			
		||||
    print "uptime.label uptime"
 | 
			
		||||
    print "uptime.draw AREA"
 | 
			
		||||
    if os.environ.get('host_name'):
 | 
			
		||||
        print "host_name " + os.environ['host_name']
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if __name__ == '__main__':
 | 
			
		||||
 
 | 
			
		||||
@@ -19,10 +19,14 @@
 | 
			
		||||
import os
 | 
			
		||||
import re
 | 
			
		||||
import sys
 | 
			
		||||
 | 
			
		||||
import fritzbox_helper as fh
 | 
			
		||||
 | 
			
		||||
locale = os.environ.get('locale', 'de')
 | 
			
		||||
patternLoc = {"de": "(\d+) WLAN", "en": "(\d+) wireless LAN"}
 | 
			
		||||
 | 
			
		||||
PAGE = '/system/energy.lua'
 | 
			
		||||
pattern = re.compile("(\d+) WLAN")
 | 
			
		||||
pattern = re.compile(patternLoc[locale])
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def get_connected_wifi_devices():
 | 
			
		||||
@@ -49,6 +53,8 @@ def print_config():
 | 
			
		||||
    print 'wifi.type GAUGE'
 | 
			
		||||
    print 'wifi.graph LINE1'
 | 
			
		||||
    print 'wifi.info Wifi Connections on 2.4 & 5 Ghz'
 | 
			
		||||
    if os.environ.get('host_name'):
 | 
			
		||||
        print "host_name " + os.environ['host_name']
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if __name__ == '__main__':
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user