Monitorix/docs/monitorix-alert.sh

30 lines
582 B
Bash
Raw Normal View History

2012-10-22 15:26:37 +01:00
#!/bin/sh
#
# Example script used to execute an alert action.
#
MAILTO="root@localhost"
2012-10-22 15:26:37 +01:00
if [ $# != 3 ] && [ $# != 4 ] ; then
echo "$0: Wrong number of arguments."
2012-10-22 15:26:37 +01:00
exit 1
fi
ALERT_TIMEINTVL=$1
ALERT_THRESHOLD=$2
current_value=$3
ALERT_WHEN=$4
2012-10-22 15:26:37 +01:00
(
cat << EOF
2013-01-23 11:06:19 +00:00
Message from hostname '$HOSTNAME'.
2012-10-22 15:26:37 +01:00
This system is reaching/exceeding ($ALERT_WHEN) the defined threshold value ($ALERT_THRESHOLD) during the last '$ALERT_TIMEINTVL' seconds.
2012-10-22 15:26:37 +01:00
The current value is: $current_value
Please take proper actions to correct this situation.
EOF
) | mail -s "WARNING: Monitorix alert!" $MAILTO
2012-10-22 15:26:37 +01:00