第一节:zabbix使用模板监控nginx

使用模板监控nginx

一、安装nginx并开启监控取值页面

1、安装nginx

[root@web01 ~]# yum install -y nginx

2、配置nginx状态页

[root@web01 ~]# vim /etc/nginx/nginx.conf
.....
include /etc/nginx/default.d/*.conf;
location / {
}
location /nginx_status {
stub_status;
}
error_page 404 /404.html;
location = /404.html {
}
...
[root@web01 ~]#

3、启动nginx并设置为开机自启

[root@web01 ~]# systemctl start nginx.service
[root@web01 ~]# systemctl enable nginx.service

4、查看nginx状态页

http://10.0.0.7/nginx_status

5、监控指标介绍

Active connections(活动连接数): 2
server accepts(接受的) handled(已处理) requests(接收到的请求)
2 2 2
Reading: 0 Writing: 1 Waiting: 1

二、命令行取值

1、命令行获取状态

[root@web01 ~]# curl http://127.0.0.1/nginx_status

2、取值

[root@web01 ~]# curl http://127.0.0.1/nginx_status 2>/dev/null|awk 'NR==1{print $NF}'
。。。

三、添加zabbix模板

1、导入nginx监控模板

联系管理员微信tutu19192010,注册账号

上一篇
下一篇
Copyright © 2022 Egon的技术星球 egonlin.com 版权所有 沪ICP备2022009235号 沪公网安备31011802005110号 青浦区尚茂路798弄 联系方式-13697081366