通过 Zabbix 服务,监控 Nginx Status (详细示例)
1、组网拓扑
2、准备工作,可查看此链接,此文不做累述
Zabbix Server 和 Zabbix Agent 的详细安装过程(附带监控主机和监控参数的详细设置)
3、Zabbix Agent 安装 Nginx,并修改配置文件,并启动 Nginx
[root@Tang-1 ~]# yum install nginx -y
[root@Tang-1 ~]# vim /etc/nginx/nginx.conf
http {
server {
listen 80;
server_name localhost;
location /ngxstatus {
stub_status;
}
}
}
[root@Tang-1 ~]# systemctl start nginx.service
[root@Tang-1 ~]# systemctl status nginx.service
● nginx.service - The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
Active: active (running) since Tue 2019-10-29 18:59:26 CST; 19h ago
Process: 16262 ExecStart=/usr/sbin/nginx (code=exited, status=0/SUCCESS)
Process: 16257 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
Process: 16254 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)
Main PID: 16263 (nginx)
CGroup: /system.slice/nginx.service
├─16263 nginx: master process /usr/sbin/nginx
└─16264 nginx: worker process
Oct 29 18:59:26 Tang-1 systemd[1]: Starting The nginx HTTP and reverse proxy server...
Oct 29 18:59:26 Tang-1 nginx[16257]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
Oct 29 18:59:26 Tang-1 nginx[16257]: nginx: configuration file /etc/nginx/nginx.conf test is successful
Oct 29 18:59:26 Tang-1 systemd