1、搭建Zabbix Server(略过)
2、搭建zabbix agent(略过)
[root@backup ~]# ss -tunlp|grep 873
tcp LISTEN 0 5 :::873 :::* users:(("rsync",1271,5))
tcp LISTEN 0 5 *:873 *:* users:(("rsync",1271,3))
[root@backup ~]# ss -tunlp|grep 873|wc -l
2
[root@m01 ~]# zabbix_get -s 172.16.1.41 -p 10050 -k 'net.tcp.listen[873]'
1
[root@m01 ~]# zabbix_get -s 172.16.1.41 -p 10050 -k 'net.tcp.port[,873]'
1
[root@backup ~]# ps -ef|grep rsync
root 1271 1 0 20:10 ? 00:00:00 rsync --daemon
root 1411 1371 0 20:23 pts/1 00:00:00 grep rsync
[root@backup ~]# ps -ef|grep rsync|wc -l
2
[root@backup ~]# ps -ef|grep [r]sync|wc -l
1
[root@m01 zabbix_agentd.d]# zabbix_get -s 172.16.1.41 -p 10050 -k 'proc.num[,root,all,rsync]'
1
打开zabbix主机里的web检测
创建web场景
查看图形
[root@cache01 nginx]# vim nginx.conf
location /status {
stub_status on;
access_log off;
root html;
index index.html index.htm;
}
[root@cache01 nginx]# vim /etc/zabbix/zabbix_agentd.d/userparameter_nginx_status.conf
UserParameter=nginx_active,curl -s 127.0.0.1/status|awk '/Active/ {print $NF}'
UserParameter=nginx_accepts,curl -s 127.0.0.1/status|awk 'NR==3 {print $1}'
UserParameter=nginx_handled,curl -s 127.0.0.1/status|awk 'NR==3 {print $2}'
UserParameter=nginx_requests,curl -s 127.0.0.1/status|awk 'NR==3 {print $3}'
UserParameter=nginx_reading,curl -s 127.0.0.1/status|awk 'NR==4 {print $2}'
UserParameter=nginx_writing,curl -s 127.0.0.1/status|awk 'NR==4 {print $4}'
UserParameter=nginx_waiting,curl -s 127.0.0.1/status|awk 'NR==4 {print $6}'
先要刷新页面取得数据
http://10.0.0.21/status
原文:http://blog.51cto.com/13554498/2061669