~]# 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

最新文章

  1. java静态修饰符static的使用
  2. Linux 用户添加sudo 权限
  3. 不care小米,梁军坦言微鲸才是乐视最大对手
  4. iOS开发之窥探UICollectionViewController(三) --使用UICollectionView自定义瀑布流
  5. openSUSE 11 上的配置可以Xmanager远程桌面
  6. Tkinter教程之Event篇(1)'
  7. Delphi word
  8. Android SlidingMenu开源库及其使用
  9. 《windows程序设计》学习_3.3:利用xp扫雷资源
  10. Ubuntu_16.04_Lamp
  11. 漫画研发之十二:该听谁的? 部门经理 or 项目经理
  12. [Uva10294]Arif in Dhaka
  13. SpringMVC实现返回不同视图
  14. VMware运行gazebo,关于vmw_ioctl_command error Invalid argument错误
  15. jenkins结合svn检测版本变化执行shell脚本实现项目部署
  16. 《数据仓库ETL工具箱》读书笔记
  17. js-变量定义关键字const,var,let
  18. Luffy之虚拟环境.项目搭建,目录日志等配置信息
  19. dede:arclist调用文章正文全部内容
  20. AWS 推出长期支持的 OpenJDK 免费分发版本 —— Amazon Corretto

热门文章

  1. js 双向绑定数据
  2. 高性能MySQL之基础架构
  3. 算法与数据结构基础 - 位运算(Bit Manipulation)
  4. SonarQube部署及代码质量扫描入门教程
  5. pythonday01计算机初步认识
  6. Spring boot中的 JsonConverter
  7. Redis之对象篇——Redis对象系统简介
  8. js全选与取消全选
  9. 使用Python的Django和layim实现即时通讯
  10. react antd 关于selectedRows 的问题