Tafkas / fritzbox-munin

A collection of munin plugins to monitor your AVM FRITZ!Box router
GNU General Public License v2.0
150 stars 36 forks source link

When Plugins were detected five plugins have errors with 7490os07.29 7390os06.87 #61

Closed Ldwg2002 closed 1 year ago

Ldwg2002 commented 1 year ago

These plugins seem broken ...

fritzbox_wifi_devices.py
fritzbox_cpu_temperature.py
server = os.environ["fritzbox_ip"] KeyError: 'fritzbox_ip'
fritzbox_uptime.py
fritzbox_cpu_usage.py
fritzbox_traffic.py

/var/log/munin/munin-node.log is produced with the configuration details below:

env.fritzbox_ip         192.168.sub.1     # 7490 FRITZ!OS: 07.29 - Version aktuell
env.fritzbox_ip         192.168.sub.41    # 7390 FRITZ!OS: 06.87

later I can check the plugins with ... 7272os06.88 7270v3os06.06 3270v3os05.54 3131os04.57

Now it is working, but showed a lot of errors, I address here ... should not be an issue of user rights inside the fritzbox. The trusted user has everything granted except

|__| Zugang aus dem Internet
|__| VPN-Verbindungen zur FRITZ!Box können hergestellt werden.      
env.fritzbox_ip         192.168.sub.1     # 7490 FRITZ!OS: 07.29 - Version aktuell
env.fritzbox_ip         192.168.sub.41    # 7390 FRITZ!OS: 06.87

root@nas52:~# less /var/log/munin/munin-node.log

2023/01/09-01:00:13 [921302] Error output from fritzbox_power_consumption.py:
2023/01/09-01:00:13 [921302]    Couldn't retrieve fritzbox power consumption
2023/01/09-01:00:13 [921302] Service 'fritzbox_power_consumption.py' exited with status 1/0.
2023/01/09-01:05:01 CONNECT TCP Peer: "[::ffff:127.0.0.1]:47844" Local: "[::ffff:127.0.0.1]:4949"
2023/01/09-01:05:01 CONNECT TCP Peer: "[::ffff:127.0.0.1]:47860" Local: "[::ffff:127.0.0.1]:4949"
2023/01/09-01:05:01 CONNECT TCP Peer: "[::ffff:127.0.0.1]:47866" Local: "[::ffff:127.0.0.1]:4949"
2023/01/09-01:05:03 [922136] Error output from fritzbox_wifi_devices.py:
2023/01/09-01:05:03 [922136]    Couldn't retrieve connected fritzbox wifi devices
2023/01/09-01:05:03 [922136] Service 'fritzbox_wifi_devices.py' exited with status 1/0.
2023/01/09-01:05:05 [922136] Error output from fritzbox_cpu_temperature.py:
2023/01/09-01:05:05 [922136]    Traceback (most recent call last):
2023/01/09-01:05:05 [922136]      File "/etc/munin/plugins/fritzbox_cpu_temperature.py", line 62, in <module>
2023/01/09-01:05:05 [922136]        get_cpu_temperature()
2023/01/09-01:05:05 [922136]      File "/etc/munin/plugins/fritzbox_cpu_temperature.py", line 30, in get_cpu_temperature
2023/01/09-01:05:05 [922136]        server = os.environ["fritzbox_ip"]
2023/01/09-01:05:05 [922136]      File "/usr/lib/python3.9/os.py", line 679, in __getitem__
2023/01/09-01:05:05 [922136]        raise KeyError(key) from None
2023/01/09-01:05:05 [922136]    KeyError: 'fritzbox_ip'
2023/01/09-01:05:05 [922136] Service 'fritzbox_cpu_temperature.py' exited with status 1/0.
2023/01/09-01:05:06 [922136] Error output from fritzbox_uptime.py:
2023/01/09-01:05:06 [922136]    Couldn't retrieve fritzbox uptime
2023/01/09-01:05:06 [922136] Service 'fritzbox_uptime.py' exited with status 1/0.
2023/01/09-01:05:07 [922136] Error output from fritzbox_cpu_usage.py:
2023/01/09-01:05:07 [922136]    Couldn't retrieve fritzbox cpu usage
2023/01/09-01:05:07 [922136] Service 'fritzbox_cpu_usage.py' exited with status 1/0.
2023/01/09-01:05:08 [922136] Error output from fritzbox_traffic.py:
2023/01/09-01:05:08 [922136]    Traceback (most recent call last):
2023/01/09-01:05:08 [922136]      File "/etc/munin/plugins/fritzbox_traffic.py", line 28, in <module>
2023/01/09-01:05:08 [922136]        server = os.environ["fritzbox_ip"]
2023/01/09-01:05:08 [922136]      File "/usr/lib/python3.9/os.py", line 679, in __getitem__
2023/01/09-01:05:08 [922136]        raise KeyError(key) from None
2023/01/09-01:05:08 [922136]    KeyError: 'fritzbox_ip'
2023/01/09-01:05:08 [922136] Service 'fritzbox_traffic.py' exited with status 1/0.
2023/01/09-01:05:08 [922136] Error output from fritzbox_traffic.py:
2023/01/09-01:05:08 [922136]    Traceback (most recent call last):
2023/01/09-01:05:08 [922136]      File "/etc/munin/plugins/fritzbox_traffic.py", line 28, in <module>
2023/01/09-01:05:08 [922136]        server = os.environ["fritzbox_ip"]
2023/01/09-01:05:08 [922136]      File "/usr/lib/python3.9/os.py", line 679, in __getitem__
2023/01/09-01:05:08 [922136]        raise KeyError(key) from None
2023/01/09-01:05:08 [922136]    KeyError: 'fritzbox_ip'
2023/01/09-01:05:08 [922136] Service 'fritzbox_traffic.py' exited with status 1/0.
2023/01/09-01:05:10 [922136] Error output from fritzbox_connection_uptime.py:
2023/01/09-01:05:10 [922136]    Traceback (most recent call last):
2023/01/09-01:05:10 [922136]      File "/etc/munin/plugins/fritzbox_connection_uptime.py", line 28, in <module>
2023/01/09-01:05:10 [922136]        server = os.environ["fritzbox_ip"]
2023/01/09-01:05:10 [922136]      File "/usr/lib/python3.9/os.py", line 679, in __getitem__
2023/01/09-01:05:10 [922136]        raise KeyError(key) from None
2023/01/09-01:05:10 [922136]    KeyError: 'fritzbox_ip'
2023/01/09-01:05:10 [922136] Service 'fritzbox_connection_uptime.py' exited with status 1/0.
2023/01/09-01:05:10 [922136] Error output from fritzbox_connection_uptime.py:
2023/01/09-01:05:10 [922136]    Traceback (most recent call last):
2023/01/09-01:05:10 [922136]      File "/etc/munin/plugins/fritzbox_connection_uptime.py", line 28, in <module>
2023/01/09-01:05:10 [922136]        server = os.environ["fritzbox_ip"]
2023/01/09-01:05:10 [922136]      File "/usr/lib/python3.9/os.py", line 679, in __getitem__
2023/01/09-01:05:10 [922136]        raise KeyError(key) from None
2023/01/09-01:05:10 [922136]    KeyError: 'fritzbox_ip'
2023/01/09-01:05:10 [922136] Service 'fritzbox_connection_uptime.py' exited with status 1/0.
2023/01/09-01:05:12 [922136] Error output from fritzbox_memory_usage.py:
2023/01/09-01:05:12 [922136]    Couldn't retrieve fritzbox memory usage
2023/01/09-01:05:12 [922136] Service 'fritzbox_memory_usage.py' exited with status 1/0.
2023/01/09-01:05:13 [922136] Error output from fritzbox_power_consumption.py:
2023/01/09-01:05:13 [922136]    Couldn't retrieve fritzbox power consumption
2023/01/09-01:05:13 [922136] Service 'fritzbox_power_consumption.py' exited with status 1/0.

What am I did wrong before? The journey to the sirens ...

root@nas52:~# netcat localhost 4949
# munin node at nas52.local
list
cpu cpuspeed df df_inode entropy forks fw_packets http_loadtime if_enp0s25 if_enp4s0 if_err_enp0s25 if_err_enp4s0 interrupts irqstats load memory munin_stats nfsd nfsd4 open_files open_inodes postfix_mailqueue postfix_mailvolume proc_pri processes smart_sdc smart_sdd swap threads uptime users vmstat
/etc/munin/plugins# pip list
Package         Version
--------------- ---------
fritzconnection 1.10.3
lxml            4.6.3
root@nas-525a:~# fritzconnection
fritzconnection v1.10.3
FRITZ!Box 7490 at http://169.254.1.1
FRITZ!OS: 7.29

User rights are ok, Sym.links are present ...

ls -al /usr/share/munin/plugins/fritz*
root@nas52:~# ls -al /usr/share/munin/plugins/fritz*
-rwxr-xr-x 1 root root 2118 29. Apr 2021  /usr/share/munin/plugins/fritzbox_connection_uptime.py
-rwxr-xr-x 1 root root 2009 29. Apr 2021  /usr/share/munin/plugins/fritzbox_cpu_temperature.py
-rwxr-xr-x 1 root root 2036 29. Apr 2021  /usr/share/munin/plugins/fritzbox_cpu_usage.py
-rwxr-xr-x 1 root root 6003 29. Apr 2021  /usr/share/munin/plugins/fritzbox_helper.py
-rwxr-xr-x 1 root root 2413 29. Apr 2021  /usr/share/munin/plugins/fritzbox_memory_usage.py
-rwxr-xr-x 1 root root 3244 29. Apr 2021  /usr/share/munin/plugins/fritzbox_power_consumption.py
-rwxr-xr-x 1 root root 3185 29. Apr 2021  /usr/share/munin/plugins/fritzbox_traffic.py
-rwxr-xr-x 1 root root 2818 29. Apr 2021  /usr/share/munin/plugins/fritzbox_uptime.py
-rwxr-xr-x 1 root root 2418 29. Apr 2021  /usr/share/munin/plugins/fritzbox_wifi_devices.py
root@nas52:~# ls -al /etc/munin/plugins/fritz*
lrwxrwxrwx 1 munin munin 54 28. Dez 16:41 /etc/munin/plugins/fritzbox_connection_uptime.py -> /usr/share/munin/plugins/fritzbox_connection_uptime.py
lrwxrwxrwx 1 munin munin 52 28. Dez 16:41 /etc/munin/plugins/fritzbox_cpu_temperature.py -> /usr/share/munin/plugins/fritzbox_cpu_temperature.py
lrwxrwxrwx 1 munin munin 46 28. Dez 16:41 /etc/munin/plugins/fritzbox_cpu_usage.py -> /usr/share/munin/plugins/fritzbox_cpu_usage.py
lrwxrwxrwx 1 munin munin 43 28. Dez 16:41 /etc/munin/plugins/fritzbox_helper.py -> /usr/share/munin/plugins/fritzbox_helper.py
lrwxrwxrwx 1 munin munin 49 28. Dez 16:41 /etc/munin/plugins/fritzbox_memory_usage.py -> /usr/share/munin/plugins/fritzbox_memory_usage.py
lrwxrwxrwx 1 munin munin 54 28. Dez 16:41 /etc/munin/plugins/fritzbox_power_consumption.py -> /usr/share/munin/plugins/fritzbox_power_consumption.py
lrwxrwxrwx 1 munin munin 44 28. Dez 16:41 /etc/munin/plugins/fritzbox_traffic.py -> /usr/share/munin/plugins/fritzbox_traffic.py
lrwxrwxrwx 1 munin munin 43 28. Dez 16:41 /etc/munin/plugins/fritzbox_uptime.py -> /usr/share/munin/plugins/fritzbox_uptime.py
lrwxrwxrwx 1 munin munin 49 28. Dez 16:41 /etc/munin/plugins/fritzbox_wifi_devices.py -> /usr/share/munin/plugins/fritzbox_wifi_devices.py

Really confused ???, did nothing wrong according to the README https://github.com/Tafkas/fritzbox-munin which is unclear with multiple devices, but even one fritzbox did not work.

The real important information is concealed here https://github.com/oe73773/fritzbox-munin#installation--configuration and referred here https://github.com/Tafkas/fritzbox-munin/issues/39

A really malicious trap, takes me hours to discover, how to deal right with multiple or even one fritzbox. In the README the links are mentioned as sym-links, created with '''ln -d''' I used '''ln -s''' on Debain/11 based System.

This config worked at once, the plugins were listed and produced the above log-file.

root@nas52:~# vi /etc/munin/munin.conf

[fbox-wifi;fqdn1]
#    address 127.0.0.1
    address  localhost
    use_node_name  no

[fbox-wifi;fqdn41]
    address 127.0.0.1
#    address  localhost
    use_node_name  no

root@nas52:~# vi /etc/munin/plugin-conf.d/munin-node

# here comes [fritzbox_nodeNo_*] from /etc/munin/munin.conf
[fritzbox_fqdn1_*]
env.locale              de
env.fritzbox_ip         192.168.sub.1     # 7490 FRITZ!OS: 07.29 - Version aktuell
# If you still have password only login, omit ...fritzbox_username,
# set the ...fritzbox_password and the username is automaticly detected.
env.fritzbox_username   trusted
env.fritzbox_password   passwd
env.traffic_remove_max  true      # if you do not want the possible max values
## env.host_name          fqdn1   # is required when ... ???

[fritzbox_fqdn41_*]
env.locale              de
env.fritzbox_ip         192.168.sub.41    # 7390 FRITZ!OS: 06.87
# If you still have password only login, omit ...fritzbox_username,
# set the ...fritzbox_password and the username is automaticly detected.
env.fritzbox_username   trusted
env.fritzbox_password   passwd
env.traffic_remove_max  true      # if you do not want the possible max values
## env.host_name          fqdn41   # is required when ... ???
root@nas52:~# netcat localhost 4949
# munin node at nas52.local
list
cpu cpuspeed df df_inode entropy forks fritzbox_connection_uptime.py fritzbox_cpu_temperature.py fritzbox_cpu_usage.py fritzbox_memory_usage.py fritzbox_power_consumption.py fritzbox_traffic.py fritzbox_uptime.py fritzbox_wifi_devices.py fw_packets http_loadtime if_enp0s25 if_enp4s0 if_err_enp0s25 if_err_enp4s0 interrupts irqstats load memory munin_stats nfsd nfsd4 open_files open_inodes postfix_mailqueue postfix_mailvolume proc_pri processes smart_sdc smart_sdd swap threads uptime users vmstat
Ldwg2002 commented 1 year ago

how to config multiple fritzboxes and groupe in munin

no matter if one login account for all boxes or different accounts

As all here, I have one fritzbox as router (with wifi), 7490. Since I deploy a Debian-based NAS (OpenMediaVault6) I would like to monitor this fritzbox with these plugins and munin. Despite the miserable documentation part 'installation' as far as details are concerned, it's easy. Only because I found the old 'Update README' https://github.com/oe73773/fritzbox-munin#installation--configuration I was able to run monitoring for at least four fritzboxes >=06.87.

Two years ago I configured a bunch of elder fritzboxes as 'real' access point (IP-Client-Modus, the yellow RJ45 row is a switch, one cable connects to the LAN for the backhaul) for around 20 people and it works fine, including a concept of permissions and access control. Only fritzbox _traffic, _wifi_devices, _cpu_temperature, _cpu_usage, _memory_usage are expected from the access points. _traffic is expected empty, because the switch carries the backhaul into the LAN.

The errors from misconfig above, like server = os.environ["fritzbox_ip"] KeyError: 'fritzbox_ip', I solved with the afore mentioned old 'Update README' and found the correct configuration of the plugins for munin now.

Starting with the three access points >= 06.87 out of seven (some very old ones)

**fw41-7390os0687**
**fw42-7272os0688**    fw43-7270v3os0606
**fw44-7272os0688**    fw45-7270v3os0606
  fw46-3270v3os0554    fw47-3131os0457

now I really have all used five plugins broken_wifi_devices _cpu_usage _traffic _cpu_temperature _memory_usage No problems I expected with 7390 listed compatible and 7272 with os06.88, but surprise, surprise. Any help or bugfixing is appreciated.

Ldwg2002 commented 1 year ago
Resolved [*]:4949 to [::]:4949, IPv6
Not including resolved host [0.0.0.0] IPv4 because it will be handled by [::] IPv6
Binding to TCP port 4949 on host :: with IPv6
Setting gid to "0 0"
2023/01/11-00:00:01 CONNECT TCP Peer: "[::ffff:127.0.0.1]:56822" Local: "[::ffff:127.0.0.1]:4949"
2023/01/11-00:00:01 CONNECT TCP Peer: "[::ffff:127.0.0.1]:56836" Local: "[::ffff:127.0.0.1]:4949"
2023/01/11-00:00:01 CONNECT TCP Peer: "[::ffff:127.0.0.1]:56824" Local: "[::ffff:127.0.0.1]:4949"
2023/01/11-00:00:01 CONNECT TCP Peer: "[::ffff:127.0.0.1]:56818" Local: "[::ffff:127.0.0.1]:4949"
2023/01/11-00:00:01 CONNECT TCP Peer: "[::ffff:127.0.0.1]:56846" Local: "[::ffff:127.0.0.1]:4949"
2023/01/11-00:00:01 CONNECT TCP Peer: "[::ffff:127.0.0.1]:56858" Local: "[::ffff:127.0.0.1]:4949"
2023/01/11-00:00:04 [143010] Error output from fw41_wifi_devices:
2023/01/11-00:00:04 [143010]    Couldn't retrieve connected fritzbox wifi devices
2023/01/11-00:00:04 [143010] Service 'fw41_wifi_devices' exited with status 1/0.
2023/01/11-00:00:04 [143012] Error output from fw44_cpu_usage:
2023/01/11-00:00:04 [143012]    Couldn't retrieve fritzbox cpu usage
2023/01/11-00:00:04 [143012] Service 'fw44_cpu_usage' exited with status 1/0.
2023/01/11-00:00:05 [143011] Error output from fw42_wifi_devices:
2023/01/11-00:00:05 [143011]    Couldn't retrieve connected fritzbox wifi devices
2023/01/11-00:00:05 [143011] Service 'fw42_wifi_devices' exited with status 1/0.
2023/01/11-00:00:05 [143010] Error output from fw41_traffic:
2023/01/11-00:00:05 [143010]    Couldn't retrieve fritzbox traffic
2023/01/11-00:00:05 [143010] Service 'fw41_traffic' exited with status 1/0.
tail: /var/log/munin/munin-node.log: Datei abgeschnitten
2023/01/11-00:00:08 [143010] Error output from fw41_cpu_usage:
2023/01/11-00:00:08 [143010]    Couldn't retrieve fritzbox cpu usage
2023/01/11-00:00:08 [143010] Service 'fw41_cpu_usage' exited with status 1/0.
2023/01/11-00:00:09 [143012] Error output from fw44_wifi_devices:
2023/01/11-00:00:09 [143012]    Couldn't retrieve connected fritzbox wifi devices
2023/01/11-00:00:09 [143012] Service 'fw44_wifi_devices' exited with status 1/0.
2023/01/11-00:00:10 [143010] Error output from fw41_cpu_temperature:
2023/01/11-00:00:10 [143010]    Traceback (most recent call last):
2023/01/11-00:00:10 [143010]      File "/etc/munin/plugins/fw41_cpu_temperature", line 62, in <module>
2023/01/11-00:00:10 [143010]        get_cpu_temperature()
2023/01/11-00:00:10 [143010]      File "/etc/munin/plugins/fw41_cpu_temperature", line 36, in get_cpu_temperature
2023/01/11-00:00:10 [143010]        data = json.loads(xhr_data)
2023/01/11-00:00:10 [143010]      File "/usr/lib/python3.9/json/__init__.py", line 346, in loads
2023/01/11-00:00:10 [143010]        return _default_decoder.decode(s)
2023/01/11-00:00:10 [143010]      File "/usr/lib/python3.9/json/decoder.py", line 337, in decode
2023/01/11-00:00:10 [143010]        obj, end = self.raw_decode(s, idx=_w(s, 0).end())
2023/01/11-00:00:10 [143010]      File "/usr/lib/python3.9/json/decoder.py", line 355, in raw_decode
2023/01/11-00:00:10 [143010]        raise JSONDecodeError("Expecting value", s, err.value) from None
2023/01/11-00:00:10 [143010]    json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
2023/01/11-00:00:10 [143010] Service 'fw41_cpu_temperature' exited with status 1/0.
2023/01/11-00:00:11 [143012] Error output from fw44_memory_usage:
2023/01/11-00:00:11 [143012]    Couldn't retrieve fritzbox memory usage
2023/01/11-00:00:11 [143012] Service 'fw44_memory_usage' exited with status 1/0.
2023/01/11-00:00:12 [143011] Error output from fw42_cpu_usage:
2023/01/11-00:00:12 [143011]    Couldn't retrieve fritzbox cpu usage
2023/01/11-00:00:12 [143011] Service 'fw42_cpu_usage' exited with status 1/0.
2023/01/11-00:00:12 [143010] Error output from fw41_memory_usage:
2023/01/11-00:00:12 [143010]    Couldn't retrieve fritzbox memory usage
2023/01/11-00:00:12 [143010] Service 'fw41_memory_usage' exited with status 1/0.
2023/01/11-00:00:14 [143012] Error output from fw44_cpu_temperature:
2023/01/11-00:00:14 [143012]    Traceback (most recent call last):
2023/01/11-00:00:14 [143012]      File "/etc/munin/plugins/fw44_cpu_temperature", line 62, in <module>
2023/01/11-00:00:14 [143012]        get_cpu_temperature()
2023/01/11-00:00:14 [143012]      File "/etc/munin/plugins/fw44_cpu_temperature", line 36, in get_cpu_temperature
2023/01/11-00:00:14 [143012]        data = json.loads(xhr_data)
2023/01/11-00:00:14 [143012]      File "/usr/lib/python3.9/json/__init__.py", line 346, in loads
2023/01/11-00:00:14 [143012]        return _default_decoder.decode(s)
2023/01/11-00:00:14 [143012]      File "/usr/lib/python3.9/json/decoder.py", line 337, in decode
2023/01/11-00:00:14 [143012]        obj, end = self.raw_decode(s, idx=_w(s, 0).end())
2023/01/11-00:00:14 [143012]      File "/usr/lib/python3.9/json/decoder.py", line 355, in raw_decode
2023/01/11-00:00:14 [143012]        raise JSONDecodeError("Expecting value", s, err.value) from None
2023/01/11-00:00:14 [143012]    json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
2023/01/11-00:00:14 [143012] Service 'fw44_cpu_temperature' exited with status 1/0.
2023/01/11-00:00:14 [143011] Error output from fw42_cpu_temperature:
2023/01/11-00:00:14 [143011]    Traceback (most recent call last):
2023/01/11-00:00:14 [143011]      File "/etc/munin/plugins/fw42_cpu_temperature", line 62, in <module>
2023/01/11-00:00:14 [143011]        get_cpu_temperature()
2023/01/11-00:00:14 [143011]      File "/etc/munin/plugins/fw42_cpu_temperature", line 36, in get_cpu_temperature
2023/01/11-00:00:14 [143011]        data = json.loads(xhr_data)
2023/01/11-00:00:14 [143011]      File "/usr/lib/python3.9/json/__init__.py", line 346, in loads
2023/01/11-00:00:14 [143011]        return _default_decoder.decode(s)
2023/01/11-00:00:14 [143011]      File "/usr/lib/python3.9/json/decoder.py", line 337, in decode
2023/01/11-00:00:14 [143011]        obj, end = self.raw_decode(s, idx=_w(s, 0).end())
2023/01/11-00:00:14 [143011]      File "/usr/lib/python3.9/json/decoder.py", line 355, in raw_decode
2023/01/11-00:00:14 [143011]        raise JSONDecodeError("Expecting value", s, err.value) from None
2023/01/11-00:00:14 [143011]    json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
2023/01/11-00:00:14 [143011] Service 'fw42_cpu_temperature' exited with status 1/0.
2023/01/11-00:00:16 [143011] Error output from fw42_memory_usage:
2023/01/11-00:00:16 [143011]    Couldn't retrieve fritzbox memory usage
2023/01/11-00:00:16 [143011] Service 'fw42_memory_usage' exited with status 1/0.