Zabbix搭建笔记[2]--Zabbix Agent(Client)的安装配置

来源:互联网 发布:大专女生知乎 编辑:程序博客网 时间:2024/06/09 15:49


前面我们已经搭建好了Zabbix Server,根据前面的拓扑,我们要继续搭建3Client用于监控。

 

首先我们在CentOS 7.3上面进行Client的搭建,仍然使用下面的命令安装Zabbix官方源:

[CentOS7.3] #rpm -ivhhttp://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm --replacefiles

接着使用yum安装agent

[CentOS7.3] #yum install -y zabbix zabbix-agent

 

测试环境里我们还是不开启防火墙,如果是生产环境,可以开启防火墙并添加10050的入站放行规则和10051的出站放行规则。

 

配置/etc/zabbix/zabbix_agentd.conf

[CentOS 7.3] # egrep -v "(^#|^$)" /etc/zabbix/zabbix_agentd.conf

PidFile=/var/run/zabbix/zabbix_agentd.pid

LogFile=/var/log/zabbix/zabbix_agentd.log

LogFileSize=0

Server=172.16.0.9

ServerActive=172.16.0.9:10051

Hostname=CentOS73

Include=/etc/zabbix/zabbix_agentd.d/

其中ServerServerActive两个配置项分别对应agent的两种被动和主动这两种工作模式。

 

关闭selinux

[CentOS 7.3] #setenforce 0

[CentOS7.3] # vim /etc/selinux/config

SELINUX=disabled

 

设置开机启动并启动agent

[CentOS7.3] # systemctl enable zabbix-agent

[CentOS7.3] # systemctl start zabbix-agent

 

接着我们在CentOs 6.9上面也进行agent的安装,安装过程与CentOS 7.3类似,rpm源的URL修改成下面的:

http://repo.zabbix.com/zabbix/3.2/rhel/6/x86_64/zabbix-release-3.2-1.el6.noarch.rpm

 

配置文件的修改类似,修改完成后,关闭selinux,设置服务启动:

[CentOS6.9] # service zabbix-agent start

[CentOS6.9] # chkconfig zabbix-agent on

 

最后我们在WindowsServer 2012 R2中安装agent

3.2版本的agent下载地址:https://www.zabbix.com/download

https. '//www.zabblx.... Package Zabbix 32 p e Down load Zabbix pre-compiled agents 3.20 Freeaso 4.2 Freeaso 6.2 Freeaso T 1 Freeaso T 1 Freeaso 8.2 HR-UX 11.31 Linux 2.4.x Linux 2.6 Linux 2.6 Linux 2 6 23 Linux 2 6 23 Netaso 5.0 openBSD 38 openBSD 38 openBSD 4 3 openBSD 4 3 openBSD 47 openBSD 4 7 openBSD 5 4 openBSD 54 openBSD 5 6 openBSD 5 6 Solaris 10 Solaris 10 Windows (All) Hardware i386 i386 amd64 i386 i386 i386 amd64 i386 amd64 i386 i386 amd64 i386 amd64 i386 amd64 i386 amd64 i386 amd64 i386 amd64 sparc i386,amd64 lcd1cd8ebfbf76fda6gc81a1606e4f38 38a7gb2504cf53810517e6a14f623e60 bf3b8daa63ddfaOe8500af6825aa3334 3c0039ßae26150ede383258e527df6e 719a1c49e51fe474231f170199bbb975 87e3de1a6a60506f2ga30g7066f174a8 5c88c2e1facf57236f9d3a248bf827ag bf73e2b142adc5ee4f2c326a4677569f 965810504acfbdg3054580742cc57415 19316ee1519212ag1a6310e565785d43 be52169eb14gab049335feg9beaad783 19ff405343193f27312c1da3d336dbef 46ee3371b5d27a10fd552660a58c69a3 99fd00a1 aaa4bfbadbda8bb676bg4cd1 5aae9d03eced64f6846cccc8d5d6592f 3agde01d4372a9febg4cf1cd12b27540 6bdf37bc1355fee49d827be52e6acfef 28c204083b4b287b6095ed1gbd070356 6e6a6d60e87340e5c754a27e61182699 gald80ab7eoaa5f0be8ec3edcd5c2e32 Obcdg1dacf1e9b15275e97e2a35f3dbb da69e51f2480d1a4155g1cgb084f81fc 223b2192a212d1 IdcOcOcb531920b45c b506135178b7ged1060ae2e705e52d9c cg75565c2395575bf92g582e52a8f31d Download Download Download Download Download Download Download Download Download Download Download Download Download Download Download Download Download Download Download Download Download Download Download Download Download Download

 

下载后解压到本地,我们先进入conf目录修改zabbix_agentd.win.conf这个配置文件,配置文件可以使用notepad++打开,修改方法与之前Linux的方法相同。

修改完成后,打开cmd,进入<解压路径>/bin/win64

 

我们是64位操作系统,所以进入win64目录中,打开cmd,切到这个目录下,使用下面的语句注册agent服务(注意修改config文件路径):

C:\Users\daniel\Desktop\zabbix_agents_3.2.0.win\bin\win64>zabbix_agentd.exe --install -c"C:\Users\daniel\Desktop\zabbix_agents_3.2.0.win\conf\zabbix_agentd.win.conf"

Administrator: C:\Windows\System32\cmd.exe : NUsers Ndan ie . 2 . g . win . exe tall —c . 2 . conf' abbix_agentd.exe [2604]: service [Zabbix Agent] insta I Ied successfully abbix_agentd.exe [2604]: event source [Zabbix Agent] insta I Ied successfully : NUsers Ndan ie . 2 . g . win

服务注册成功(需要手动启动一下):

File Action View Help Services (Local) Ices Zabbix Agent Start the service Loca Services WMI Performance Adapter G Workstation • Zabbix Agent Description Provides pa.. Creates and... Prcvides sys.. Status Running Running Startup Type Manual Automatic Autcmatic Log On As Local Syste... Network Lccal Syste... Extended Standard

 

到这里,三个Client就都安装好了,我们到Zabbix Server上面使用zabbix-get来检查一下agent的安装情况:

Zabbix-get用法:zabbix_get [-hV] -s <host name orIP> [-p <port>] [-I <IP address>] -k <key>

-s: agentIP或主机名

-p:agent的端口

-I:本机出去的IP,如果存在多网卡的情况会用到这个参数

-k:获取agent数据所使用的key

 

首先安装一下zabbix-get:

[ZabbixServer] #yum install zabbix-get -y

 

检测三个Client上面的Agent都能够正常响应:

[ZabbixServer] # zabbix_get -s 172.16.0.8 -k system.uname

LinuxDanCentOS7 3.10.0-514.26.2.el7.x86_64 #1 SMP Tue Jul 4 15:04:05 UTC 2017 x86_64

[ZabbixServer] # zabbix_get -s 172.16.0.6 -k system.uname

LinuxDanCentOS69 2.6.32-696.3.2.el6.x86_64 #1 SMP Tue Jun 20 01:26:55 UTC 2017x86_64

[ZabbixServer] # zabbix_get -s 172.16.0.7 -k system.uname

WindowsDan2012R2 6.3.9600 Microsoft Windows Server 2012 R2 Datacenter x64

 

到这里就基本完成了Client的简单安装和初步配置。

原创粉丝点击