Auto restart Windows service using zabbix

In the event that a critical application service stops unexpectedly or fails to start up for unknown reasons or your web server fails to respond and you are no where near your system, you can setup zabbix to proactively restart such services.

For the purpose of this post, I will configure zabbix to restart ‘Active Directory Domain Service‘ when service goes down.

– Log onto zabbix → click on Configuration/Actions → click Create action (top right corner) → Enter Action name and leave rest as default

zabbix-reactive-01

– Click on Conditions tab → Leave condition label (A) → remove any other conditions and add a new Trigger condition (new condition would be ‘Trigger = >) → click Add to add the new condition

zabbix-reactive-02

– Click on Operations tab → Operation type is ‘Remote command’ → Enter new Target as ‘Current host’ → Type equals ‘Custom script’ → Execute equals ‘Zabbix agent’ → Command enter ‘cmd /c “net start “NTDS”‘ → click Add to add the new reactive action → save the configuration

zabbix-reactive-03

– To test this, simply stop the ‘Active Directory Domain Service‘ → Wait for few seconds and check if service had restarted → To confirm this test, below is the log in the agent log file:

[box type="info" style="rounded" icon="info"]1600:20130723:153732.396 Processing request. 1600:20130723:153732.411 Requested [system.run["cmd /c \"net start \"NTDS\"","nowait"]] 1600:20130723:153732.411 Executing command 'cmd /c "net start "NTDS"' 1600:20130723:153732.411 zbx_execute_nowait(): executing [cmd /C "cmd /c "net start "NTDS""] 1600:20130723:153732.411 Sending back [1][/box]
 
comments powered by Disqus