nginx状态监控

nginx状态监控

通过查看Nginx的并发连接,我们可以更清除的知道网站的负载情况。Nginx并发查看有两种方法(之所以这么说,是因为笔者只知道两种),一种是通过web界面,一种是通过命令,web查看要比命令查看显示的结果精确一些。下面介绍这两种查看方法

No1、通过浏览器查看
通过web界面查看时Nginx需要开启status模块,也就是安装Nginx时加上        –with-http_stub_status_module   然后配置Nginx.conf,在server点里面加入如下内容

location /nginx_status {
stub_status on;
access_log off;
allow 192.168.1.100;  访问IP
deny all;
}

配置完后重新启动Nginx后我们可以通过浏览器访问http://localhost/status 查看,如下图

解析:
Active connections    //当前 Nginx 正处理的活动连接数。
server accepts handledrequests //总共处理了8 个连接 , 成功创建 8 次握手,总共处理了500个请求。
Reading //nginx 读取到客户端的 Header 信息数。
Writing //nginx 返回给客户端的 Header 信息数。
Waiting //开启 keep-alive 的情况下,这个值等于 active – (reading + writing),意思就是 Nginx 已经处理完正在等候下一次请求指令的驻留连接
No2、通过命令查看
#netstat -n | awk ‘/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}‘

TIME_WAIT 17
ESTABLISHED 3254
LAST_ACK 236
FIN_WAIT_1 648
FIN_WAIT_2 581
CLOSING 7
CLOSE_WAIT 4916

解析:
CLOSED  //无连接是活动的或正在进行
LISTEN  //服务器在等待进入呼叫
SYN_RECV  //一个连接请求已经到达,等待确认
SYN_SENT  //应用已经开始,打开一个连接
ESTABLISHED  //正常数据传输状态/当前并发连接数
FIN_WAIT1  //应用说它已经完成
FIN_WAIT2  //另一边已同意释放
ITMED_WAIT  //等待所有分组死掉
CLOSING  //两边同时尝试关闭
TIME_WAIT  //另一边已初始化一个释放
LAST_ACK  //等待所有分组死掉

时间: 2024-08-04 18:51:41

nginx状态监控的相关文章

zabbix监控之nginx状态监控(一)

[本文档所介绍的内容适用于公司测试/生产环境等常见的zabbix监控应用部署] 一:相关环境准备: 1.1相关软件以及系统 系统要求:Centos 6及以上(64位) 环境要求:zabbix监控系统(服务端,客户端) 相关中间件:nginx (版本1.6.0及以上) 二:配置zabbix监控nginx 2.1修改nginx配置文件,在server区块添加nginxs状态监控配置,如下所示 location ^~ /ngx_status {                 stub_status

开启php-fpm和nginx状态监控

工作中需要监控php-fpm和nginx状态,从网上找了些资料,整理如下 开启php-fpm 修改php-fpm.conf文件配置 去掉该项前分号 在nginx.conf 里插入以下配置 location ~ ^/(status|ping)$ { include fastcgi_params; fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME $fastcgi_script_name; 重启php-fpm和nginx 访问页面

启用Nginx状态监控

1. 编译Nginx添加http_stub_status_module 编译Nginx的时候添加参数:--with-http_stub_status_module cd nginx-{version}/ ./configure --prefix=/opt/nginx --with-http_stub_status_module --with-http_ssl_module make && make install 2. 启用nginx status配置 修改Nginx配置文件nginx.c

开启nginx状态监控

1.nginx的ngx_http_stub_status_module提供能够获取Nginx自上次启动以来的工作状态 的功能. www.ahlinux.com 如果是编译安装的话,需要–with-http_stub_status_module激活 2.该模块是基于某个server的,所以必须在server里面 3.nginx.conf配置 01 server 02 { 03 listen       80; 04 server_name  blog.xfz.com; 05 index index

keepalived 非抢占模式 以及nginx状态监控

global_defs {    notification_email {      [email protected]      [email protected]      [email protected]    }    notification_email_from [email protected]    smtp_server 192.168.200.1    smtp_connect_timeout 30    router_id f6    vrrp_mcast_group4 

Zabbix 监控 Nginx 状态

1.获取 Nginx 状态条件( 需要nginx安装模块) [localhost]#/usr/local/nginx/sbin/nginx -V nginx version: nginx/1.8.0built by gcc 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC) configure arguments: --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_gzip_sta

zabbix监控nginx状态

一.zabbix客户端配置 首先修改一下zabbix客户端的配置,习惯上将zabbix的配置文件拷贝到自建的/etc/zabbix/目录,方便管理: [[email protected] ~]# sed -e '/^$/d;/^#/d'  /etc/zabbix/zabbix_agentd.conf PidFile=/tmp/zabbix_agentd.pid LogFile=/tmp/zabbix_agentd.log Server=192.168.199.79 ServerActive=12

Zabbix之监控Nginx状态信息

Zabbix 之监控Nginx状态信息 nginx需要支持 http_stub_status_module 编译的时候需要使用--with-http_stub_status_module yum默认支持此选项 1. 配置nginx stuats 源码: vim nginx.conf yum: vim /etc/nginx/conf.d/default.conf #and add the following to your server block location /nginx_status {

Zabbix快速部署及自定义Item监控Nginx状态原理

监控软件的选择 1)Nagios 优点:监控协议多.完善的告警机制.服务抖动检测 缺点:只能在终端配置.基于文件的配置方式.不方便扩展.易读性差.管理耗时 2)Cacti 优点:多样的图形化数据.历史数据存储.趋势对比 缺点:报警机制不完善.只支持集中式数据监控 3)Zabbix 优点:集合了Nagios和Cacti大部分优点,功能强大:特别是在针对集群机器较多.业务环境复杂和跨机房监控方面有优势(proxy收集功能) 缺点:部署稍微复杂,不支持服务抖动检测等... Zabbix特点 · 多种数