mirror of
https://github.com/munin-monitoring/contrib.git
synced 2018-11-08 00:59:34 +01:00
[backup-manager] Rudimentary backup-manager plugin
Signed-off-by: Olivier Mehani <shtrom@ssji.net>
This commit is contained in:
parent
d42751c908
commit
5f33833cb5
39
plugins/backup/backup-manager
Executable file
39
plugins/backup/backup-manager
Executable file
@ -0,0 +1,39 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Example config:
|
||||||
|
# [backup-manager]
|
||||||
|
# user root
|
||||||
|
# env.backup_dir /path/to/your/backups/
|
||||||
|
# env.lifetime 2
|
||||||
|
# env.archive_pattern *.tar.bz2
|
||||||
|
# env.backup_number 4
|
||||||
|
|
||||||
|
# Configuration directives, edit before first use.
|
||||||
|
BACKUP_DIR=${backup_dir:-/data/backup}
|
||||||
|
ARCHIVE_PATTERN="${archive_pattern:-*.tar.bz2}"
|
||||||
|
# How old backups should be considered as non-yound anymore in [days].
|
||||||
|
LIFETIME=${lifetime:-2}
|
||||||
|
# Critical states will be issued when the number of fresh backups archives is below `backup_number`,
|
||||||
|
# and warnings below `backup_number*lifetime`
|
||||||
|
CRIT=${backup_number:-1}
|
||||||
|
WARN=$((${CRIT}*${LIFETIME}))
|
||||||
|
|
||||||
|
# The situation is critical if there are no young files, the backup is down.
|
||||||
|
case $1 in
|
||||||
|
config)
|
||||||
|
cat << EOF
|
||||||
|
graph_title Fresh (<=${LIFETIME}d) backups archives in ${BACKUP_DIR}
|
||||||
|
graph_vlabel number
|
||||||
|
graph_args -l 0
|
||||||
|
graph_category system
|
||||||
|
freshcount.label number
|
||||||
|
freshcount.critical ${CRIT}:
|
||||||
|
freshcount.warning ${WARN}:
|
||||||
|
EOF
|
||||||
|
exit 0;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
printf "freshcount.value "
|
||||||
|
find $BACKUP_DIR -name "${ARCHIVE_PATTERN}" -a -mtime -$LIFETIME | wc -l
|
||||||
|
printf "freshcount.extinfo "
|
||||||
|
du -sh $BACKUP_DIR
|
Loading…
Reference in New Issue
Block a user