Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- URL='http://localhost/nginx_status'
- TMP='/tmp/nginx-ping.tmp'
- ZABBIX_SENDER='/usr/bin/env zabbix_sender'
- CONFIG='/etc/zabbix/zabbix_agentd.conf'
- #
- #Active connections: 94
- #server accepts handled requests
- # 653963 653963 1747934
- #Reading: 0 Writing: 19 Waiting: 75
- (/usr/bin/env time -f %e /usr/bin/env wget --no-http-keep-alive --quiet --timeout 9 -O - $URL) 2>$TMP | \
- awk '/Active connections/ {active=int($NF)}
- / ([0-9]+) ([0-9]+) ([0-9]+)/ {accepts=int($1); handled=int($2); requests=int($3)}
- /Reading:/ {reading=int($2); writing=int($4); waiting=int($6)}
- END {
- print "- nginx.connections.active", active;
- print "- nginx.connections.reading", reading;
- print "- nginx.connections.writing", writing;
- print "- nginx.connections.waiting", waiting;
- print "- nginx.accepts", accepts;
- print "- nginx.handled", handled;
- print "- nginx.requests", requests;
- }' | $ZABBIX_SENDER \
- --config $CONFIG \
- --input-file - >/dev/null 2>&1
- cat $TMP
- [ -f $TMP ] && rm $TMP
- exit 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement