一、http
为server2中的httpd服务添加监控项
yum install -y httpd
systemctl start httpd
配置——主机——点击server2——模板——添加(Template App HTTP Service)
二、nginx
为server3中的nginx添加监控项
(一)server3中配置nginx
1. 下载nginx,gcc,pcre-devel ,zlib-devel
tar zxf nginx-1.15.8.tar.gz
yum install -y gcc pcre-devel zlib-devel
2. 关闭debug,进行编译和安装
cd nginx-1.15.8/
vim auto/cc/gcc
#CFLAGS="$CFLAGS -g"
./configure --prefix=/usr/local/nginx --with-http_stub_status_module
make && make install
3. 为nginx制作软链接并开启nginx
cd /usr/local/nginx
ln -s /usr/local/nginx/sbin/nginx /usr/sbin
nginx -t #校验
nginx #开启
4. 修改配置文件,只允许本机查看nginx
cd /usr/local/nginx
vim conf/nginx
location /status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}
nginx -s reload
curl 127.0.0.1/status
curl http://localhost/status