Zabbix3 Email Alerts

Source: Internet
Author: User
Tags socket install perl
I use the Zabbix version of 3.2.4,zabbix 3 should be universal 1, sendemail installation: Cd/usr/local/src/wget http://caspian.dotconf.net/menu/Software/ sendemail/sendemail-v1.56.tar.gz Yum Install Perl-net-ssleay perl-io-socket-ssl-y tar-xvf sendemail-v1.56.tar.gz CD Sendemail-v1.56/cp-ra sendemail/usr/local/bin/chmod +x/usr/local/bin/sendemail ls-d/usr/local/bin/sendEmail
2. Test sendEmail parameter Description:/usr/local/bin/sendemail command Main program-F from@163.com Sender mailbox-T to@163.com recipient mailbox-S smtp.163.com Sender mailbox SMTP server -U "I am the subject of the message" message the title of the Mail-o message-content-type=html message content format, HTML indicates that it is HTML format-o MESSAGE-CHARSET=UTF8 message content encoded-XU from@163.com Sender The user name of the mailbox-xp 123456 sender's mailbox password-m "I am the message content" message specific content
/usr/local/bin/sendemail-f test@qq.com-t test@qq.com-s test@qq.com-u "zabbxitest"-O Message-content-type=html-o Mess Age-charset=utf8-xu test@qq.com-xp 123456-m "I am the test"
3,zabbix a custom specified directory vim/usr/local/zabbix/etc/zabbix_server.conf alertscriptspath=/data/zabbix/alertscripts restart Zabbix_ Server
4. Create a Send mail script under define path here the mailbox password is 163 mailbox SMTP authorization code, need to go to mailbox to open SMTP feature vim/data/zabbix/alertscripts/send.sh #!/bin/bash # know send target mailbox to=$ 1 #邮件标题 subject=$2 #邮件内容 body=$3 from=xxxxxx@163.com smtp=smtp.163.com passwd=geenk/usr/local/bin/sendemail-f "$from"- T "$to"-S "$smtp"-U "$subject"-O message-content-type=html-o message-charset=utf8-xu "$from"-xp "$passwd"-M "$body"
Test script can send mail: Chown-r zabbix:zabbix/data/zabbix/alertscripts/send.sh./send.sh xxx@163.com 11 11

Note: Centos7 run send may error: [Root@localhost alertscripts]#./send.sh xx@163.com 11 11 ************************************* Using the default of Ssl_verify_mode of Ssl_verify_none for client is deprecated! Please set Ssl_verify_mode to Ssl_verify_peer together with ssl_ca_file| Ssl_ca_path for verification. If you really don ' t want to verify the certificate and keep the connection open to Man-in-the-middle attacks please set SS L_verify_mode explicitly to Ssl_verify_none in your application. At/usr/local/bin/sendemail Line 1906. Invalid ssl_version specified at/usr/share/perl5/vendor_perl/io/socket/ssl.pm line 424. Reason: [Root@localhost alertscripts]# Perl-v is Perl 5, version, Subversion 3 (v5.16.3) built for X86_64-linux-threa D-multi (with the registered patches, see perl-v for more detail) Copyright 1987-2012, Larry Wall because the version of Perl under CentOS 7 is 5.16 , while centos6.5 is 5.10, version incompatibility resolved:/usr/local/bIn/sendemail-f "$from"-T "$to"-S "$smtp"-U "$subject"-O message-content-type=html-o message-charset=utf8-xu "$from" -xp "$passwd"-M "$body"-o tls=no plus the tls=no parameter is OK [root@localhost alertscripts]#./send.sh xx@163.com 16 13:57:5 2 localhost sendemail[34132]: Email was sent successfully!
5 Zabbix Web Segment configuration: 1, fill in the type of alarm media
The script name cannot be written in the wrong parameter: {ALERT. SENDTO} {ALERT. SUBJECT} {ALERT. MESSAGE} 2, fill in the Alarm media users
3. Fill in the action
Parameter: Default recipient: {TRIGGER. Status}:{trigger.name} default information alarm host:&nbsp; {hostname1}<br/> Alarm Time:&nbsp; {EVENT. Date}{event. Time}<br/> Alarm Level:&nbsp; {TRIGGER. severity}<br/> Alarm Information:&nbsp; {trigger.name}<br/> Alarm Project:&nbsp; {TRIGGER. key1}<br/> Problem Details:&nbsp; {item.name}:&nbsp; {ITEM. Value}<br/> Current status:&nbsp; {TRIGGER. status}:&nbsp; {ITEM. Value1}<br/> Event id:&nbsp; {event.id}<br/>
Details:

Restore operation:

After completion can be tested, stop the Client Agent service, about five minutes or so to receive a warning message

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.