From ca82415b7879dd2a331be02c84213c18e89c3b36 Mon Sep 17 00:00:00 2001 From: Bob van de Vijver Date: Wed, 6 Sep 2017 21:15:13 +0200 Subject: [PATCH] Fixes #15. Add support for separate hosts --- README.md | 20 ++++++++++++++++++++ fritzbox_connection_uptime.py | 2 ++ fritzbox_cpu_temperature.py | 2 ++ fritzbox_cpu_usage.py | 2 ++ fritzbox_memory_usage.py | 2 ++ fritzbox_power_consumption.py | 2 ++ fritzbox_traffic.py | 2 ++ fritzbox_uptime.py | 2 ++ fritzbox_wifi_devices.py | 2 ++ 9 files changed, 36 insertions(+) diff --git a/README.md b/README.md index 303c46c..73d04a9 100644 --- a/README.md +++ b/README.md @@ -99,6 +99,26 @@ You can change the used locale by setting an environment variable in your plugin 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. diff --git a/fritzbox_connection_uptime.py b/fritzbox_connection_uptime.py index c16229c..6c60765 100755 --- a/fritzbox_connection_uptime.py +++ b/fritzbox_connection_uptime.py @@ -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__": diff --git a/fritzbox_cpu_temperature.py b/fritzbox_cpu_temperature.py index 1d6d9c7..5a9657a 100755 --- a/fritzbox_cpu_temperature.py +++ b/fritzbox_cpu_temperature.py @@ -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__': diff --git a/fritzbox_cpu_usage.py b/fritzbox_cpu_usage.py index 8bb1a4e..7ee0efd 100755 --- a/fritzbox_cpu_usage.py +++ b/fritzbox_cpu_usage.py @@ -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__': diff --git a/fritzbox_memory_usage.py b/fritzbox_memory_usage.py index a366af3..b028d63 100755 --- a/fritzbox_memory_usage.py +++ b/fritzbox_memory_usage.py @@ -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__': diff --git a/fritzbox_power_consumption.py b/fritzbox_power_consumption.py index bbe06a8..245c6be 100755 --- a/fritzbox_power_consumption.py +++ b/fritzbox_power_consumption.py @@ -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__': diff --git a/fritzbox_traffic.py b/fritzbox_traffic.py index efecb2f..d0c58cf 100755 --- a/fritzbox_traffic.py +++ b/fritzbox_traffic.py @@ -71,6 +71,8 @@ def print_config(): 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__": diff --git a/fritzbox_uptime.py b/fritzbox_uptime.py index 7d2c149..8c013a7 100755 --- a/fritzbox_uptime.py +++ b/fritzbox_uptime.py @@ -62,6 +62,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__': diff --git a/fritzbox_wifi_devices.py b/fritzbox_wifi_devices.py index ad143fc..f1ffa7c 100755 --- a/fritzbox_wifi_devices.py +++ b/fritzbox_wifi_devices.py @@ -52,6 +52,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__':