Zabbix mail script

A short how to, on getting mail notifications from your Zabbix installation.

apt-get install mailutils

Choose 'Internet Site'

Choose a fdn, ie: ''

Check the location of the alert scripts by checking "/etc/zabbix/zabbix_server.conf" and look for the AlertScriptsPath value.

vi /etc/zabbix/alert.d/zabbix-mail

Use the following contents:

cat <<EOF | mail -s "$subject" "$to"

Make sure you make the file executable by the Zabbix user.

In the Zabbix web interface, go to "Administration", "Media Types" and choose (or create an item) "Email".
Set it's type to "Script" and fill in "zabbix-mail". (The file you created in the alertscripts directory.)

If you haven't already, you need to setup this media type for the user that wants to receive alert emails.

In the Zabbix web interface, go to "Administration", "Users".
Click the "Users" column where your user resides. Next, click the name in the Alias column.
Click the "Media" tab and "add" the email media type.

Don't forget to click the save button otherwise it won't get saved.

The last thing you also need to check. Are the 'actions' enabled for sending mail.

Go to "Configuration", "Action"

Then make sure that the "Report problems to Zabbix administrators" action is set to "enabled.".

Facebook Twitter LinkedIn