Ad Widget

Collapse

Problem awk with agent zabbix 1.8.3

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • colloque
    Member
    • Feb 2010
    • 72

    #1

    Problem awk with agent zabbix 1.8.3

    Hello,

    I've a problem with awk into system.run key (zabbix agent 1.8.3 hpux)

    the command is:

    export UNIX95=1;ps -eflx -o pcpu,args|grep -i [myprocess]|grep -v grep|awk '{print $$1}'

    The result is : not supported

    Do you have an idea ?

    thanks for your help.
  • richlv
    Senior Member
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Oct 2005
    • 3112

    #2
    and does it return something if you remove awk ? (use zabbix_get to test).

    are remote commands enabled in the agent ?

    did you try with single dollar sign in the awk expression ?
    Zabbix 3.0 Network Monitoring book

    Comment

    • colloque
      Member
      • Feb 2010
      • 72

      #3
      Thanks for your help.


      ./zabbix_get -s[ServeurAgentZabbix] -p10050 -ksystem.run[export UNIX95=1;ps -eflx -o pcpu,args|grep -i [MyPorcess]|grep -v grep|/usr/bin/awk '{print $$1}', wait]

      syntax error The source line is 1.
      The error context is
      {print >>> $$1}, <<<
      awk: Quitting
      The source line is 1.



      Zabbix_agentd.conf
      -----------------------------------
      ### Option: EnableRemoteCommands
      # Whether remote commands from Zabbix server are allowed.
      # 0 - not allowed
      # 1 - allowed
      #
      # Mandatory: no
      # Default:
      EnableRemoteCommands=1

      ### Option: LogRemoteCommands
      # Enable logging of executed shell commands as warnings
      # 0 - disabled
      # 1 - enabled
      #
      # Mandatory: no
      # Default:
      LogRemoteCommands=1
      --------------------------------------------

      Did you try with single dollar sign in the awk expression ?
      Yes it's the same thing.

      Information: With zabbix agent 1.4.4 hpux 11.23 it's correct with the syntax
      awk '{print $ 1}'

      Thanks.

      Comment

      • richlv
        Senior Member
        Zabbix Certified Trainer
        Zabbix Certified SpecialistZabbix Certified Professional
        • Oct 2005
        • 3112

        #4
        hmm, looking at your zabbix_get invocation, you are not doublequoting the key. it works just fine for me, so i'd suggest trying that first
        Zabbix 3.0 Network Monitoring book

        Comment

        • colloque
          Member
          • Feb 2010
          • 72

          #5
          Hello richlv

          Thanks for your help,

          It's ok with the next syntax:

          system.run["export UNIX95=1;ps -eflx -o pcpu,args|grep -i colisage.exe|grep -v grep|awk '{print $1}'", wait]

          Comment

          Working...