From 27c912a613bd30fb474be15a0b34273a3a4bef2c Mon Sep 17 00:00:00 2001 From: Paul-Henri Froidmont Date: Wed, 14 Feb 2018 17:10:30 +0100 Subject: [PATCH] Add ressources monitoring and fix backup status check --- roles/monit/files/checkBackupStatus.sh | 2 +- roles/monit/templates/monitrc | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/roles/monit/files/checkBackupStatus.sh b/roles/monit/files/checkBackupStatus.sh index 9c6f4bb..e32fdd4 100755 --- a/roles/monit/files/checkBackupStatus.sh +++ b/roles/monit/files/checkBackupStatus.sh @@ -6,7 +6,7 @@ ONGOING_FILE="/backups/backup-ongoing" if [ -f "$ONGOING_FILE" ] then - if test `find "$ONGOING_FILE" -mmin +1` + if test `find "$ONGOING_FILE" -mmin +180` then LAST_MODIFICATION_HOURS=`expr "$(($(date +%s) - $(date +%s -r $ONGOING_FILE)))" / 3600` echo "Backup not finished after more than $LAST_MODIFICATION_HOURS hours" diff --git a/roles/monit/templates/monitrc b/roles/monit/templates/monitrc index a436228..ea92fed 100755 --- a/roles/monit/templates/monitrc +++ b/roles/monit/templates/monitrc @@ -256,6 +256,10 @@ check system $HOST # if write rate > 500 operations/s for 5 cycles then alert # if service time > 10 milliseconds for 3 times within 5 cycles then alert # group server + +check filesystem root with path / + if SPACE usage > 90% then alert + # # ## Check a file's timestamp. In this example, we test if a file is older @@ -295,8 +299,8 @@ check system $HOST ## Check a network link status (up/down), link capacity changes, saturation ## and bandwidth usage. # -# check network public with interface eth0 -# if failed link then alert +check network public with interface eno1 + if failed link then alert # if changed link then alert # if saturation > 90% then alert # if download > 10 MB/s then alert @@ -314,7 +318,7 @@ check file daily-backup-done with path /backups/backup-ok if changed timestamp then alert check program checkBackupStatus with path /usr/local/bin/checkBackupStatus.sh - if status != 0 then alert + if status != 0 then alert check host home-ssh with address phf.ddns.net if failed port 2222 protocol ssh with timeout 20 seconds then alert