yuanqiao 发表于 2018-11-10 07:31:52

zabbix 监控nginx状态:

# cat /usr/local/zabbix/scripts/nginx_status  
#!/bin/bash
  
# Script to fetch nginx statuses for tribily monitoring systems
  
# Author: xiaoluo
  
# License: GPLv2
  

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


页: [1]
查看完整版本: zabbix 监控nginx状态: