Get the App
SLTechnology News&Howtos  ›  Network Security  › 

Zabbix 3.0.3 email alarm

Shulou Source: shulou.com Published: 2022-06-01 05:20:12 10月02日 Update

This zabbix mail alarm is realized by script through sendEmail, a lightweight command line smtp e-mail client.

The Linux distribution used this time is CentOS 6.5 and the Zabix version is 3.0.3.

Download sendEmail

Wget http://caspian.dotconf.net/menu/Software/SendEmail/sendEmail-v1.56.tar.gz

Configure sendEmail

[test@zabbix ~] $sudo yum-y install perl-Net-SSLeay perl-IO-Socket-SSL # installation component [test@zabbix ~] $sudo tar xf sendEmail-v1.56.tar.gz-C / usr/src/ [test@zabbix ~] $cd / usr/src/sendEmail-v1.56/ [test@zabbix sendEmail-v1.56] $lltotal 116Muhami Rwmuri Rwmuri-1 root root 13329 Sep 30 2009 CHANGELOG-rw-r--r-- 1 root root 7949 Sep 30 2009 README-rw-r--r-- 1 root root 4701 Sep 30 2009 README-BR.txt-rwxr-xr-x 1 root root 80213 Sep 30 2009 sendEmaillrwxrwxrwx 1 root root 9 Sep 30 2009 sendEmail.pl-> sendEmail-rw-r--r-- 1 root root 1229 Sep 30 2009 TODO [test@zabbix sendEmail-v1.56] $sudo cp-a sendEmail / usr/local/bin/

Add script

[test@zabbix ~] $cd / usr/local/zabbix/alertscripts/ [test@zabbix ~] $vim sendEmail.shemale tbbbuqwygqyobbga'-m "$body" [test@zabbix ~] $sudo chmod + x sendEmail.sh [test@zabbix ~] $sudo chown zabbix.zabbix sendEmail.sh

-f: sender's mailbox

-t: recipient mailbox

-u: theme

-o: option

-xu: user name

-xp: password

-m: message body

Note: QQ Mail needs to generate the authorization code under the settings and use the authorization code instead of the password to send the email successfully.

Configure the zabbix management page

Click manage-> alarm Media Type Click create Media Type on the far right

Note: after installing zabbix 3.0, you need to fill in these three parameters. 2.x is not required.

Click the Admin user to add an alarm medium

Select the sendEmail.sh script and enter the recipient's email address

Click on the user group, click on the call mode after zabbix administrator, click on it, and it is enabled.

Click Zabbix user Group-> permissions, and select add all.

Click configure-> Action Click default Action

Click configure-> Action-> Action to set the email delivery format

Alarm host: {HOSTNAME1}

Alarm time: {EVENT.DATE} {EVENT.TIME}

Alarm level: {TRIGGER.SEVERITY}

Alarm message: {TRIGGER.NAME}

Alarm item: {TRIGGER.KEY1}

Question details: {ITEM.NAME}: {ITEM.VALUE}

Current status: {TRIGGER.STATUS}: {ITEM.VALUE1}

Event ID: {EVENT.ID}

Click configure-> Action-> Action to set email delivery properties.

Note: the default step is 1-1, that is, from 1 to 1. Once the failure occurs, the sendEmail.sh script is executed to send an alarm email to the Admin user and the zabbix administrator group.

If the fault lasts for 1 hour, it will only be sent once. If you change it to 1-0, it means there is no limit. Infinite transmission

The interval is 60 seconds by default. Then 60 emails will be sent in an hour.

Test email alarm

Randomly add a host that does not exist, and the red status will be displayed after a few minutes

A few minutes later, I received an email indicating that the setting was successful.

Tags: Mail alarm action user configuration script mailbox success host media password hour that is recipient failure time status type management selection Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi NVidia Huawei Microsoft Shulou Information