I have a problem with a couple external scripts I'm trying to use to gather metrics from nginx status page. Script looks like this:
Runs fine in shell:
Key (external script):
Yet I still get unsupported "timeout while executing a shell script" from zabbix. I've tried wget, curl, I've rewritten this in PHP, but zabbix will have nothing to do with it.
Any ideas?
Code:
#!/bin/sh
# Set Variables
runfunc=$1
hostIP=$2
port="80"
ftch="curl -s "
#ftch="wget -O- -q "
# Functions to return nginx stats
function active {
$ftch "http://$hostIP:$port/nginx_status" | grep 'Active' | awk '{print $NF}'
}
function reading {
$ftch "http://$hostIP:$port/nginx_status" | grep 'Reading' | awk '{print $2}'
}
function writing {
$ftch "http://$hostIP:$port/nginx_status" | grep 'Writing' | awk '{print $4}'
}
function waiting {
$ftch "http://$hostIP:$port/nginx_status" | grep 'Waiting' | awk '{print $6}'
}
function accepts {
$ftch "http://$hostIP:$port/nginx_status" | awk NR==3 | awk '{print $1}'
}
function handled {
$ftch "http://$hostIP:$port/nginx_status" | awk NR==3 | awk '{print $2}'
}
function requests {
$ftch "http://$hostIP:$port/nginx_status" | awk NR==3 | awk '{print $3}'
}
# Run the requested function
$runfunc
Code:
[zabbix@dev scripts]# time ./nginx_status.sh accepts dev02.local 457 real 0m0.018s user 0m0.000s sys 0m0.000s
Code:
nginx_status.sh["active","{HOST.HOST1}"]
Any ideas?
).
Comment