freifunkh / ansible

Here we store all Ansible roles and configs used for Freifunk Hannover.
MIT License
7 stars 3 forks source link

ffh_wg_stats.py crashes #219

Closed lemoer closed 2 years ago

lemoer commented 2 years ago
[root@sn02]:~ # /usr/bin/ffh_wg_stats.py -f influx -i wg-10 wg-11 wg-12 wg-13 wg-14 wg-15 wg-16 wg-17 wg-18 wg-19 wg-20 wg-21 wg-22 wg-23 wg-99
Traceback (most recent call last):
  File "/usr/bin/ffh_wg_stats.py", line 95, in <module>
    extended=args.extended))
  File "/usr/bin/ffh_wg_stats.py", line 12, in get_stats
    clients = WireGuard().info(interface)[0].WGDEVICE_A_PEERS.value
AttributeError: 'wgmsg' object has no attribute 'WGDEVICE_A_PEERS'

Problem is here:

[...]
def get_stats(format, interface, extended=True):
    clients = WireGuard().info(interface)[0].WGDEVICE_A_PEERS.value
    [...]

Source: https://github.com/freifunkh/ansible/blob/master/roles/ffh.mesh_wireguard/files/bin/ffh_wg_stats.py#L12

Also the [0] seems fishy to me...

I think we already solved this issue for the vxlan glue.

lemoer commented 2 years ago

For the [0] this seems to be appropriate:

lemoer commented 2 years ago

Not sure, if this will also fix the above mentioned crash.

lemoer commented 2 years ago

Done.

lemoer commented 2 years ago

Actually, I am unsure, why I did not close this issue 28 days ago, when I wrote "Done.". Maybe this issue was not resolved completely... I actually do not know... Maybe there were still issues.

lemoer commented 2 years ago

I think, I remember. I gave up in that evening, because ffh_wg_stats.py is not in sudoers and therefore is not correctly called by telegraf and zabbix_agent...

1977er commented 2 years ago

Done?

lemoer commented 2 years ago

Seems to be stable (for influx).