mirror of
https://github.com/aljazceru/zabbix.git
synced 2025-12-17 13:24:25 +01:00
Zabbix nginx monitor
This commit is contained in:
68
nginx/nginx.sh
Normal file
68
nginx/nginx.sh
Normal file
@@ -0,0 +1,68 @@
|
||||
#!/bin/bash
|
||||
##################################################
|
||||
# AUTHOR: Neo <netkiller@msn.com>
|
||||
# WEBSITE: http://www.netkiller.cn
|
||||
# Description<6F><6E>zabbix ͨ<><CDA8> status ģ<><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD> nginx
|
||||
# Note<74><65>Zabbix 3.2
|
||||
# DateTime: 2016-11-22
|
||||
##################################################
|
||||
|
||||
HOST="localhost"
|
||||
PORT="80"
|
||||
|
||||
function check {
|
||||
/sbin/pidof nginx | wc -l
|
||||
}
|
||||
|
||||
function active() {
|
||||
/usr/bin/curl -s "http://$HOST:$PORT/status/" 2>/dev/null| grep 'Active' | awk '{print $NF}'
|
||||
}
|
||||
function accepts() {
|
||||
/usr/bin/curl -s "http://$HOST:$PORT/status/" 2>/dev/null| awk NR==3 | awk '{print $1}'
|
||||
}
|
||||
function handled() {
|
||||
/usr/bin/curl -s "http://$HOST:$PORT/status/" 2>/dev/null| awk NR==3 | awk '{print $2}'
|
||||
}
|
||||
function requests() {
|
||||
/usr/bin/curl -s "http://$HOST:$PORT/status/" 2>/dev/null| awk NR==3 | awk '{print $3}'
|
||||
}
|
||||
function reading() {
|
||||
/usr/bin/curl -s "http://$HOST:$PORT/status/" 2>/dev/null| grep 'Reading' | awk '{print $2}'
|
||||
}
|
||||
function writing() {
|
||||
/usr/bin/curl -s "http://$HOST:$PORT/status/" 2>/dev/null| grep 'Writing' | awk '{print $4}'
|
||||
}
|
||||
function waiting() {
|
||||
/usr/bin/curl -s "http://$HOST:$PORT/status/" 2>/dev/null| grep 'Waiting' | awk '{print $6}'
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
check)
|
||||
check
|
||||
;;
|
||||
active)
|
||||
active
|
||||
;;
|
||||
accepts)
|
||||
accepts
|
||||
;;
|
||||
handled)
|
||||
handled
|
||||
;;
|
||||
requests)
|
||||
requests
|
||||
;;
|
||||
reading)
|
||||
reading
|
||||
;;
|
||||
writing)
|
||||
writing
|
||||
;;
|
||||
waiting)
|
||||
waiting
|
||||
;;
|
||||
|
||||
*)
|
||||
echo $"Usage $0 {check|active|accepts|handled|requests|reading|writing|waiting}"
|
||||
exit
|
||||
esac
|
||||
Reference in New Issue
Block a user