Introducing munin-plugins for bkctld #64

Open
lpoujol wants to merge 7 commits from munin-plugins into master
5 changed files with 170 additions and 0 deletions

View file

@ -0,0 +1,29 @@
# Munin plugins for bkctld
Plugins can be installed in /etc/munin/plugins/bkctld_incs (as executables)
and be run as root :
~~~
# cat /etc/munin/plugin-conf.d/bkctld
[bkctld_*]
user root
~~~
Don't forget to `systemctl restart munin-node`
## Manual/Quick Deploy
~~~
wget https://gitea.evolix.org/evolix/evobackup/raw/branch/master/server/misc/munin-plugin/bkctld_incs -O /etc/munin/plugins/bkctld_incs
wget https://gitea.evolix.org/evolix/evobackup/raw/branch/master/server/misc/munin-plugin/bkctld_jails -O /etc/munin/plugins/bkctld_jails
wget https://gitea.evolix.org/evolix/evobackup/raw/branch/master/server/misc/munin-plugin/bkctld_ops -O /etc/munin/plugins/bkctld_ops
wget https://gitea.evolix.org/evolix/evobackup/raw/branch/master/server/misc/munin-plugin/bkctld_rsyncs -O /etc/munin/plugins/bkctld_rsyncs
chmod 755 /etc/munin/plugins/bkctld_*
echo "[bkctld_*]
user root
" > /etc/munin/plugin-conf.d/bkctld
systemctl restart munin-node
~~~

View file

@ -0,0 +1,30 @@
#!/bin/bash
#
#
case $1 in
config)
cat <<'UNLIKELY_EOF'
graph_title bkctld incs
graph_vlabel Number of incs
graph_args --lower-limit 0
graph_scale no
graph_category bkctld
graph_info The total number of available incs on the server
incs.info Number of backup incs available
incs.label Incs available
incs_expected.info Number of backup incs expected by config
incs_expected.label Incs expected by config
UNLIKELY_EOF
exit 0;;
esac
printf "incs.value "
ls -ld /backup/incs/*/* | wc -l
printf "incs_expected.value "
cat /etc/evobackup/*.d/incs_policy /etc/evobackup/* 2>/dev/null | wc -l

View file

@ -0,0 +1,29 @@
#!/bin/bash
#
#
case $1 in
config)
cat <<'UNLIKELY_EOF'
graph_title bkctld jails
graph_vlabel Number of jails
graph_args --lower-limit 0
graph_scale no
graph_category bkctld
graph_info The total number of configured jails on the server
jails.info Number of backup jails configured
jails.label Jails Configured
jails_active.info Number of backup jails active (running)
jails_active.label Jails active
UNLIKELY_EOF
exit 0;;
esac
printf "jails.value "
bkctld list | wc -l
printf "jails_active.value "
bkctld status all | grep -v "^JAIL NAME" | grep ON | wc -l

View file

@ -0,0 +1,44 @@
#!/bin/bash
#
#
case $1 in
config)
cat <<'UNLIKELY_EOF'
graph_title bkctld operations running
graph_vlabel Number of bkctld operations curently running
graph_args --lower-limit 0
graph_scale no
graph_category bkctld
graph_info The total number of bkctld operations curently running (being an bkctld inc or rm)
bkctld_inc.info bkctld inc running
bkctld_inc.label Number of inc operation currently running
bkctld_inc.draw AREA
bkctld_rm.info bkctld rm running
bkctld_rm.label Number of delete operation currently running
bkctld_rm.draw STACK
UNLIKELY_EOF
exit 0;;
esac
bkctld_rm=$(ps aux | grep "bkctld-rm" | grep -v grep | wc -l)
bkctld_inc=$(ps aux | grep "bkctld-inc" | grep -v grep | wc -l)
# Normalize values; We can't have more than one inc or more than one rm
if [[ $bkctld_rm -gt 1 ]]; then
bkctld_rm=1
fi
if [[ $bkctld_inc -gt 1 ]]; then
bkctld_inc=1
fi
printf "bkctld_rm.value %s\n" $bkctld_rm
printf "bkctld_inc.value %s\n" $bkctld_inc

View file

@ -0,0 +1,38 @@
#!/bin/bash
#
#
case $1 in
config)
cat <<'UNLIKELY_EOF'
graph_title bkctld rsync
graph_vlabel Number of rsync running in jails
graph_args --lower-limit 0
graph_scale no
graph_category bkctld
graph_info The total number of running rsync process running in jails (ecluding the rsync used to delete old incs)
rsync.info Number of rsync running in jails
rsync.label Rsync running in jails
UNLIKELY_EOF
exit 0;;
esac
rsync_count=0
pid_list=$(ps aux | grep "sh -c rsync" | grep -v grep | awk '{ print $2 }')
for pid in $pid_list; do
pid_root=$(realpath "/proc/${pid}/root")
if [[ $pid_root != '/' ]]; then
((rsync_count++))
fi
done
printf "rsync.value %s\n" $rsync_count