Closed arrmo closed 1 year ago
Thanks, @arrmo
Can you share an example of the sanitized wg show all dump
output as-is?
Sure, NP! But ... is there an easy way to sanitize (vs. manual)?
@arrmo I only want to see one line of output with the additional parameter displayed, so just one line sanitized (manually) will do. Any line except the very first line that is.
Sure, NP! Here you go - make sense?
wg0 ---removed--- ---removed--- ---wg0Port--- off
wg1 ---removed--- ---removed--- ---wg2Port--- 0xbb74
0xbb74
is the fwmark. Nothing else on these two lines (in the output).
Thanks!
Thanks @arrmo . Okay, that makes sense. Your change definitely works, but the bug is actually because I filter out the first line which is the interface-specific dump (see https://github.com/librenms/librenms-agent/blob/master/snmp/wireguard.py#L231). Since I only have one wireguard interface, I didn't catch what would happen with multiple interfaces.
Instead of dumping with "all" or checking that the number of columns equals "9", I'll update the script to grab the list of wireguard interfaces with wg show interfaces
, then execute a wg show <wg_interface> dump
for each interface discovered. This way if the number of columns for the client endpoint ever changes (exceeds or is less than 9), the script won't break (hopefully). I can get around to doing this in a couple weeks after the holidays.
Works for me, thanks! Your solution makes sense to me - and yes, that wg1
line is about half way through the output.
Have a great break!
I can get around to doing this in a couple weeks after the holidays.
So should this be closed then?
@Jellyfrog Yes, this should be closed.
@arrmo If you want to test out my fixes, they are here: https://github.com/librenms/librenms-agent/pull/452
@arrmo If you want to test out my fixes, they are here: #452
Works great, thanks!
The current script fails to run if any parameters are set for the interface, like (for example), FwMark ... the reason is,
wg show all dump
outputs this info as well, which doesn't work with the current logic.