mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-22 02:51:03 +00:00
Update plugins/wireguard/wireguard_
Co-authored-by: Pim <pimlie@hotmail.com>
This commit is contained in:
parent
7ff94424c0
commit
bb26f900b1
1 changed files with 6 additions and 9 deletions
|
@ -169,16 +169,13 @@ EOF
|
||||||
echo "multigraph wireguard_peercount"
|
echo "multigraph wireguard_peercount"
|
||||||
for iface in $(wg_interfaces); do
|
for iface in $(wg_interfaces); do
|
||||||
threshold=$(date --date="10 min ago" +%s)
|
threshold=$(date --date="10 min ago" +%s)
|
||||||
isactive=0
|
iface_peers=$(wg_peers "$iface")
|
||||||
for line in $(wg_peers "$iface"); do
|
|
||||||
handshake=$(echo "$line" | tr ';' ' ' | awk '{print $5}')
|
|
||||||
if [[ "handshake" -gt "threshold" ]]; then
|
|
||||||
isactive=$((isactive + 1))
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "pc_on_$iface.value $(wg show "$iface" peers | wc -l)"
|
peer_count=$(wc -l <<< "$iface_peers")
|
||||||
echo "pc_on_active_$iface.value $isactive"
|
active_peer_count=$(awk -F";" -v threshold=$active_threshold '$5 > threshold' <<< "$iface_peers" | wc -l)
|
||||||
|
|
||||||
|
echo "pc_on_$iface.value $peer_count"
|
||||||
|
echo "pc_active_on_$iface.value $active_peer_count"
|
||||||
done
|
done
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue