Combat: Zabbix Nginx failure to achieve self-healing
1, to create a self-healing fault recovery scripts on the page zabbix
(1) create action on zabbix page, continue the experiment on the basis of Zabbix Six on: https: //www.cnblogs.com/struggle-1216/p/12359472.html
(2) Configuration action, add triggers, when listening on port 80 to perform a certain action does not exist
(3) create a scripting operations
(4) modify the configuration file /etc/zabbix/zabbix_agentd.conf
Server = 192.168.7.100,192.168.7.103,192.168.7.104 # zabbix server is the first server IP address, the second is the IP address of the database, and the third is the active mode proxy proxy IP address ServerActive = 192.168.7.104 # proxy active mode IP address Hostname = 192.168.7.101 # local host IP address EnableRemoteCommands = 1 # turn on the remote connectivity UnsafeUserParameters = 1 # open, supporting special characters such as: pipe character, single and double quotation marks and so on.
Restart zabbix-agent services: systemctl restarrt zabbix-agent
(5) View zabbix zabbix start at this time is user-initiated, due to the general user account is unable to start zabbix server, so need to grant root privileges to zabbix, or start zabbix service as root can be.
(6) modify / etc / sudoers configuration file, let zabbix run as root
root ALL=(ALL) ALL zabbix ALL=(ALL) NOPASSWD:ALL # 授权zabbix用户为root的权限
(7)将nginx服务停掉
(8)创建的zabbix网页上的自治愈脚本就会生效,等待1-2分钟,nginx就会自动启动,实现了基本上的nginx宕机之后能再次启动的效果,这种方法也适用于JAVA、tomcat、redis等服务器上的自治愈,针对某些功能执行某些脚本即可。