Advertisement
p2n

zabbix nginx_status

p2n
Nov 13th, 2013
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. HOST=`/bin/hostname`
  4. SERVER='zabbix.yourdomain.com'
  5. CURL=/usr/bin/curl
  6.  
  7. read -a stat <<< `$CURL -sm3 "http://${HOST}/nginx_status"`
  8.  
  9. [ ! -z $stat ] && {
  10.     echo "\
  11. ${HOST} nginx.active ${stat[2]}
  12. ${HOST} nginx.accepts ${stat[7]}
  13. ${HOST} nginx.handled ${stat[8]}
  14. ${HOST} nginx.requests ${stat[9]}
  15. ${HOST} nginx.reading ${stat[11]}
  16. ${HOST} nginx.writing ${stat[13]}
  17. ${HOST} nginx.waiting ${stat[15]}" |
  18.  
  19.     ~/zabbix/bin/zabbix_sender \
  20.     --zabbix-server ${SERVER} -s ${HOST} \
  21.     --port '10051' -i - >/dev/null 2>&1
  22. }
  23.  
  24. echo "1"
  25. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement