Révision 6e714d72
General purpose backup monitoring plugin
If you have a directory where daily, weekly, monthly you generate
backups of files, SQL databases, etc, you might want to be informed
if the backup generation process is gone or the behavior changes
greatly. This monitoring plugin watches the number of young files
in a certain directory. Relies on find command to do the job.
| plugins/backup/backup.sh | ||
|---|---|---|
| 1 |
#!/bin/sh |
|
| 2 |
|
|
| 3 |
# Configuration directives, edit before first use. |
|
| 4 |
BACKUP_DIR=/path/to/your/backups |
|
| 5 |
# How old backups should be considered as non-yound anymore in [days]. |
|
| 6 |
LIFETIME=2 |
|
| 7 |
|
|
| 8 |
# The situation is critical if there are no young files, the backup is down. |
|
| 9 |
case $1 in |
|
| 10 |
config) |
|
| 11 |
cat <<'EOM' |
|
| 12 |
graph_title Number of young files at backup directory |
|
| 13 |
graph_vlabel number |
|
| 14 |
autobackup.label number |
|
| 15 |
autobackup.critical 1: |
|
| 16 |
EOM |
|
| 17 |
exit 0;; |
|
| 18 |
esac |
|
| 19 |
|
|
| 20 |
printf "autobackup.value " |
|
| 21 |
find $BACKUP_DIR -mtime -$LIFETIME | wc -l |
|
| 22 |
|
|
Formats disponibles : Unified diff