码迷,mamicode.com
首页 > 其他好文 > 详细

zabbix 二 zabbix agent 客户端

时间:2016-05-22 06:13:41      阅读:208      评论:0      收藏:0      [点我收藏+]

标签:

[root@zabbix_agent src]# cd zabbix-3.0.3
[root@zabbix_agent zabbix-3.0.3]# ls
aclocal.m4  bin    ChangeLog  conf          config.sub  configure.ac  database  frontends  INSTALL     m4           Makefile.in  misc     NEWS    src
AUTHORS     build  compile    config.guess  configure   COPYING       depcomp   include    install-sh  Makefile.am  man          missing  README  upgrades
[root@zabbix_agent zabbix-3.0.3]# ./configure --prefix=/usr/local/zabbix-3.0.3/ --enable-agent

 

[root@zabbix_agent zabbix-3.0.3]# yum install -y gcc c++

 

[root@zabbix_agent zabbix-3.0.3]# ./configure --prefix=/usr/local/zabbix-3.0.3/ --enable-agent

 

[root@zabbix_agent zabbix-3.0.3]# make install

 

# vim /usr/local/zabbix-3.0.3/etc/zabbix_agentd.conf
Server=ip(zabbix_server的ip)
ServerActive==ip(zabbix_server的ip)
Hostname=Zabbix server
其中Server和ServerActive都指定zabbixserver的IP地址,不同的是,前者是被动后者是主动。也就是说Server这个配置是用来允许127.0.0.1这个ip来我这取数据。而serverActive的127.0.0.1的意思是,客户端主动提交数据给他.
主机安装客户端记得添加zabbix用户

 

[root@zabbix_agent zabbix-3.0.3]# userdel zabbix
[root@zabbix_agent zabbix-3.0.3]# groupadd zabbix
[root@zabbix_agent zabbix-3.0.3]# useradd -g zabbix zabbix

 启动zabbix客户端:

[root@zabbix_agent zabbix-3.0.3]# /usr/local/zabbix-3.0.3/sbin/zabbix_agentd 
[root@zabbix_agent zabbix-3.0.3]# netstat -lnutp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
tcp        0      0 0.0.0.0:10050               0.0.0.0:*                   LISTEN      8899/zabbix_agentd  
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      2097/sshd           
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      1493/master         
tcp        0      0 :::22                       :::*                        LISTEN      2097/sshd           
tcp        0      0 ::1:25                      :::*                        LISTEN      1493/master         
udp        0      0 0.0.0.0:68                  0.0.0.0:*                               1247/dhclient       

 

[root@zabbix_agent zabbix-3.0.3]# ln -s /usr/local/zabbix-3.0.3/sbin/* /usr/local/sbin/
[root@zabbix_agent zabbix-3.0.3]# ln -s /usr/local/zabbix-3.0.3/bin/* /usr/local/bin/

 

[root@zabbix_agent zabbix-3.0.3]# vi /etc/services #添加以下内容
zabbix-agent    10050/tcp               # Zabbix Agent
zabbix-agent    10050/udp               # Zabbix Agent
zabbix-trapper  10051/tcp               # Zabbix Trapper
zabbix-trapper  10051/udp               # Zabbix Trapper

 修改Zabbix配置文件

[root@zabbix_agent zabbix-3.0.3]# vi /usr/local/zabbix-3.0.3/etc/zabbix_agentd.conf
Server=192.168.1.122
Include=/usr/local/zabbix-3.0.3/etc/zabbix_agentd.conf.d/
UnsafeUserParameters=1 #启用自定义key

 添加开机启动脚本

[root@zabbix_agent ~]# cp /usr/local/src/zabbix-3.0.3/misc/init.d/fedora/core/zabbix_agentd /etc/rc.d/init.d/zabbix_agentd

 

[root@zabbix_agent ~]# vi /etc/rc.d/init.d/zabbix_agentd

        # Zabbix-Directory
        BASEDIR=/usr/local/zabbix-3.0.3/ #Zabbix安装目录

 

[root@zabbix_agent ~]# chmod +x /etc/rc.d/init.d/zabbix_agentd 
[root@zabbix_agent ~]# chkconfig zabbix_agentd on
[root@zabbix_agent ~]# service zabbix_agentd start
/etc/init.d/zabbix_agentd : zabbix_agentd (pid 8899) already running

 

[root@zabbix_agent ~]# netstat -lnutp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
tcp        0      0 0.0.0.0:10050               0.0.0.0:*                   LISTEN      8899/zabbix_agentd  
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      2097/sshd           
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      1493/master         
tcp        0      0 :::22                       :::*                        LISTEN      2097/sshd           
tcp        0      0 ::1:25                      :::*                        LISTEN      1493/master         
udp        0      0 0.0.0.0:68                  0.0.0.0:*                               1247/dhclient       

 测试Zabbix客户端与Zabbix服务端通信是否正常

[root@zabbix_agent ~]# /usr/local/zabbix-3.0.3/bin/zabbix_get -s 192.168.1.119 -p10050 -k "system.uptime"
zabbix_get [9070]: Check access restrictions in Zabbix agent configuration

 备注:192.168.1.119是Zabbix客户端IP地址

 

zabbix 二 zabbix agent 客户端

标签:

原文地址:http://www.cnblogs.com/bass6/p/5516007.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!