Please enable JS

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: 'zabbix.myzabbixserver.com'

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:

#!/bin/bash
 
to=$1
subject=$2
body=$3
 
cat <<EOF | mail -s "$subject" "$to"
$body
EOF


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.".
 



Interessant

Een interessant onderwerp voorbij zien komen en er meer over te weten komen? Neem contact op.