5

I have zabbix monitoring multiple servers (Linux and Windows). Is it possible to have zabbix automate services that they are down to automatically restart?

chicks
  • 3,639
  • 10
  • 26
  • 36
John
  • 105
  • 2
  • 3
  • 9
  • Hi @John can you help how did you monitor Linux services i have done with windows but i need to do for linux can you help with what zabbix keys you used to monitor services status, CPU an RAM – Dexter Oct 08 '18 at 09:27

2 Answers2

6

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:

EnableRemoteCommands=1

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:

zabbix ALL=NOPASSWD: ALL

For better security concerns, you'd better only allow zabbix to run specific shell commands, e,g:

# allows 'zabbix' user to restart apache without password.
zabbix ALL=NOPASSWD: /etc/init.d/apache restart

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:

{HOSTNAME}:/usr/bin/sudo service apache2 restart

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.

dezhi
  • 113
  • 5
Jakov Sosic
  • 5,157
  • 3
  • 22
  • 33
-1

we must I 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.