【zabbix 监控】第二章 安装测试被监控主机

客户端安装测试

一、准备两台被监控主机,分别做如下操作:

web129:192.168.19.129

web130:192.168.19.130

[root@web129 ~]#yum -y install zabbix-agent
[root@web129 ~]# vim /etc/zabbix/zabbix_agentd.conf
Server=192.168.19.128                被动模式 zabbix-server-ip
ServerActive=192.168.19.128        主动模式  zabbix-server-ip
Hostname=web129          
[root@web129 ~]# systemctl start zabbix-agent
[root@web129 ~]# systemctl enable zabbix-agent  
[root@web129 ~]# ss -anlp |grep :10050
tcp    LISTEN     0      128       *:10050                 *:*                   users:(("zabbix_agentd",pid=8430,fd=4),("zabbix_agentd",pid=8429,fd=4),("zabbix_agentd",pid=8428,fd=4),("zabbix_agentd",pid=8427,fd=4),("zabbix_agentd",pid=8426,fd=4),("zabbix_agentd",pid=8425,fd=4))
tcp    LISTEN     0      128      :::10050                :::*                   users:(("zabbix_agentd",pid=8430,fd=5),("zabbix_agentd",pid=8429,fd=5),("zabbix_agentd",pid=8428,fd=5),("zabbix_agentd",pid=8427,fd=5),("zabbix_agentd",pid=8426,fd=5),("zabbix_agentd",pid=8425,fd=5))
[root@web129 ~]#  firewall-cmd --permanent --add-port=10050/tcp
[root@web129 ~]#  firewall-cmd --permanent --add-service=http
[root@web129 ~]#  firewall-cmd --permanent --add-service=https
[root@web129 ~]# firewall-cmd --reload 

二、在服务端上进行测试

server128:192.168.19.130

[root@server128 ~]# zabbix_get -s 192.168.19.130 -k system.uname
Linux web130 3.10.0-514.el7.x86_64 #1 SMP Tue Nov 22 16:42:41 UTC 2016 x86_64
[root@server128 ~]# zabbix_get -s 192.168.19.129 -k system.uname
Linux web129 3.10.0-514.el7.x86_64 #1 SMP Tue Nov 22 16:42:41 UTC 2016 x86_64
[root@server128 ~]# zabbix_get -s 192.168.19.129 -k system.cpu.load[all,avg15]
0.390000
[root@server128 ~]# zabbix_get -s 192.168.19.130 -k system.cpu.load[all,avg15]
0.050000
[root@server128 ~]# zabbix_get -s 192.168.19.129 -k net.tcp.service[http]
1
[root@server128 ~]# zabbix_get -s 192.168.19.130 -k net.tcp.service[http]
0
web130上返回为0,可能原因web130上未安装http服务,或者没有关闭selinux,
我的web130上是因为未安装http服务,安装后再次测试:
[root@server128 ~]# zabbix_get -s 192.168.19.130 -k net.tcp.service[http] 1 [root@server128 ~]#

 

posted @ 2018-08-15 13:35  旅行者-Ylt  阅读(368)  评论(0编辑  收藏  举报