Ad Widget

Collapse

Exec Remote Command on win Hosts

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bashman
    Senior Member
    • Dec 2009
    • 432

    #1

    Exec Remote Command on win Hosts

    Hi,

    I would like to execute a VBScript, my trigger:

    {HOSTNAME:<key>.last(0)}>0

    my remote command:

    HOSTNAME:C:\<path>\cscript.exe uppools.vbs

    my action conditions:

    (A) Trigger = "Mytrigger"
    (B) Trigger value = "PROBLEM"

    (A) AND (B)

    It doesn't work, but i runnig the command on the host works.
    There's no log entry so I don't know if the remote command is w

    I tried this:

    HOSTNAME:C:\WINDOWS\system32\notepad.exe

    But it didn't work. What am I doing wrong?
    978 Hosts / 16.901 Items / 8.703 Triggers / 44 usr / 90,59 nvps / v1.8.15
  • alixen
    Senior Member
    • Apr 2006
    • 474

    #2
    Hi,

    Just a few ideas:

    1. Have you allowed remote execution in Zabbix agent ?
    (EnableRemoteCommands=1 in zabbix_agentd.conf)

    2. Have you checked Zabbix error log ?
    (defined by LogFile in zabbix_agentd.conf)

    3. Have tried to increase debug level in agent ?
    (DebugLevel in zabbix_agentd.conf, 3 by default; you can raise it to 5)

    4. Running an interactive program like notepad doesn't seem a good idea. You'd better try a simple batch script (something like "echo It works > c:\temp\mylog.txt")


    Hope this helps
    Alixen
    http://www.alixen.fr/zabbix.html

    Comment

    • bashman
      Senior Member
      • Dec 2009
      • 432

      #3
      Hi Alixen,

      Thanks for replying so fast.

      1. I allowed remote execution in Zabbix agent.

      2. I checked Zabbix error log, but there was no entry.

      3. I will increase debug level in agent to 5.

      4. I will try to run something like "echo It works > c:\temp\mylog.txt"

      Now I get a log entry like this:

      Requested [system.run[C:\Inetpub\AdminScripts\cscript.exe uppools.vbs,nowait]]
      2560:20091209:091323 Run command 'C:\Inetpub\AdminScripts\cscript.exe uppools.vbs'
      2560:20091209:091323 Execute command 'cmd /C "C:\Inetpub\AdminScripts\cscript.exe uppools.vbs"'
      2560:20091209:091323 Sending back [1]
      3840:20091209:091323 Processing request.
      3840:20091209:091323 In check_security()
      3840:20091209:091323 Requested [system.run[echo It works > c:\temp\mylog.txt,nowait]]
      3840:20091209:091323 Run command 'echo It works > c:\temp\mylog.txt'
      3840:20091209:091323 Execute command 'cmd /C "echo It works > c:\temp\mylog.txt"'
      3840:20091209:091323 Sending back [1]

      I get "mylog.txt" with "It works", but my VBScript doesn't work. If I execute the Script on the local host it works.

      Thanks for your help.
      Last edited by bashman; 09-12-2009, 10:25.
      978 Hosts / 16.901 Items / 8.703 Triggers / 44 usr / 90,59 nvps / v1.8.15

      Comment

      • bashman
        Senior Member
        • Dec 2009
        • 432

        #4
        I tried this entry in Remote Command:

        {HOSTNAME}:C:\Inetpub\AdminScripts\uppools.vbs

        And it worked!.

        Thanks!
        978 Hosts / 16.901 Items / 8.703 Triggers / 44 usr / 90,59 nvps / v1.8.15

        Comment

        Working...