nginx—status的使用

开启状态界面(状态页面配置)

开启status:

location /status {
  stub_status {on | off};
  allow 172.16.0.0/16;
  deny all;
}

访问状态页面的方式:http://server_ip/status

状态码 表示的意义
Active connections 2 当前所有处于打开状态的连接数
accepts 总共处理了多少个连接
handled 成功创建多少握手
requests 总共处理了多少个请求
Reading nginx 读取到客户端的Header信息数,表示正处于接收请求状态的连接数
Writing nginx 返回给客户端的Header信息数,表示请求已经接收完成,且正处于处理请求或发送响应的过程中的连接数
Waiting 开启keep-alive的情况下,这个值等于active - (reading + writing),意思就是Nginx已处理完正在等候下一次请求指令的驻留连接

实例

[root@localhost conf]# vim nginx.conf

        #access_log  logs/host.access.log  main;

        location / {
   
            root   html;
            index  index.html;
        }

        location /status {
   
            stub_status;
        }
[root@localhost conf]# nginx

#看见以下界面代表成功了在这里插入图片描述

通过过滤的方式进行监控status
[root@localhost conf]# curl http:/192.168.230.132/status
Active connections: 1 
server accepts handled requests
 3 3 3 
Reading: 0 Writing: 1 Waiting: 0 
[root@localhost conf]# curl -s http:/192.168.230.132/status |awk 'NR==4'
Reading: 0 Writing: 1 Waiting: 0 
[root@localhost conf]# curl -s http:/192.168.230.132/status |awk 'NR==4{print $2}'
0

使用zabbix监控status
#先在从安装下zabbix
[root@localhost src]# cd /usr/local/
[root@localhost local]# tar xf zabbix-5.4.4.tar.gz 
[root@localhost local]# cd zabbix-5.4.4
[root@localhost zabbix-5.4.4]# useradd -r -M -s /sbin/nologin zabbix
[root@localhost zabbix-5.4.4]# yum -y install vim wget gcc gcc-c++ make pcre-devel openssl openssl-devel
[root@localhost zabbix-5.4.4]# ./configure --enable-agent
  LDAP support:          no
  IPv6 support:          no

***********************************************************
*            Now run 
  • 1
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值