summaryrefslogtreecommitdiff
path: root/roles/install_monitoring/files/munin/munin_wg_peers
blob: 8aa9b874e11d7b795841e444fac888facf3ca92e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/sh
# -*- sh -*-

: << =cut

=head1 NAME

wg_peers_ - Plugin to monitor wg peers

=head1 CONFIGURATION

Set user and group to have access

    [wg_peers_*]
    user root
    group root

=head1 USAGE

Link this plugin to /etc/munin/plugins/

After creating the links, restart munin-node. Don't forget to configure the plugin!

=head1 AUTHORS

Niklas Yann Wettengel <niyawe@niyawe.de>

=head1 LICENSE

GPLv2

=head1 MAGIC MARKERS

 #%# family=manual

=cut

. "$MUNIN_LIBDIR/plugins/plugin.sh"

myname=$(basename "$0" | sed 's/^wg_peers_//g')

if [ "$1" = "config" ]; then
	echo "graph_title wg${myname} peers"
	echo "graph_info This graph shows the wg peers on this supernode"
	echo "graph_args -l 0"
	echo "graph_scale no"
	echo "graph_vlabel peers count"
	echo "graph_category wireguard"
	echo "peers.label peers"
	echo "peers.draw AREA"
	exit 0
fi

echo "peers.value $(wg show wg${myname} peers | wc -l)"