Update plugins/wireguard/wireguard_
Co-authored-by: Pim <pimlie@hotmail.com>
This commit is contained in:
parent
7ff94424c0
commit
bb26f900b1
|
@ -169,16 +169,13 @@ EOF
|
|||
echo "multigraph wireguard_peercount"
|
||||
for iface in $(wg_interfaces); do
|
||||
threshold=$(date --date="10 min ago" +%s)
|
||||
isactive=0
|
||||
for line in $(wg_peers "$iface"); do
|
||||
handshake=$(echo "$line" | tr ';' ' ' | awk '{print $5}')
|
||||
if [[ "handshake" -gt "threshold" ]]; then
|
||||
isactive=$((isactive + 1))
|
||||
fi
|
||||
done
|
||||
iface_peers=$(wg_peers "$iface")
|
||||
|
||||
echo "pc_on_$iface.value $(wg show "$iface" peers | wc -l)"
|
||||
echo "pc_on_active_$iface.value $isactive"
|
||||
peer_count=$(wc -l <<< "$iface_peers")
|
||||
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
|
||||
echo ""
|
||||
|
||||
|
|
Loading…
Reference in New Issue