1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-08-02 14:18:21 +00:00

lxc: working on buster (gandalf), and almost working on virtual (jessie), except lxc_net

This commit is contained in:
Marc SCHAEFER 2019-08-10 11:33:27 +02:00 committed by Lars Kruse
parent 0e0de01136
commit ce6e67fffc
7 changed files with 371 additions and 303 deletions

71
plugins/lxc/lxc_logins Executable file
View file

@ -0,0 +1,71 @@
#!/bin/bash
# -*- sh -*-
: << =cut
=head1 NAME
lxc_logins - Plugin to monitor LXC logins
=head1 CONFIGURATION
[lxc_*]
user root
=head1 INTERPRETATION
This plugin needs root privilege.
=head1 AUTHOR
schaefer@alphanet.ch
=head1 LICENSE
GPLv3
=head1 MAGIC MARKERS
#%# family=auto
#%# capabilities=autoconf
=cut
. $MUNIN_LIBDIR/plugins/plugin.sh
. $MUNIN_LIBDIR/plugins/lxc-lib
active_guests=$(active_guests)
if [ "$1" = "autoconf" ]; then
if [ -r /proc/stat ]; then
echo yes
exit 0
else
echo "no (no /proc/stat)"
exit 0
fi
fi
if [ "$1" = "config" ]; then
cat <<EOF
graph_title Logins
graph_category lxc
EOF
for n in $active_guests
do
g=$(lxc_clean_fieldname $n)
cat <<EOF
logins_${g}.label $n: logins
logins_${g}.type GAUGE
EOF
done
exit 0
fi
for n in $active_guests
do
g=$(lxc_clean_fieldname $n)
echo "logins_${g}.value $(lxc-attach -n $n users | wc -w | bc)"
done