实验在添加server2被监控主机的基础上进行
安装zabbix监控、三种方式添加监控主机
- 监控nginx
安装nginx
下载:52bp
cd
tar zxf nginx-1.15.8.tar.gz
yum install gcc make pcre-devel zlib-devel -y
cd nginx-1.15.8
vim auto/cc/gcc
172注释# debug
# CFLAGS="$CFLAGS -g"./configure --prefix=/usr/local/nginx --with-http_stub_status_module
make && make install
vim /usr/local/nginx/conf/nginx.conf
47行后添加location /status {
stub_status on;access_log off;allow 127.0.0.1;deny all;}/usr/local/nginx/sbin/nginx
curl -s http://127.0.0.1/status | grep Active | awk '{print $3}'
编辑文件
vim userparameter_nginx.confUserParameter=nginx.active,curl -s http://127.0.0.1/status | grep Active | awk '{print $3}'
UserParameter=