mirror of
https://github.com/Tafkas/fritzbox-munin.git
synced 2023-10-10 13:36:55 +02:00
Added support for Fritzbox Model 6490 Cable and potentially
others, also requiring Login to extract traffic data.
This commit is contained in:
parent
c82e99a4b4
commit
cae8b920ff
@ -20,11 +20,26 @@ import sys
|
|||||||
from fritzconnection import FritzConnection
|
from fritzconnection import FritzConnection
|
||||||
|
|
||||||
|
|
||||||
|
def model_needs_login(model: str) -> bool:
|
||||||
|
models_require_login = [
|
||||||
|
"FRITZ!Box 6490 Cable",
|
||||||
|
]
|
||||||
|
for m in models_require_login:
|
||||||
|
if model.startswith(m):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
def print_values():
|
def print_values():
|
||||||
try:
|
try:
|
||||||
conn = FritzConnection(address=os.environ['fritzbox_ip'])
|
conn = FritzConnection(address=os.environ['fritzbox_ip'])
|
||||||
|
if model_needs_login(conn.modelname):
|
||||||
|
conn = FritzConnection(address=os.environ['fritzbox_ip'],
|
||||||
|
user='dslf-config',
|
||||||
|
password=os.environ['fritzbox_password'],
|
||||||
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
sys.exit("Couldn't get WAN traffic")
|
sys.exit("Couldn't establish connection to fritzbox")
|
||||||
|
|
||||||
down_traffic = conn.call_action('WANCommonInterfaceConfig', 'GetTotalBytesReceived')['NewTotalBytesReceived']
|
down_traffic = conn.call_action('WANCommonInterfaceConfig', 'GetTotalBytesReceived')['NewTotalBytesReceived']
|
||||||
print('down.value %d' % down_traffic)
|
print('down.value %d' % down_traffic)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user