Guest User

zabbix_nginx_stat

a guest
Nov 13th, 2013
109
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 -m 3 -s \""http://${HOST}/nginx_status"\"  | tr '\n' ' '`"
  8.  
  9. [ ! -z $stat ] && {
  10.     echo -e "\
  11. ${HOST} nginx.active ${stat[2]}\n\
  12. ${HOST} nginx.accepts ${stat[7]}\n\
  13. ${HOST} nginx.handled ${stat[8]}\n\
  14. ${HOST} nginx.requests ${stat[9]}\n\
  15. ${HOST} nginx.reading ${stat[11]}\n\
  16. ${HOST} nginx.writing ${stat[13]}\n
  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
RAW Paste Data