I have zabbix monitoring multiple servers (Linux and Windows). Is it possible to have zabbix automate services that they are down to automatically restart?
Zabbix – service restart
zabbixzabbix-agent
zabbixzabbix-agent
I have zabbix monitoring multiple servers (Linux and Windows). Is it possible to have zabbix automate services that they are down to automatically restart?
Best Answer
It is possible. First thing you will have to do is enable remote actions on zabbix agents, by setting the following in zabbix_agentd.conf:
You will also need to grant sudo privileges to your zabbix user, so create a file /etc/sudoers.d/zabbix_nopasswd with the following content:
For better security concerns, you'd better only allow zabbix to run specific shell commands, e,g:
After that, restart zabbix agent(s).
Now, on the Zabbix server, log in as an user that has admin privileges to Zabbix web gui, and create new action: Configuration -> Actions -> New Action. Name the new action someething like 'Restart Apache'.
Set Action Type to "Remote Command". Set Remote Command to:
After that, create a Trigger on an item that counts number of apache processes running, in a way that if the number is 0 that the action "Restart Apache" is run, and that's it.