Ad Widget

Collapse

System.run key shows too many parameter

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • iftitutul
    Member
    • Sep 2017
    • 51

    #1

    System.run key shows too many parameter

    In zabbix, Already enabled remote command. but item shows with error.
    item key: system.run[ps -eo pid,ppid,user,cmd,%mem,%cpu --sort=-%cpu | head -n 6]
    TypeZabbix Agent)
    It shows not supported with message- Too many parameters.
    how can solve it?
    Last edited by iftitutul; 14-11-2017, 20:51.
  • Pitons
    Member
    • Oct 2017
    • 49

    #2
    Hi,
    Which version of zabbix are you using?
    Note that if you are monitoring host over proxy remote commands are supported only on 3.4.x

    and try to put you command in quotes:
    system.run["ps -eo pid,ppid,user,cmd,%mem,%cpu --sort=-%cpu | head -n 6"]
    Last edited by Pitons; 14-11-2017, 21:01.

    Comment

    • iftitutul
      Member
      • Sep 2017
      • 51

      #3
      Zabbix verison-3.4.
      Thanks. it's working

      Comment

      • Pitons
        Member
        • Oct 2017
        • 49

        #4
        Good to hear!

        If your command has commas always use quotes
        as zabbix also interprets comma and expects other parameters.

        Comment

        • iftitutul
          Member
          • Sep 2017
          • 51

          #5
          Thanks Pitons.
          But how can this item added in action? Because when mail sending it can also shows item result
          Last edited by iftitutul; 14-11-2017, 21:57.

          Comment

          • Pitons
            Member
            • Oct 2017
            • 49

            #6
            Originally posted by iftitutul
            Thanks Pitons.
            But how can this item added in action? Because when mail sending it can also shows item result
            Do you mean trigger some action on some values and then send result by mail?

            Please explain scenario what do you want to achieve?

            Comment

            • iftitutul
              Member
              • Sep 2017
              • 51

              #7
              I don't send any trigger of this item: system.run["ps -eo pid,ppid,user,cmd,%mem,%cpu --sort=-%cpu | head -n 6"].

              "Do you mean trigger some action on some values and then send result by mail?"
              -Yes. Any template: os linux related it shows the item values for this item:system.run["ps -eo pid,ppid,user,cmd,%mem,%cpu --sort=-%cpu | head -n 6"].
              I think you got my point.

              so is it ok if I add the below item in action mail?
              host:system.run["ps -eo pid,ppid,user,cmd,%mem,%cpu --sort=-%cpu | head -n 6"].

              Comment

              • Pitons
                Member
                • Oct 2017
                • 49

                #8
                Yes, sure you can do that, but in basis this is wrong.
                use: {host:system.run["ps -eo pid,ppid,user,cmd,%mem,%cpu --sort=-%cpu | head -n 6"].last()}

                Why it's wrong:
                1. Use zabbix agent to collect metrics try to avoid using remote commands, it's a security risk and you are populating database with unnecessary information and load.
                More about it :
                2. Create items to monitor specific processes and corresponding triggers for them, so you get specific alerts and you know exactly where the problem is.
                3. Go further - create remote commands, for example: to restart the service if its memory/cpu usage too high.
                4. Avoid spamming yourself and others with unneeded info.

                But that's just my thoughts you are free to do whatever you wan't.

                Comment

                • iftitutul
                  Member
                  • Sep 2017
                  • 51

                  #9
                  Thanks for your nice info.
                  "3. Go further - create remote commands, for example: to restart the service if its memory/cpu usage too high." - is remote command executed, is it possible to show zabbix side [mail/history].

                  Suppose, memory/cpu usage too high it will excuted command 'system.run["ps -eo pid,ppid,user,cmd,%mem,%cpu --sort=-%cpu | head -n 6"]'.
                  so what is the output of this result? How can enlisted this result into mail ?

                  Comment

                  Working...