PDA

View Full Version : Problem with external checks


Silvery
05-11-2008, 08:38
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:
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:
#!/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
05-11-2008, 11:33
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.

Silvery
06-11-2008, 08:56
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.

trikke
06-11-2008, 17:02
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

Silvery
07-11-2008, 10:09
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. :)