In this section you will learn how to set up alerting in the form of notifications in Zabbix.
With items collecting data and triggers designed to "fire" upon problem situations, it would also be useful to have some alerting mechanism in place that would notify us about important events even when we are not directly looking at Zabbix frontend.
This is what notifications do. E-mail being the most popular delivery method for problem notifications, we will learn how to set up an e-mail notification.
Initially there are several predefined notification delivery methods in Zabbix. E-mail is one of those.
To configure e-mail settings, go to Administration → Media types and click on Email in the list of pre-defined media types.
This will present us with the e-mail settings definition form.
All mandatory input fields are marked with a red asterisk.
In the Media type tab, set the values of SMTP server, SMTP helo and SMTP e-mail to the appropriate for your environment.
'SMTP email' will be used as the 'From' address for the notifications sent from Zabbix.
Next, it is required to define the content of the problem message. The content is defined by means of a message template, configured in the Message templates tab.
Click on Add to create a message template, and select Problem as the message type.
Click on Add when ready and save the form.
Now you have configured 'Email' as a working media type. The media type must also be linked to users by defining specific delivery addresses (like we did when configuring a new user), otherwise it will not be used.
Delivering notifications is one of the things actions do in Zabbix. Therefore, to set up a notification, go to Configuration → Actions and click on Create action.
All mandatory input fields are marked with a red asterisk.
In this form, enter a name for the action.
In the most simple case, if we do not add any more specific conditions, the action will be taken upon any trigger change from 'Ok' to 'Problem'.
We still should define what the action should do - and that is done in the Operations tab. Click on Add in the Operations block, which opens a new operation form.
All mandatory input fields are marked with a red asterisk.
Here, click on Add in the Send to Users block and select the user ('user') we have defined. Select 'Email' as the value of Send only to. When done with this, click on Add, and the operation should be added:
That is all for a simple action configuration, so click Add in the action form.
Now, with delivering notifications configured it would be fun to actually receive one. To help with that, we might on purpose increase the load on our host - so that our trigger "fires" and we receive a problem notification.
Open the console on your host and run:
You may run one or several of these processes.
Now go to Monitoring → Latest data and see how the values of 'CPU Load' have increased. Remember, for our trigger to fire, the 'CPU Load' value has to go over '2' for 3 minutes running. Once it does:
If notifications do not work: