Ad Widget

Collapse

Problem with external checks

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Silvery
    Junior Member
    Zabbix Certified Specialist
    • Oct 2008
    • 28

    #1

    Problem with external checks

    Hello,

    I've a problem with my external scripts.
    When you look on the front-end they seem to work fine as they return the right values.

    But in the zabbix_server.log I found the following:
    Code:
    2292:20081105:023750 Script /etc/zabbix/externalscripts/check_printer_display.sh returned nothing.
    /etc/zabbix/externalscripts/check_printer_display.sh: line 9: echo: write error: Broken pipe
    2295:20081105:023751 Parameter [check_printer_display.sh[community]] is not supported by agent on host [canon] Old status [0]
    /etc/zabbix/externalscripts/check_printer_display.sh: line 9: echo: write error: Broken pipe
    2295:20081105:024751 Parameter [check_printer_display.sh[community]] became supported by agent on host [canon]
    The script check_printer_display.sh looks like:
    Code:
    #!/bin/bash
    
    HOSTNAME="$1"
    COMMUNITY="$2"
    
    OUT=`snmpwalk -c $COMMUNITY -v 1 $HOSTNAME 1.3.6.1.2.1.43.18.1.1.8 | awk -F "STRING: " '{ print $2 }'`
    
    if [ -z "$OUT" ]; then
            echo "OK"
            exit
    else
            echo "$OUT"
            exit
    fi
    That happens with all my scripts.
    What am I doing wrong?
  • Tenzer
    Senior Member
    • Nov 2007
    • 316

    #2
    Try setting the PATH environment variable in the script to the same value as when you are logged in. It's a typical error.

    The log output even states: "line 9: echo: write error: Broken pipe". Line 9 in the script is the first line where you use the $OUT variable, so either "snmpwalk" or "awk" are probably missing in the PATH used by the Zabbix user.

    Comment

    • Silvery
      Junior Member
      Zabbix Certified Specialist
      • Oct 2008
      • 28

      #3
      I've set the PATH variable but this didn't change anything.
      Beside, when the Zabbix-User is missing the PATH, why does the script work most of the time?

      The error "is not supported by agent on host" appears up to 5 times a day per host, while the update interval of the item is set to 30 sec.

      Comment

      • trikke
        Senior Member
        • Aug 2007
        • 140

        #4
        Hi,

        could it be that your script runs longer than the allowd time in your zabbix_agentd.conf ( Timeout= ) or zabbix_server.conf ( TrapperTimeout= an Timeout= ) in that case zabbix would "cut" the connection or just close the fork servicing your command?

        Greets
        Patrick

        Comment

        • Silvery
          Junior Member
          Zabbix Certified Specialist
          • Oct 2008
          • 28

          #5
          Thank you, that seems to be the solution!
          I've changed the value of Timeout from 5 to 10 and since then there are no error messages in my logfile.

          Comment

          Working...