Ad Widget

Collapse

Remote command - restart windows service

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • louis-m
    Member
    • Nov 2013
    • 70

    #1

    Remote command - restart windows service

    Hi, I would like to restart a windows service if it has been down for x mins.

    I know the custom script would be:

    C:\Windows\System32\net start <servicename> in windows.
    I'm wondering how I would get the zabbix trigger variable (service.name) into this?

    eg a trigger is fired for "SessionEnv" service on windows not started and after 15 minutes, I want zabbix to issue the remote command "C:\Windows\System32\net start SessionEnv"
    Obviously I want the trigger variable within that command so that this will work with any service.
    Last edited by louis-m; 22-09-2017, 23:07.
  • sancho
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Mar 2015
    • 295

    #2
    Hello louis-m,
    I would create a monitoring service that interests you:
    Key: service_state[servicename]
    Then I would create the corresponding trigger and then create an action, type Custom Script with the command net stop "servicename".
    I would configure this action to launch only with the traggier that you have created and on the host that interests you.
    I don't know if there's a simpler way.
    I hope this will help you, and you understand me, my English is not very good.

    Comment

    • louis-m
      Member
      • Nov 2013
      • 70

      #3
      Hi Sancho,
      many thanks for the reply. I seem to be spreading this across 2 threads at the moment so I'll close this one down. I'm trying to achieve this with the minimal effort from a discovery trigger prototype as there are about 100 servers.

      Comment

      • sancho
        Senior Member
        Zabbix Certified SpecialistZabbix Certified Professional
        • Mar 2015
        • 295

        #4
        Ok louis-m

        Comment

        Working...