殇帝刘玢你 发表于 2018-11-9 10:25:45

Zabbix 监控Nginx连接的状态

#!/bin/bash  
HOST="10.0.0.10"
  
PORT="80"
  
function active {
  
/usr/bin/curl "http://$HOST:$PORT/nginx_status/" 2>/dev/null| grep 'Active' | awk '{print $NF}'
  
}
  
function reading {
  
/usr/bin/curl "http://$HOST:$PORT/nginx_status/" 2>/dev/null| grep 'Reading' | awk '{print $2}'
  
       }
  
function writing {
  
/usr/bin/curl "http://$HOST:$PORT/nginx_status/" 2>/dev/null| grep 'Writing' | awk '{print $4}'
  
       }
  
function waiting {
  
/usr/bin/curl "http://$HOST:$PORT/nginx_status/" 2>/dev/null| grep 'Waiting' | awk '{print $6}'
  
       }
  
function accepts {
  
/usr/bin/curl "http://$HOST:$PORT/nginx_status/" 2>/dev/null| awk NR==3 | awk '{print $1}'
  
       }
  
function handled {
  
/usr/bin/curl "http://$HOST:$PORT/nginx_status/" 2>/dev/null| awk NR==3 | awk '{print $2}'
  
       }
  
function requests {
  
/usr/bin/curl "http://$HOST:$PORT/nginx_status/" 2>/dev/null| awk NR==3 | awk '{print $3}'
  
       }
  
# Run the requested function
  
$1


页: [1]
查看完整版本: Zabbix 监控Nginx连接的状态