nginx配置文件
1.状态界面
1.1 开启状态界面
[root@localhost ~]# vim /usr/local/nginx/conf/nginx.conf
location /status {
stub_status on;
allow 192.168.237.1/24;
deny all;
}
[root@localhost ~]# nginx -s stop;nginx
访问状态页面的方式:http://server_ip/status
状态页面信息详解:
状态码 | 表示的意义 |
---|---|
Active connections 2 | 当前所有处于打开状态的连接数 |
accepts | 总共处理了多少个连接 |
handled | 成功创建多少握手 |
requests | 总共处理了多少个请求 |
Reading | nginx读取到客户端的Header信息数,表示正处于接收请求状态的连接数 |
Writing | nginx返回给客户端的Header信息数,表示请求已经接收完成,且正处于处理请求或发送响应的过程中的连接数 |
Waiting | 开启keep-alive的情况下,这个值等于active - (reading + writing),意思就是Nginx已处理完正在等候下一次请求指令的驻留连接 |
1.2 状态界面监控
zabbix客户端安装
//关闭防火墙和selinux
//创建用户
[root@localhost ~]# useradd -r -M -s /sbin/nologin zabbix
//安装依赖包
[root@localhost ~]# yum -y install wget vim gcc gcc-c++ make pcre-devel openssl openssl-devel
//下载并解压zabbix
[root@localhost ~]# cd /usr/src/
[root@localhost src]# ls
debug kernels nginx-1.20.1 zabbix-5.4.4.tar.gz
[root@localhost src]# tar xf zabbix-5.4.4.tar.gz
[root@localhost src]# cd zabbix-5.4.4/
[root@localhost zabbix-5.4.4]# ls
aclocal.m4 ChangeLog config.sub database install-sh man README
AUTHORS compile configure depcomp m4 misc sass
bin conf configure.ac include Makefile.am missing src
build config.guess COPYING INSTALL Makefile.in NEWS ui
//编译安装
[root@localhost zabbix-5.4.4]# ./configure --enable-agent
......
***********************************************************
* Now run 'make install' *
* *
* Thank you for using Zabbix! *
* <http://www.zabbix.com> *
***********************************************************
[root@localhost zabbix-5.4.4]# make install
//修改配置文件
[root@localhost ~]# cd /usr/local/etc/
[root@localhost etc]# ls
zabbix_agentd.conf zabbix_agentd.conf.d
[root@localhost etc]# vim zabbix_agentd.conf
113 Server=192.168.237.168 //指定zabbix服务端IP
154 ServerActive=192.168.237.168 //指定zabbix服务端IP
165 Hostname=nginx //指定主机名,zabbix web界面添加主机时的需要填写的主机名
//开机自启
[root@localhost ~]# cp /usr/src/zabbix-5.4.4/misc/init.d/fedora/core/zabbix_agentd /etc/init.d/
[root@agent ~]# cat /usr/lib/systemd/system/zabbix_agentd.service
[Unit]
Description=zabbix server daemon
After=netwo