Skip to content

Commit

Permalink
added python 3.12 to github action, disabled tls by default to avoid …
Browse files Browse the repository at this point in the history
…issues with missing certificates, added setting traffic_remove_max

Signed-off-by: Christoph Massmann <[email protected]>
  • Loading branch information
ma4nn committed Jun 2, 2024
1 parent 3068f97 commit 0f99ff1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/verify-plugin-scripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.9", "3.10", "3.11" ]
python-version: [ "3.9", "3.10", "3.11", "3.12" ]

steps:
- uses: actions/checkout@v4
Expand Down
5 changes: 3 additions & 2 deletions src/fritzbox_config.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import os


# pylint: disable=too-few-public-methods
class FritzboxConfig:
"""the server address of the Fritzbox (ip or name)"""
server = "fritz.box"
"""the port the Fritzbox webserver runs on"""
port = None # defaults to 80 for use_tls=False, 443 for use_tls=True
port = None # defaults to 80 for use_tls=False, 443 for use_tls=True
"""the user name to log into the Fritzbox webinterface"""
user = ""
"""the password to log into the Fritzbox webinterface"""
password = ""
use_tls = True
use_tls = False
certificate_file = False
timeout = 60

Expand Down
27 changes: 14 additions & 13 deletions src/fritzbox_traffic.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
Author: Christian Stade-Schuldt
Like Munin, this plugin is licensed under the GNU GPL v2 license
http://www.opensource.org/licenses/GPL-2.0
This plugin requires the fritzconnection plugin. To install it using pip:
pip install fritzconnection
Add the following section to your munin-node's plugin configuration:
Expand All @@ -27,22 +25,24 @@

class FritzboxTraffic(MuninPluginInterface):
__connection = None
__is_show_max = True

def __init__(self, fritzstatus_connection: FritzStatus):
self.__connection = fritzstatus_connection
self.__is_show_max = not os.environ.get('traffic_remove_max') or os.environ.get('traffic_remove_max') != '1'

def print_stats(self):
transmission_rate = self.__connection.transmission_rate
print(f"down.value {transmission_rate[1]}")
print(f"up.value {transmission_rate[0]}")
[tr_up, tr_down] = self.__connection.transmission_rate
print(f"down.value {tr_down}")
print(f"up.value {tr_up}")

if not os.environ.get('traffic_remove_max') or "false" in os.environ.get('traffic_remove_max'):
max_traffic = self.__connection.max_bit_rate
print(f"maxdown.value {max_traffic[1]}")
print(f"maxup.value {max_traffic[0]}")
if self.__is_show_max:
[max_up, max_down] = self.__connection.max_bit_rate
print(f"maxdown.value {max_down}")
print(f"maxup.value {max_up}")

def print_config(self):
max_traffic = self.__connection.max_bit_rate
[max_up, max_down] = self.__connection.max_bit_rate

print("graph_title WAN traffic")
print("graph_args --base 1000")
Expand All @@ -54,16 +54,17 @@ def print_config(self):
print("down.graph no")
print("down.cdef down,8,*")
print("down.min 0")
print(f"down.max {max_traffic[1]}")
print(f"down.max {max_down}")
print("up.label bps")
print("up.type DERIVE")
print("up.draw LINE")
print("up.cdef up,8,*")
print("up.min 0")
print(f"up.max {max_traffic[0]}")
print(f"up.max {max_up}")
print("up.negative down")
print("up.info Traffic of the WAN interface.")
if not os.environ.get('traffic_remove_max') or "false" in os.environ.get('traffic_remove_max'):

if self.__is_show_max:
print("maxdown.label received")
print("maxdown.type GAUGE")
print("maxdown.graph no")
Expand Down

0 comments on commit 0f99ff1

Please sign in to comment.