Skip to content

Commit

Permalink
Remove 'AVM Fritz!Box' from titles when env.host_name is specified
Browse files Browse the repository at this point in the history
This allows the graph to be better grouped with other hosts.

Signed-off-by: Olivier Mehani <[email protected]>
(cherry picked from commit 09b56fd)
  • Loading branch information
shtrom committed Oct 1, 2019
1 parent 030c3bd commit fabad1f
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 25 deletions.
6 changes: 4 additions & 2 deletions fritzbox_connection_uptime.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,17 @@ def print_values():


def print_config():
if os.environ.get('host_name'):
print("host_name " + os.getenv('host_name'))
print("graph_title Connection Uptime")
else:
print("graph_title AVM Fritz!Box Connection Uptime")
print("graph_args --base 1000 -l 0")
print('graph_vlabel uptime in days')
print("graph_scale no'")
print("graph_category network")
print("uptime.label uptime")
print("uptime.draw AREA")
if os.environ.get('host_name'):
print("host_name " + os.getenv('host_name'))


if __name__ == "__main__":
Expand Down
8 changes: 5 additions & 3 deletions fritzbox_cpu_temperature.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ def get_cpu_temperature():


def print_config():
print("graph_title AVM Fritz!Box CPU temperature")
if os.environ.get('host_name'):
print("host_name " + os.getenv('host_name'))
print("graph_title Temperatures")
else:
print("graph_title AVM Fritz!Box CPU temperature")
print("graph_vlabel degrees Celsius")
print("graph_category sensors")
print("graph_order tmp")
Expand All @@ -51,8 +55,6 @@ 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.getenv('host_name'))


if __name__ == '__main__':
Expand Down
8 changes: 5 additions & 3 deletions fritzbox_cpu_usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ def get_cpu_usage():


def print_config():
print("graph_title AVM Fritz!Box CPU usage")
if os.environ.get('host_name'):
print("host_name " + os.getenv('host_name'))
print("graph_title CPU usage")
else :
print("graph_title AVM Fritz!Box CPU usage")
print("graph_vlabel %")
print("graph_category system")
print("graph_order cpu")
Expand All @@ -51,8 +55,6 @@ 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.getenv('host_name'))


if __name__ == '__main__':
Expand Down
8 changes: 5 additions & 3 deletions fritzbox_memory_usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ def get_memory_usage():


def print_config():
print("graph_title AVM Fritz!Box Memory")
if os.environ.get('host_name'):
print("host_name " + os.getenv('host_name'))
print("graph_title Memory usage in percent")
else:
print("graph_title AVM Fritz!Box Memory")
print("graph_vlabel %")
print("graph_args --base 1000 -r --lower-limit 0 --upper-limit 100")
print("graph_category system")
Expand All @@ -59,8 +63,6 @@ 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.getenv('host_name'))


if __name__ == '__main__':
Expand Down
10 changes: 6 additions & 4 deletions fritzbox_power_consumption.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,13 @@ def get_power_consumption():


def print_config():
print("graph_title AVM Fritz!Box Power Consumption")
if os.environ.get('host_name'):
print("host_name " + os.getenv('host_name'))
print("graph_title Power consumption")
else:
print("graph_title AVM Fritz!Box Power Consumption")
print("graph_vlabel %")
print("graph_category system")
print("graph_category sensors")
print("graph_order system cpu wifi dsl ab usb")
print("system.label system")
print("system.type GAUGE")
Expand Down Expand Up @@ -86,8 +90,6 @@ 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.getenv('host_name'))


if __name__ == '__main__':
Expand Down
8 changes: 5 additions & 3 deletions fritzbox_traffic.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ def print_values():


def print_config():
print("graph_title AVM Fritz!Box WAN traffic")
if os.environ.get('host_name'):
print("host_name " + os.getenv('host_name'))
print("graph_title Uplink traffic")
else:
print("graph_title AVM Fritz!Box WAN traffic")
print("graph_args --base 1000")
print("graph_vlabel bits in (-) / out (+) per \${graph_period}")
print("graph_category network")
Expand Down Expand Up @@ -71,8 +75,6 @@ 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.getenv('host_name'))


if __name__ == "__main__":
Expand Down
8 changes: 5 additions & 3 deletions fritzbox_uptime.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,17 @@ def get_uptime():


def print_config():
print("graph_title AVM Fritz!Box Uptime")
if os.environ.get('host_name'):
print("host_name " + os.getenv('host_name'))
print("graph_title Uptime")
else:
print("graph_title AVM Fritz!Box Uptime")
print("graph_args --base 1000 -l 0")
print('graph_vlabel uptime in days')
print("graph_scale no'")
print("graph_category system")
print("uptime.label uptime")
print("uptime.draw AREA")
if os.environ.get('host_name'):
print("host_name " + os.getenv('host_name'))


if __name__ == '__main__':
Expand Down
10 changes: 6 additions & 4 deletions fritzbox_wifi_devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@


def get_connected_wifi_devices():
"""gets the numbrer of currently connected wifi devices"""
"""gets the numbrer of currently connected wi-fi devices"""

server = os.getenv('fritzbox_ip')
password = os.getenv('FRITZ_PASSWORD')
Expand All @@ -51,7 +51,11 @@ def get_connected_wifi_devices():


def print_config():
print('graph_title AVM Fritz!Box Connected Wifi Devices')
if os.environ.get('host_name'):
print("host_name " + os.getenv('host_name'))
print('graph_title Connected Wi-Fi Devices')
else:
print('graph_title AVM Fritz!Box Connected Wi-Fi Devices')
print('graph_vlabel Number of devices')
print('graph_args --base 1000')
print('graph_category network')
Expand All @@ -60,8 +64,6 @@ 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.getenv('host_name'))


if __name__ == '__main__':
Expand Down

0 comments on commit fabad1f

Please sign in to comment.