mirror of
https://github.com/YunoHost-Apps/monitorix_ynh.git
synced 2024-09-03 19:46:06 +02:00
f92db1b78c
- Update config from upstream - Use Jinja for config file - Dynamically generate config file depending of the auto detected system configuration - Remove dependancy of mysql as it's not needed - Automatically monitor mysql, postgresql, memcached, redis, php pool v>=8.0, fail2ban, mail, partition and network - Add some config parameter in config panel to make easy to change values - Configure alert system (can be enabled by config panel) - Fix small issue linked to previous packaging v2
40 lines
1.1 KiB
Bash
40 lines
1.1 KiB
Bash
#!/bin/sh
|
|
#
|
|
# Example script used to execute an alert action.
|
|
#
|
|
# This script assumes that you symlink your alert scripts like this:
|
|
# disk.pendsect-alert.sh -> monitorix-alert.sh
|
|
# disk.realloc-alert.sh -> monitorix-alert.sh
|
|
# mail.mqueued-alert.sh -> monitorix-alert.sh
|
|
# system.loadavg-alert.sh -> monitorix-alert.sh
|
|
# ...
|
|
# So you only use one script (saving disk space) and its prefix will
|
|
# appear in the subject and contents of the email, so you will easily
|
|
# identify the source of the alert.
|
|
#
|
|
|
|
MAILTO="__ALERTS_EMAIL__"
|
|
|
|
if [ $# != 3 ] && [ $# != 4 ] ; then
|
|
echo "$0: Wrong number of arguments."
|
|
exit 1
|
|
fi
|
|
|
|
ALERT_TIMEINTVL=$1
|
|
ALERT_THRESHOLD=$2
|
|
current_value=$3
|
|
ALERT_WHEN=$4
|
|
ALERT=`basename $0 | cut -f1 -d-`
|
|
|
|
(
|
|
cat << EOF
|
|
Message from hostname '$HOSTNAME' for '$ALERT' alert.
|
|
|
|
This system is reaching/exceeding ($ALERT_WHEN) the defined threshold value ($ALERT_THRESHOLD) during the last '$ALERT_TIMEINTVL' seconds.
|
|
|
|
The current value is: $current_value
|
|
|
|
Please take proper actions to correct this situation.
|
|
EOF
|
|
) | mail -s "WARNING: Monitorix alert ($ALERT) from '$HOSTNAME'!" $MAILTO
|
|
|