Ad Widget

Collapse

system.run returning "ZBX_NOTSUPPORTED: Too many parameters."

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tiarnaigh
    Junior Member
    • Sep 2013
    • 27

    #1

    system.run returning "ZBX_NOTSUPPORTED: Too many parameters."

    Hi folks.
    I've tried finding a solution for this on these forums, but as yet can't get any. I'm trying to run commands such as the following from my Zabbix server to several remote agents, but they bomb out each time, as they appear to be receiving the incorrect number of parameters (All I want to do is replace any instances of "adam" with "adam,dave" for example in my group file):


    [root@zbx2dal0 ~]# /sys_apps_01/zabbix/bin/zabbix_get -s 10.149.1.2 -k system.run["sed -i 's/adam/adam,dave/g' /etc/group","wait"];
    ZBX_NOTSUPPORTED: Too many parameters.

    If I try to escape the "," character, it still gives me the same results:

    [root@zbx2dal0 ~]# /sys_apps_01/zabbix/bin/zabbix_get -s 10.149.1.2 -k system.run["sed -i 's/adam/adam\,dave/g' /etc/group","wait"];
    ZBX_NOTSUPPORTED: Too many parameters.

    Any idea how I can work around this, or am I missing something obvious in the above? It appears to me as though Zabbix is seeing the "," character and treating this as a parameter delimiter, as opposed to handling it an actual substitution string.

    Thanks in advance,
    M

    P.S. I should have included that I am running Zabbix server 2.4.2 and remote agents are all version 2.4.3
    Last edited by tiarnaigh; 09-03-2015, 14:10. Reason: Zabbix versions included
  • tiarnaigh
    Junior Member
    • Sep 2013
    • 27

    #2
    Nobody?! Surely this one has come up previously?

    Comment

    • gleepwurp
      Senior Member
      • Mar 2014
      • 119

      #3
      Hi,

      I never used remote commands before, but I gave it a go...

      This seems to work for me:

      zabbix_get -s 127.0.0.1 -k "system.run[\"sed -i 's/dave/adam,dave/g' /tmp/test.txt\",\"wait\"]"

      /tmp/test.txt before:
      Code:
      dave,bill
      /tmp/test.txt after:
      Code:
      adam,dave,bill
      so, wrap the entire "Key" in quotes, and escape the quotes internally.

      Gleepwurp.

      Comment

      • tiarnaigh
        Junior Member
        • Sep 2013
        • 27

        #4
        Genius gleepwurp, you're a life saver!! The remote agent call has now taken on even more value for me than before, as I thought this might be an annoying restriction I'd have to work with.

        The thought never occured to me that I could wrap the entire system call in double quotes, but as you rightly pointed out I can now do this as follows:

        [root@zbx2dal0 ~]# /sys_apps_01/zabbix/bin/zabbix_get -s 10.149.38.26 -k system.run["cat /root/test.txt","wait"];
        test:1000:adam

        [root@zbx2dal0 ~]# /sys_apps_01/zabbix/bin/zabbix_get -s 10.149.38.26 -k "system.run[\"sed -i 's/adam/adam,dave/g' /root/test.txt\",\"wait\"]";

        [root@zbx2dal0 ~]# /sys_apps_01/zabbix/bin/zabbix_get -s 10.149.38.26 -k system.run["cat /root/test.txt","wait"];
        test:1000:adam,dave



        Excellent call. You've made me a happy man,
        M

        Comment

        • gleepwurp
          Senior Member
          • Mar 2014
          • 119

          #5
          Happy I could help!

          Cheers!

          G.

          Comment

          Working...