聚合图形
Monitoring(监控中)-->Screens(聚合图形)-->Create screen(创建聚合图形)即可创建聚合图形
创建的聚合图形(web2_host),点击后面的构造函数(constructor),点击Change(更改),设置每行每列需要显示的数据图表
自定义监控案例
监控Nginx服务状态
将源码包拷贝到web1家目录下
cd lnmp_soft/
ls
tar -xf nginx-1.12.2.tar.gz
cd nginx-1.12.2/
yum -y install gcc pcre-devel openssl-devel
./configure --with-http_stub_status_module
make && make install
[root@web1 nginx-1.12.2]# vim /usr/local/nginx/conf/nginx.conf 修改配置文件
location /status {
stub_status on;
} 42行添加
[root@web1 nginx-1.12.2]# /usr/local/nginx/sbin/nginx
[root@web1 nginx-1.12.2]# curl http://192.168.2.100/status 测试
Active connections: 1
server accepts handled requests
1 1 1
Reading: 0 Writing: 1 Waiting: 0
2)自定义监控key
编写自定义监控脚本
[root@web1 ~]# vim /usr/local/bin/nginx_status.sh
#!/bin/bash
case $1 in
active)
curl -s http://192.168.2.100/status | awk '/Active/{print $NF}';;
waiting)
curl -s http://192.168.2.100/status | awk '/Waiting/{print $NF}';;
accepts)
curl -s http://192.168.2.100/status | awk 'NR==3{print $2}';;
esac
[root@web1 ~]# chmod +x /usr/local/bin/nginx_status.sh
[root@web1 ~]# /usr/local/bin/nginx_status.sh waiting
'0
创建自定义key
[root@web1 ~]# vim /usr/local/etc/zabbix_agentd.conf.d/nginx.status
UserParameter=nginx.status[*],/usr/local/bin/nginx_status.sh $1
[root@web1 ~]# systemctl restart zabbix_agentd 重启服务
[root@web1 ~]# zabbix_get -s 127.0.0.1 -k 'nginx.status[accepts]' 测试
3