Related environment:
Operating system
|
Describe |
IP Address |
Server05 (centos6.6) |
Server-side |
192.168.10.65 |
Server04 (centos6.6) |
Client |
192.168.10.64 |
first, the use of zabbix mail Alarm function
1, installation SendMail
[[Email protected]~]# service postfix stop #linux use postfix Mail Service By default , turn off Postfix first ,ss–tnl View port off monitoring
[[Email protected]~] #yum install SendMail
[[Email protected]~]# vim/etc/mail.rc # Add related sender content
# outgoingmessages is sent in iso-8859-1 if all their characters are# representablein it, otherwise in utf-8.setsendchars Ets=iso-8859-1,utf-8[email protected]setsmtp=smtp.exmail.qq.com:25set [email protected] #认证用户setsmtp-auth-password =xxxxxx #认证密码
[[Email protected]~]# service sendmail start #sendmail monitor Port
Startingsendmail: [OK]
[Email protected]~]# echo "Test.hahahahaha" | Mail-s "Test" [email protected] # email to test
Test SendMail success, landing my QQ mailbox can receive mail!
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/73/04/wKiom1XyLn6Di2jHAAB2ZAYhF_k240.jpg "title=" 1.png " alt= "Wkiom1xyln6di2jhaab2zayhf_k240.jpg"/>
2. Add Zabbix Mail alarm script;
[[Email protected]]# pwd # Enter the relevant directory
/usr/local/zabbix/share/zabbix/alertscripts
[Email protected]]# vim sendmail.sh
#!/bin/bashecho "$" | Mail-s "$" "$" #其中 is the recipient information sent by Zabbix, the e-mail subject, $ $ is the message content;
[[Email protected]]# chmod 777 Sendmail.sh # Remember the script to give permission
1) Zabbix Enter the page to set the email alarm
Select Management--types of warning media
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/73/04/wKiom1XyLpnC1X2VAAGI3QHOvFA363.jpg "title=" 2.png " Width= "height=" 273 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:600px;height:273px; "alt=" Wkiom1xylpnc1x2vaagi3qhovfa363.jpg "/>
2) Tap Email into the Settings screen: Select Type--script, enter the script name written earlier;
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/73/01/wKioL1XyMNPxE-oWAAFWsGXpvpo095.jpg "title=" 3.png " Width= "height=" border= "0" hspace= "0" vspace= "0" style= "width:600px;height:270px;" alt= " Wkiol1xymnpxe-owaafwsgxpvpo095.jpg "/>
second, monitoring client port;
1, the creation of monitoring projects;
1) Click Configuration--host--project;
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/73/04/wKiom1XyL6fRRCW2AAJJqfVVWIE853.jpg "title=" 4.png " Width= "height=" 288 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:800px;height:288px; "alt=" Wkiom1xyl6frrcw2aajjqfvvwie853.jpg "/>
2) Select the upper right corner to create the monitoring item;
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/73/01/wKioL1XyMeGwJtG_AALtXr0jW38968.jpg "title=" 5.png " alt= "Wkiol1xymegwjtg_aaltxr0jw38968.jpg"/>
3) Set the monitoring item, only need to fill in the name, the key value (select after key point)Net.tcp.port[<ip>,port] module
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/73/04/wKiom1XyL77iPQ63AAKFmjt5s_w887.jpg "title=" 6.png " Width= "height=" 857 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" WIDTH:600PX;HEIGHT:857PX; "alt=" Wkiom1xyl77ipq63aakfmjt5s_w887.jpg "/>
Select net.tcp.port[<ip>,port] module: Check to see if you can connect to the specified TCP port. The 0--indicates that the connection cannot be connected,1- indicates . an IP address is an option. If an IP address is omitted, the system uses the 127.0.0.1 address . Example:net.tcp.port[,80]
4) After the addition is complete, the following is displayed:
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/73/01/wKioL1XyMfjzegP5AAGG-Efi9ng542.jpg "title=" 7.png " Width= "height=" border= "0" hspace= "0" vspace= "0" style= "width:800px;height:92px;" alt= " Wkiol1xymfjzegp5aagg-efi9ng542.jpg "/>
2. Create a trigger:
1) Click Configuration--host--trigger;
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/73/04/wKiom1XyL9ayGuHNAAHeO59DgzA297.jpg "title=" 8.png " Width= "height=" 308 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:800px;height:308px; "alt=" Wkiom1xyl9ayguhnaaheo59dgza297.jpg "/>
2) Click on the top right corner--Create a trigger;
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/73/01/wKioL1XyMhHAWM1oAAB4kUMDaN0128.jpg "title=" 9.png " alt= "Wkiol1xymhhawm1oaab4kumdan0128.jpg"/>
3) Enter the name of the trigger-click Add (Project);
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/73/04/wKiom1XyL-zTyFyIAAHd8QDwd4Y622.jpg "title=" 10.png "Width=" "height=" 580 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:800px;height:580px; "alt=" Wkiom1xyl-ztyfyiaahd8qdwd4y622.jpg "/>
4) Click to select;
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/73/01/wKioL1XyMiXD5DUMAADhJgtyGUE541.jpg "title=" 11.png "Width=" "height=" 246 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:800px;height:246px; "alt=" Wkiol1xymixd5dumaadhjgtygue541.jpg "/>
5) View the project we created just now;
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/73/04/wKiom1XyMAHBIhPaAADADvTIGCE743.jpg "title=" 12.png "Width=" height= "border=" 0 "hspace=" 0 "vspace=" 0 "style=" WIDTH:600PX;HEIGHT:77PX; "alt=" Wkiom1xymahbihpaaadadvtigce743.jpg "/>
6) Select Insert;
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/73/01/wKioL1XyMkbyJV68AAGL2xVTkvo778.jpg "title=" 13.png "Width=" "height=" 325 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:800px;height:325px; "alt=" Wkiol1xymkbyjv68aagl2xvtkvo778.jpg "/>
7) Select the severity and click Add;
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/73/01/wKioL1XyMlKDUqKuAAFX9jOMD1k272.jpg "title=" 14.png "Width=" "height=" 448 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:600px;height:448px; "alt=" Wkiol1xymlkduqkuaafx9jomd1k272.jpg "/>
3. Create an action
1) Select configuration--action--Create action:
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/73/04/wKiom1XyMDLwjS-2AAGJ4Npq5X4316.jpg "title=" 15.png "Width=" "height=" "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:800px;height:140px; "alt=" Wkiom1xymdlwjs-2aagj4npq5x4316.jpg "/>
2) Create a name and tick the reply message:
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/73/04/wKiom1XyMEGThSUmAAH7j1JijTo189.jpg "title=" 16.png "Width=" "height=" 492 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:600px;height:492px; "alt=" Wkiom1xymegthsumaah7j1jijto189.jpg "/>
3) then set the conditions; Select the trigger value = problem , click on the trigger condition where the add:
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/73/04/wKiom1XyME7CuGXMAAEg-JP1l4U436.jpg "title=" 17.png "Width=" "height=" 205 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:600px;height:205px; "alt=" Wkiom1xyme7cugxmaaeg-jp1l4u436.jpg "/>
4) Finally set the action--NEW:
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/73/04/wKiom1XyMGDD7FHHAAEpFGg6nMg380.jpg "title=" 18.png "Width=" "height=" "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:800px;height:200px; "alt=" Wkiom1xymgdd7fhhaaepfgg6nmg380.jpg "/>
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/73/04/wKiom1XyMG_wTwOWAAMAw19ju8Q977.jpg "title=" 19.png "Width=" "height=" 696 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:800px;height:696px; "alt=" Wkiom1xymg_ Wtwowaamaw19ju8q977.jpg "/>
phase:0 is connected,1 means connected
step duration, as required, I want to test here, so a second action;
Select the relevant user group;
Select the relevant user;
Select Send Alarm mode: Email
Click Add when you are done!
Test:
1, login client closed Port
[[Email protected]~]# service httpd stop
#马上就会收 messages that are hung off the port.
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/73/01/wKioL1XyMqjRDmumAACcbcx1T5k771.jpg "title=" 20.png "alt=" Wkiol1xymqjrdmumaaccbcx1t5k771.jpg "/>
2. Open port on client
[[Email protected]~]# service httpd start
# wait a minute to receive the message of Port OK;
(the test post 80down above the message is the name of the trigger I was creating.) It seems that the name of the trigger is unreasonable. )
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/73/01/wKioL1XyMrLxD52sAACEVSKBUc0079.jpg "title=" 21.png "alt=" Wkiol1xymrlxd52saacevskbuc0079.jpg "/>
Note: I do not know why I received the details of the error is attached to the form of sending, temporarily did not find a solution, if found, I will add here;
Ok! Here the mail alarm and monitoring 80 port functions are realized!!
This article is from the "obsessed" blog, make sure to keep this source http://dragondragon.blog.51cto.com/6170889/1693719
Zabbix Series (three): Set up the mail alarm, and test the monitoring port 80;