zabbix监控nginx脚本
~]# cd /etc/zabbix/scripts/
scripts]# ls
nginx_status.sh
scripts]# cat nginx_status.sh
############################################
#$name: nginx_status.sh
#author: daizhe
#Create Date: 2019-02-13
############################################
NGINX_PORT=80 #端口根据nginx的端口进行修改
NGINX_COMMAND=$1
nginx_active(){
/usr/bin/curl -s "http://127.0.0.1:"$NGINX_PORT"/status/" |awk '/Active/ {print $NF}' #/status/路径根据 nginx配置文件定义状态页面的路径进行修改
}
nginx_reading(){
/usr/bin/curl -s "http://127.0.0.1:"$NGINX_PORT"/status/" |awk '/Reading/ {print $2}'
}
nginx_writing(){
/usr/bin/curl -s "http://127.0.0.1:"$NGINX_PORT"/status/" |awk '/Writing/ {print $4}'
}
nginx_waiting(){
/usr/bin/curl -s "http://127.0.0.1:"$NGINX_PORT"/status/" |awk '/Waiting/ {print $6}'
}
nginx_accepts(){
/usr/bin/curl -s "http://127.0.0.1:"$NGINX_PORT"/status/" |awk 'NR==3 {print $1}'
}
nginx_handled(){
/usr/bin/curl -s "http://127.0.0.1:"$NGINX_PORT"/status/" |awk 'NR==3 {print $2}'
}
nginx_requests(){
/usr/bin/curl -s "http://127.0.0.1:"$NGINX_PORT"/status/" |awk 'NR==3 {print $3}'
}
case $NGINX_COMMAND in
active)
nginx_active;
;;
reading)
nginx_reading;
;;
writing)
nginx_writing;
;;
waiting)
nginx_waiting;
;;
accepts)
nginx_accepts;
;;
handled)
nginx_handled;
;;
requests)
nginx_requests;
;;
*)
echo $"USAGE:$0 {active|reading|writing|waiting|accepts|handled|requests}"
esac
最新文章
- java静态修饰符static的使用
- Linux 用户添加sudo 权限
- 不care小米,梁军坦言微鲸才是乐视最大对手
- iOS开发之窥探UICollectionViewController(三) --使用UICollectionView自定义瀑布流
- openSUSE 11 上的配置可以Xmanager远程桌面
- Tkinter教程之Event篇(1)'
- Delphi word
- Android SlidingMenu开源库及其使用
- 《windows程序设计》学习_3.3:利用xp扫雷资源
- Ubuntu_16.04_Lamp
- 漫画研发之十二:该听谁的? 部门经理 or 项目经理
- [Uva10294]Arif in Dhaka
- SpringMVC实现返回不同视图
- VMware运行gazebo,关于vmw_ioctl_command error Invalid argument错误
- jenkins结合svn检测版本变化执行shell脚本实现项目部署
- 《数据仓库ETL工具箱》读书笔记
- js-变量定义关键字const,var,let
- Luffy之虚拟环境.项目搭建,目录日志等配置信息
- dede:arclist调用文章正文全部内容
- AWS 推出长期支持的 OpenJDK 免费分发版本 —— Amazon Corretto