Zabbix Custom execute remote command and Rating report alert example
The detailed option description refers to the previous content, where only the operation process is demonstrated.
Precautions:
Operation
Send Message
Media Type
Email, SMS, Jabber, Script, EZ texting
User
Remote command
(1) Define sudo rules for Zabbix;
Zabbix all= (All) all
(2) Agent that does not support active mode;
(3) Do not support proxy mode;
(4) The length of the command shall not exceed 255 characters;
(5) macros can be used;
(6) Zabbix-server only executes the command, and does not care whether the command is executed successfully;
Premise:
Each zabbix-agent to be configured to support the execution of remote commands:
Enableremotecommands=1
If the command is executed as a different user, then the command itself is to be run in sudo mode:
SUDO/ETC/RC.D/INIT.D/HTTPD restart
In the sudoers file on each agent, note the following line:
#Defaults Requiretty
Zabbix all= (All) all
Script:alert Script
Placed in a specific directory (parameters in the zabbix_server.conf configuration file;): alertscriptspath=/usr/lib/zabbix/alertscripts
The script can use $, $, $ $ to invoke the recipient of the message in action, default Subject, default message;
Note: The new script in this directory, only restart Zabbix-server can be used;
1, create host group-hosts
2, create applications:http service
3, create item
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/79/EA/wKioL1ad8ZGTtJZCAACrW2Y7mec512.png "style=" float: none; "title=" 1.png "alt=" Wkiol1ad8zgttjzcaacrw2y7mec512.png "/>
4, create Trigger
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/79/EB/wKiom1ad8VujlAm4AAB3WI8mc5g482.jpg "title=" Trigger.jpg "style=" Float:none; "alt=" wkiom1ad8vujlam4aab3wi8mc5g482.jpg "/>
5, create: Actions
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/79/EB/wKiom1ad8VmjCnbiAACW7lvbyNc504.png "title=" Active1.png "style=" Float:none; "alt=" Wkiom1ad8vmjcnbiaacw7lvbync504.png "/>
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/79/EB/wKiom1ad8ViwtH1uAACMts-Z5Fo186.jpg "style=" float: none; "title=" a2.jpg "alt=" Wkiom1ad8viwth1uaacmts-z5fo186.jpg "/>
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/79/EA/wKioL1ad8ZOBRVGsAAD9NurdEDY482.jpg "style=" float: none; "title=" a3.jpg "alt=" Wkiol1ad8zobrvgsaad9nurdedy482.jpg "/>
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/79/EA/wKioL1ad8ZSDtizzAAD8OTX-Ya0463.jpg "style=" float: none; "title=" o4.jpg "alt=" Wkiol1ad8zsdtizzaad8otx-ya0463.jpg "/>
6, create Meida type and user
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/79/EA/wKioL1ad8s6TOvDSAACEvD31xuU799.jpg "style=" float: none; "title=" m.jpg "alt=" Wkiol1ad8s6tovdsaacevd31xuu799.jpg "/>
650) this.width=650; "src=" http://s1.51cto.com/wyfs02/M00/79/EB/wKiom1ad8pTB91LBAADESZe_ZxU707.jpg "style=" float: none; "title=" u1.jpg "alt=" Wkiom1ad8ptb91lbaadesze_zxu707.jpg "/>
650) this.width=650; "src=" http://s1.51cto.com/wyfs02/M01/79/EA/wKioL1ad8s_TdZr6AAFSNL-vVsY240.jpg "style=" float: none; "title=" u2.jpg "alt=" Wkiol1ad8s_tdzr6aafsnl-vvsy240.jpg "/>
7, Alarm Email script
vim/usr/lib/zabbix/alertscripts/alerttest.sh
650) this.width=650; "src=" http://s1.51cto.com/wyfs02/M00/79/EB/wKiom1ad8v7wftptAAAMkr6URCI368.jpg "title=" j1.jpg "alt=" Wkiom1ad8v7wftptaaamkr6urci368.jpg "/>
Restart Zabbix-server, complete.
L15.4 Zabbix Custom execute remote command and Rating report alert example