mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-22 14:16:00 +00:00
[backup/fresh-backups] Rework limits
Signed-off-by: Olivier Mehani <shtrom@ssji.net>
This commit is contained in:
parent
cfa5206e99
commit
0893243421
1 changed files with 10 additions and 6 deletions
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/sh
|
#!/bin/sh -u
|
||||||
|
|
||||||
: << =cut
|
: << =cut
|
||||||
|
|
||||||
|
@ -51,18 +51,22 @@ GPLv2
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
|
if [ "${MUNIN_DEBUG:-0}" = 1 ]; then
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
# Configuration directives, edit before first use.
|
# Configuration directives, edit before first use.
|
||||||
BACKUP_DIR=${backup_dir:-/data/backup}
|
BACKUP_DIR=${backup_dir:-/data/backup}
|
||||||
ARCHIVE_PATTERN="${archive_pattern:-*.tar.bz2}"
|
ARCHIVE_PATTERN="${archive_pattern:-*.tar.bz2}"
|
||||||
# How old backups should be considered as non-yound anymore in [days].
|
# How old backups should be considered as non-young anymore in [days].
|
||||||
LIFETIME=${lifetime:-2}
|
LIFETIME=${lifetime:-2}
|
||||||
# Critical states will be issued when the number of fresh backups archives is below `backup_number`,
|
# Critical states will be issued when the number of fresh backups archives is below `backup_number`,
|
||||||
# and warnings below `backup_number*lifetime`
|
# and warnings below `backup_number*lifetime - 1`
|
||||||
CRIT=${backup_number:-1}
|
CRIT=${backup_number:-1}
|
||||||
WARN=$((CRIT*LIFETIME))
|
# We should have at least LIFETIME-1 complete backups when the new one is in progress
|
||||||
|
WARN=$((CRIT*(LIFETIME-1)))
|
||||||
|
|
||||||
# The situation is critical if there are no young files, the backup is down.
|
# The situation is critical if there are no young files, the backup is down.
|
||||||
case $1 in
|
case ${1:-} in
|
||||||
config)
|
config)
|
||||||
cat << EOF
|
cat << EOF
|
||||||
graph_title Fresh (<=${LIFETIME}d) backups archives in ${BACKUP_DIR}
|
graph_title Fresh (<=${LIFETIME}d) backups archives in ${BACKUP_DIR}
|
||||||
|
@ -77,6 +81,6 @@ EOF
|
||||||
esac
|
esac
|
||||||
|
|
||||||
printf "freshcount.value "
|
printf "freshcount.value "
|
||||||
find "${BACKUP_DIR}" -name "${ARCHIVE_PATTERN}" -a -mtime "-${LIFETIME}" | wc -l
|
find "${BACKUP_DIR}" -name "${ARCHIVE_PATTERN}" -mmin "-$(((LIFETIME+1)*60*24))" | wc -l
|
||||||
printf "freshcount.extinfo "
|
printf "freshcount.extinfo "
|
||||||
du -sh "${BACKUP_DIR}"
|
du -sh "${BACKUP_DIR}"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue