From 15cc928242e161aa62a9ed25b34f1840d8e69643 Mon Sep 17 00:00:00 2001 From: Olivier Mehani Date: Tue, 24 Sep 2019 00:12:49 +1000 Subject: [PATCH] Use the same env variables as FritzConnection Signed-off-by: Olivier Mehani (cherry picked from commit 3b0c1395467fb942cbde026058a694780d530828) --- README.md | 3 ++- fritzbox_cpu_temperature.py | 10 +++++----- fritzbox_cpu_usage.py | 10 +++++----- fritzbox_helper.py | 4 ++-- fritzbox_memory_usage.py | 10 +++++----- fritzbox_power_consumption.py | 10 +++++----- fritzbox_uptime.py | 10 +++++----- fritzbox_wifi_devices.py | 10 +++++----- 8 files changed, 34 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index 690c5ae..65b5d29 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,8 @@ If you are using the scripts on a different Fritz!Box model please let me know b [fritzbox_*] env.fritzbox_ip - env.fritzbox_password + env.FRITZ_USERNAME + env.FRITZ_PASSWORD env.traffic_remove_max true # if you do not want the possible max values host_name fritzbox diff --git a/fritzbox_cpu_temperature.py b/fritzbox_cpu_temperature.py index e22423a..8b9ffaa 100755 --- a/fritzbox_cpu_temperature.py +++ b/fritzbox_cpu_temperature.py @@ -9,8 +9,8 @@ [fritzbox_*] env.fritzbox_ip [ip address of the fritzbox] - env.fritzbox_password [fritzbox password] - env.fritzbox_username [optional: fritzbox username] + env.FRITZ_PASSWORD [fritzbox password] + env.FRITZ_USERNAME [optional: fritzbox username] This plugin supports the following munin configuration parameters: #%# family=auto contrib @@ -28,10 +28,10 @@ def get_cpu_temperature(): """get the current cpu temperature""" server = os.environ['fritzbox_ip'] - password = os.environ['fritzbox_password'] + password = os.environ['FRITZ_PASSWORD'] - if "fritzbox_username" in os.environ: - fritzuser = os.environ['fritzbox_username'] + if "FRITZ_USERNAME" in os.environ: + fritzuser = os.environ['FRITZ_USERNAME'] session_id = fh.get_session_id(server, password, fritzuser) else: session_id = fh.get_session_id(server, password) diff --git a/fritzbox_cpu_usage.py b/fritzbox_cpu_usage.py index bca1cd8..bf4cea1 100755 --- a/fritzbox_cpu_usage.py +++ b/fritzbox_cpu_usage.py @@ -9,8 +9,8 @@ [fritzbox_*] env.fritzbox_ip [ip address of the fritzbox] - env.fritzbox_password [fritzbox password] - env.fritzbox_username [optional: fritzbox username] + env.FRITZ_PASSWORD [fritzbox password] + env.FRITZ_USERNAME [optional: fritzbox username] This plugin supports the following munin configuration parameters: #%# family=auto contrib @@ -28,10 +28,10 @@ def get_cpu_usage(): """get the current cpu usage""" server = os.environ['fritzbox_ip'] - password = os.environ['fritzbox_password'] + password = os.environ['FRITZ_PASSWORD'] - if "fritzbox_username" in os.environ: - fritzuser = os.environ['fritzbox_username'] + if "FRITZ_USERNAME" in os.environ: + fritzuser = os.environ['FRITZ_USERNAME'] session_id = fh.get_session_id(server, password, fritzuser) else: session_id = fh.get_session_id(server, password) diff --git a/fritzbox_helper.py b/fritzbox_helper.py index 92a41c4..c5432f5 100755 --- a/fritzbox_helper.py +++ b/fritzbox_helper.py @@ -9,8 +9,8 @@ [fritzbox_*] env.fritzbox_ip [ip address of the fritzbox] - env.fritzbox_password [fritzbox password] - env.fritzbox_username [optional: fritzbox username] + env.FRITZ_PASSWORD [fritzbox password] + env.FRITZ_USERNAME [optional: fritzbox username] This plugin supports the following munin configuration parameters: #%# family=auto contrib diff --git a/fritzbox_memory_usage.py b/fritzbox_memory_usage.py index 0965d66..8a26729 100755 --- a/fritzbox_memory_usage.py +++ b/fritzbox_memory_usage.py @@ -9,8 +9,8 @@ [fritzbox_*] env.fritzbox_ip [ip address of the fritzbox] - env.fritzbox_password [fritzbox password] - env.fritzbox_username [optional: fritzbox username] + env.FRITZ_PASSWORD [fritzbox password] + env.FRITZ_USERNAME [optional: fritzbox username] This plugin supports the following munin configuration parameters: #%# family=auto contrib @@ -29,10 +29,10 @@ def get_memory_usage(): """get the current memory usage""" server = os.environ['fritzbox_ip'] - password = os.environ['fritzbox_password'] + password = os.environ['FRITZ_PASSWORD'] - if "fritzbox_username" in os.environ: - fritzuser = os.environ['fritzbox_username'] + if "FRITZ_USERNAME" in os.environ: + fritzuser = os.environ['FRITZ_USERNAME'] session_id = fh.get_session_id(server, password, fritzuser) else: session_id = fh.get_session_id(server, password) diff --git a/fritzbox_power_consumption.py b/fritzbox_power_consumption.py index a9ae572..57b980c 100755 --- a/fritzbox_power_consumption.py +++ b/fritzbox_power_consumption.py @@ -10,8 +10,8 @@ [fritzbox_*] env.fritzbox_ip [ip address of the fritzbox] - env.fritzbox_password [fritzbox password] - env.fritzbox_username [optional: fritzbox username] + env.FRITZ_PASSWORD [fritzbox password] + env.FRITZ_USERNAME [optional: fritzbox username] This plugin supports the following munin configuration parameters: #%# family=auto contrib @@ -31,10 +31,10 @@ def get_power_consumption(): """get the current power consumption usage""" server = os.environ['fritzbox_ip'] - password = os.environ['fritzbox_password'] + password = os.environ['FRITZ_PASSWORD'] - if "fritzbox_username" in os.environ: - fritzuser = os.environ['fritzbox_username'] + if "FRITZ_USERNAME" in os.environ: + fritzuser = os.environ['FRITZ_USERNAME'] session_id = fh.get_session_id(server, password, fritzuser) else: session_id = fh.get_session_id(server, password) diff --git a/fritzbox_uptime.py b/fritzbox_uptime.py index e0f5e7c..0246719 100755 --- a/fritzbox_uptime.py +++ b/fritzbox_uptime.py @@ -9,8 +9,8 @@ [fritzbox_*] env.fritzbox_ip [ip address of the fritzbox] - env.fritzbox_password [fritzbox password] - env.fritzbox_username [optional: fritzbox username] + env.FRITZ_PASSWORD [fritzbox password] + env.FRITZ_USERNAME [optional: fritzbox username] This plugin supports the following munin configuration parameters: #%# family=auto contrib @@ -38,10 +38,10 @@ def get_uptime(): """get the current uptime""" server = os.environ['fritzbox_ip'] - password = os.environ['fritzbox_password'] + password = os.environ['FRITZ_PASSWORD'] - if "fritzbox_username" in os.environ: - fritzuser = os.environ['fritzbox_username'] + if "FRITZ_USERNAME" in os.environ: + fritzuser = os.environ['FRITZ_USERNAME'] session_id = fh.get_session_id(server, password, fritzuser) else: session_id = fh.get_session_id(server, password) diff --git a/fritzbox_wifi_devices.py b/fritzbox_wifi_devices.py index b3a087c..935fab9 100755 --- a/fritzbox_wifi_devices.py +++ b/fritzbox_wifi_devices.py @@ -9,8 +9,8 @@ [fritzbox_*] env.fritzbox_ip [ip address of the fritzbox] - env.fritzbox_password [fritzbox password] - env.fritzbox_username [optional: fritzbox username] + env.FRITZ_PASSWORD [fritzbox password] + env.FRITZ_USERNAME [optional: fritzbox username] This plugin supports the following munin configuration parameters: #%# family=auto contrib @@ -35,10 +35,10 @@ def get_connected_wifi_devices(): """gets the numbrer of currently connected wifi devices""" server = os.environ['fritzbox_ip'] - password = os.environ['fritzbox_password'] + password = os.environ['FRITZ_PASSWORD'] - if "fritzbox_username" in os.environ: - fritzuser = os.environ['fritzbox_username'] + if "FRITZ_USERNAME" in os.environ: + fritzuser = os.environ['FRITZ_USERNAME'] session_id = fh.get_session_id(server, password, fritzuser) else: session_id = fh.get_session_id(server, password)