diff --git a/test_backup/test_backup.conf b/test_backup/test_backup.conf new file mode 100644 index 0000000..8d858cc --- /dev/null +++ b/test_backup/test_backup.conf @@ -0,0 +1,3 @@ +#test log and state file +UserParameter=test_backup[*],sudo /etc/zabbix/scripts/test_backup.sh $1 + diff --git a/test_backup/test_backup.sh b/test_backup/test_backup.sh new file mode 100755 index 0000000..e72d04d --- /dev/null +++ b/test_backup/test_backup.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +case $1 in + log) + STATUS=$(tail -n 2 /var/log/backup.log | head -n 1 | grep $(date +%Y-%m-%d) | cut -f 3 -d " ") + if [[ $STATUS == "SUCCESS_BACKUP" ]] + then echo "1"; + else echo "0"; + fi + ;; + state) + test -f /var/tmp/backuper.state + if [[ $? == "0" ]] + then + cat /var/tmp/backuper.state + else + echo "none" + fi + ;; +esac +