Ad Widget

Collapse

External Scripts

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

    #1

    External Scripts

    I've got a problem with my external scripts.
    Most of the time they're working very well, but sometimes I find those messages in my zabbix_server.log:

    Item [Host:check_fan.sh[]] error: Script /etc/zabbix/externalscripts/check_fan.sh returned nothing.
    8711:20100204:083254 Parameter [check_fan.sh[]] is not supported by agent on host [Host] Old status [0]
    Parameter [check_fan.sh[]] became supported by agent on host [Host]

    Is there something wrong with my script or what's the meaning of this?

    check_fan.sh:
    Code:
    #!/bin/bash
    
    HOSTNAME="$1"
    COMMUNITY="$2"
    OK=1
    FAILURE=""
    
    for i in `seq 1 10` ; do
            OUT=`snmpwalk -c $COMMUNITY -v 1 $HOSTNAME .1.3.6.1.4.1.x.x.x.x.x.3.$i | awk '{ print $4 }'`
    
    # Status:
    # 1 = Failure
    # 2 = OK
    # 3 = Unknown
    
    if [ ! -z $OUT ]; then
            if [ $OUT -eq 1 ]; then
                    FAILURE=$FAILURE"CRITICAL - Fan $i failed "
                    OK=0
            fi
            if [ $OUT -eq 3 ]; then
                    FAILURE=$FAILURE"Status of fan $i unknown "
                    OK=0
            fi
    fi
    
    done
    
    if [ $OK -eq 1 ]; then
            echo "OK"
            exit
    fi
    
    echo "$FAILURE"
    exit
    Last edited by Silvery; 05-02-2010, 07:27.
  • alj
    Senior Member
    • Aug 2006
    • 188

    #2
    I believe zabbix agent has default timeout 5 sec or so, since your script launches snmpwalk 10 times it probably runs longer than 5 sec in some cases which triggers timeout.

    Your solution would be to run script from cron and deliver result to trapper via zabbix_sender.

    Comment

    Working...