Ad Widget

Collapse

Help Remote VB Script for windows server

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • officielmc
    Member
    • Apr 2011
    • 32

    #1

    Help Remote VB Script for windows server

    Hi guy,

    I would like to execute remotely VB script to restart windows services but I don't know how to do.
    If someone already did it could you explain me step by step please.

    Thanks
  • officielmc
    Member
    • Apr 2011
    • 32

    #2
    Nobody know how to use remote VB script to restart windows services???

    Comment

    • steveboyson
      Senior Member
      • Jul 2013
      • 582

      #3
      First: you need to have at least a basic knowledge of zabbix internal escalation procedures.

      My suggestion:
      Create an "UserParameter=..." entry in your window's agents zabbix_agentd.conf which calls a batch or VB script. That script is used to restart the service.

      You might want to do it asynchronously as restarting services may take a longer time which may exceed the maximum script timeout on the zabbix agent.
      You could extend it with a zabbix trapper item which sends the service state afterwards back to zabbix.

      In your zabbix trigger action you would then filter out the events/the host/the condition and make a call to that userparameter:
      zabbix_agentd -c /etc/zabbix_agend.conf -k [windows-host:restartSvc[myService]]

      So the whole procedure is:
      - for each windows host and each service to be monitored:
      * create a regular zabbix item which checks for service state
      * run it every ~ 120 seconds
      * define a trigger that kicks in if service is down
      * create a zabbix trapper item which receives the "restarted" state
      - on each windows system create a "UserParameter=svcRestart[*],svcrestart.cmd $1" entry in the agentd's config.

      Script "svcrestart.cmd" (pseudo code):
      arg1: service to restart
      if (notRunning(arg1))
      restart_async(arg1)
      if (restartSuccess(arg1))
      zabbix_send "Service {arg1} restarted"
      else
      zabbix_send "Service restart of {arg1} failed"

      As soon as the first item fails, the zabbix trigger kick in and the notification process starts.
      In the assigned action script, just call the previously defined script on agent side which the restarts the service and reports the result back to zabbix.

      Comment

      • steveboyson
        Senior Member
        • Jul 2013
        • 582

        #4
        P.S. I don't want to be offensive, but just because nobody answers it does not neccessarily mean that nobody knows the answer.
        We are all enthusiasts for zabbix but maybe you need to spend some more time on the mechanisms zabbix uses.

        (just a friendly reminder)

        Comment

        Working...