Ad Widget

Collapse

Remote command return value

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • loophole
    Junior Member
    • Feb 2008
    • 20

    #1

    Remote command return value

    Hi fellow zabbix users,

    right now I'm running a little test with the new beta version of 1.6 and run into some problems with remote command. Not that it is not working but zabbix_server complains like it seems about the returned value. Heres my setup:

    Debian 4.0 updated running Zabbix Server and agentd in version 1.5.3 from the 4. June of 2008. Server and client can communicate with each other.

    After that i installed an Action handler under "Configuration->Actions" with the name of "cmd_trigger" that does not considers any "Action conditions" (so works for every Trigger) and an "Action Operations" that runs a remote command on the zabbix_agentd.

    So far so good. Script is called, it runs, my machine beeps and i'm happy. Just that little log line makes me nervous:

    Code:
    9859:20080820:160734 Type of received value [1] is not sutable for [system.run[/usr/local/bin/zabbix_trigger Trigger Test: OFF,nowait]@Zabbix_Server_Agentd] having type [1219248454]
     9859:20080820:160734 Returning NOTSUPPORTED
    Also on the page under "Monitoring->Events" the Trigger shows up but the last coloum "Actions" reads "In progress" even though the script is long finished.

    Is this a known bug? If not can anyone of you clearify how i can solve that log line?
    Second but i guess this is solved when i return the expected value how do i get rid of "In Progress"?

    Also i don't think the script is realy that bad, but who knows here you go
    Code:
    #!/bin/bash
    /usr/local/bin/beep -l 500 -d 100 -f 1000 -n -l 500 -d 100 -f 2000 -n -l 500 -d 100 -f 1000 2>&1
    date >> /tmp/beeprun
    Hope that setuid'ing the script did not any bad.


    Regards loophole
  • nelsonab
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Sep 2006
    • 1233

    #2
    Increase your logging on both the agent and the server. It looks like you're using a macro in the action. What happens if you execute the following?

    /usr/local/bin/zabbix_trigger Trigger Test: OFF
    echo $?

    Try removing the macro and see what happens.
    RHCE, author of zbxapi
    Ansible, the missing piece (Zabconf 2017): https://www.youtube.com/watch?v=R5T9NidjjDE
    Zabbix and SNMP on Linux (Zabconf 2015): https://www.youtube.com/watch?v=98PEHpLFVHM

    Comment

    • loophole
      Junior Member
      • Feb 2008
      • 20

      #3
      Indeed I'm using Macros in the action.
      One in the Subjectfield: Exception on {hostname}
      and another in Body: Exception occured on {HOSTNAME}

      Also in the field where one puts the command line i use macros:
      /path/to/script {TRIGGER.NAME}: {STATUS}

      Which i removed when creating the Action, but kept reapiering after save.

      Checking on the Logs with debug level 4 (both, server and agentd) i saw that the first macro in the Subjectfield did not got translated. For sure cause is all lower case.
      Code:
      In substitute_macros(data:Exception on {hostname})
         864:20080821:054408 Before substitute_simple_macros(Exception on {hostname})
         864:20080821:054408 In substitute_simple_macros()
         864:20080821:054408 In substitute_simple_macros (data:Exception on {hostname})
         864:20080821:054408 End substitute_simple_macros ()
         864:20080821:054408 End substitute_simple_macros (result:Exception on {hostname})
         864:20080821:054408 After substitute_simple_macros(Exception on {hostname})
         864:20080821:054408 End substitute_macros(result:Exception on {hostname})
      The one in the body gets translated just fine.
      Code:
      In substitute_macros(data:Expection ocured on {HOSTNAME}
      {TRIGGER}.{STATUS})
         864:20080821:054408 Before substitute_simple_macros(Expection ocured on {HOSTNAME}
      {TRIGGER}.{STATUS})
         864:20080821:054408 In substitute_simple_macros()
         864:20080821:054408 In substitute_simple_macros (data:Expection ocured on {HOSTNAME}
      {TRIGGER}.{STATUS})  
         864:20080821:054408 End substitute_simple_macros ()
         864:20080821:054408 End substitute_simple_macros (result:Expection ocured on Zabbix_Server_Agentd
      {TRIGGER}.ON)
         864:20080821:054408 After substitute_simple_macros(Expection ocured on Zabbix_Server_Agentd
      {TRIGGER}.ON)
         864:20080821:054408 End substitute_macros(result:Expection ocured on Zabbix_Server_Agentd
      Just like the macros that are in the remote command line. Is that the problem? Ok the subject line is wrong and needs to be all upper case...

      when running the command line you gave the return value is 0. (on both Trigger Test: On, Trigger Test: Off)

      Heres what the log of the agentd stats:
      Code:
      872:20080821:054408 Requested [system.run[/usr/local/bin/zabbix_trigger Trigger Test: ON,nowait]]
      872:20080821:054408 Run command '/usr/local/bin/zabbix_trigger Trigger Test: ON'
      872:20080821:054408 Sending back [1]
      Code:
      871:20080821:054438 Requested [system.run[/usr/local/bin/zabbix_trigger Trigger Test: OFF,nowait]]
      871:20080821:054438 Run command '/usr/local/bin/zabbix_trigger Trigger Test: OFF'
      871:20080821:054438 Sending back [1]
      Right now i don't have acces to the webinterface of zabbix to change the first macro. I try late that day and see what evolvs.

      You got any further hints or maybe a solution?

      By the way. I found some spelling errors in the log files, do you by any chance know where to report them? PM Alex?

      Greetings loophole

      Comment

      Working...