librenms-agent
librenms-agent copied to clipboard
Wireguard error when polling
Receiving the following output when polling via the LibreNMS GUI
wireguard:1:Script returned exception: Command Execution Error: 'Command '['/bin/wg', 'show', 'wg0', 'dump']' returned non-zero exit status 1.'
command works without issue
root@libreNMS:/etc/snmp# wg show all dump wg0 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx= xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx= 41073 off wg0 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx= (none) 1.1.2.2.2:51821 192.168.50.0/24,192.168.3.0/24,192.168.15.0/24,192.168.70.0/24,10.30.1.0/24,172.26.0.0/24,192.168.69.0/24 1702879153 8076598016 2675459028 off
Libre Version: 23.11.0
Do you have SELinux running? If so, you'll probably need to install a custom module to permit snmp executing the script.
(0) [22:08:04] [root@server:/root]
# getenforce
Enforcing
Otherwise, it may be a permissions issue. I get a failed execution if I run the command as an unprivileged user:
$ wg show wg0 dump
Unable to access interface: Operation not permitted
(1) [22:11:16] [user@server:/home/user]
I am on Ubuntu 23.10
The problem seems to stem from an incorrect parameter being parsed. I am running the script as root and there is an error string?
root@libreNMS:/etc/snmp# ls -ltrh | grep wireguard.py
-rwxr-xr-x 1 root root 9.5K Dec 18 00:19 wireguard.py
root@libreNMS:/etc/snmp# ./wireguard.py
{"errorString": "", "error": 0, "version": 1, "data": {"wg0": {"GeorgiaFirewall": {"minutes_since_last_handshake": 0, "bytes_rcvd": 8930240544, "bytes_sent": 2810537456}}}}
No, an empty error string and an error 0 indicates that there is no error.