步骤一:监控Nginx服务状态
1)准备环境,部署nginx软件
安装nginx软件,开启status模块
[root@zabbixclient_web1 nginx-1.12.2]# ./configure \
–with-http_stub_status_module
[root@zabbixclient_web1 nginx-1.12.2]# make && make install
[root@zabbixclient_web1 ~]# cat /usr/local/nginx/conf/nginx.conf
… …
location /status {
stub_status on;
}
… …
[root@zabbixclient_web1 ~]# curl http://192.168.2.100/status
Active connections: 1
server accepts handled requests
10 10 3
Reading: 0 Writing: 1 Waiting: 0
2)自定义监控key
语法格式:
UserParameter=key,command
UserParameter=key[*],
key里的所有参数,都会传递给后面命令的位置变量
如:
UserParameter=ping[*],echo $1
ping[0], 返回的结果都是0
ping[aaa], 返回的结果都是aaa
注意:被监控端修改配置文件,注意要允许自定义key并设