mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-22 14:16:00 +00:00
Metric pc_active_on_* changed to apc_on_ - active peer connections
Threshold for active connections moved out of the loop, plus moved to optional config setting
This commit is contained in:
parent
bb26f900b1
commit
8262e12e74
1 changed files with 9 additions and 6 deletions
|
@ -11,7 +11,9 @@ wireguard_ - Wildcard-plugin to monitor wireguard peer count and traffic
|
||||||
|
|
||||||
=head1 CONFIGURATION
|
=head1 CONFIGURATION
|
||||||
|
|
||||||
This plugin does not normally require configuration.
|
The following environment variables are used by this plugin
|
||||||
|
|
||||||
|
active_threshold_m - threshold to count the connection as inactive (default 3 minutes)
|
||||||
|
|
||||||
The plugin needs to run as root to be able to call the wg show
|
The plugin needs to run as root to be able to call the wg show
|
||||||
command. This is configured like this:
|
command. This is configured like this:
|
||||||
|
@ -124,9 +126,9 @@ EOF
|
||||||
pc_on_$iface.label $iface
|
pc_on_$iface.label $iface
|
||||||
pc_on_$iface.info Interface $iface
|
pc_on_$iface.info Interface $iface
|
||||||
pc_on_$iface.min 0
|
pc_on_$iface.min 0
|
||||||
pc_on_active_$iface.label Active on $iface
|
apc_on_$iface.label Active on $iface
|
||||||
pc_on_active_$iface.info Active on $iface
|
apc_on_$iface.info Active on $iface
|
||||||
pc_on_active_$iface.min 0
|
apc_on_$iface.min 0
|
||||||
EOF
|
EOF
|
||||||
done
|
done
|
||||||
echo ""
|
echo ""
|
||||||
|
@ -167,15 +169,16 @@ EOF
|
||||||
*)
|
*)
|
||||||
# Collect & print current monitoring values
|
# Collect & print current monitoring values
|
||||||
echo "multigraph wireguard_peercount"
|
echo "multigraph wireguard_peercount"
|
||||||
|
active_threshold=$(date --date="${active_threshold_m:-3} min ago" +%s)
|
||||||
|
|
||||||
for iface in $(wg_interfaces); do
|
for iface in $(wg_interfaces); do
|
||||||
threshold=$(date --date="10 min ago" +%s)
|
|
||||||
iface_peers=$(wg_peers "$iface")
|
iface_peers=$(wg_peers "$iface")
|
||||||
|
|
||||||
peer_count=$(wc -l <<< "$iface_peers")
|
peer_count=$(wc -l <<< "$iface_peers")
|
||||||
active_peer_count=$(awk -F";" -v threshold=$active_threshold '$5 > threshold' <<< "$iface_peers" | wc -l)
|
active_peer_count=$(awk -F";" -v threshold=$active_threshold '$5 > threshold' <<< "$iface_peers" | wc -l)
|
||||||
|
|
||||||
echo "pc_on_$iface.value $peer_count"
|
echo "pc_on_$iface.value $peer_count"
|
||||||
echo "pc_active_on_$iface.value $active_peer_count"
|
echo "apc_on_$iface.value $active_peer_count"
|
||||||
done
|
done
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue