跨网部署zabbix_proxy,并配置snmptrap

系统网络架构

安装zabbix_proxy

下载zabbix源码,编译安装

  ./configure --enable-proxy --with-mysql --with-net-snmp --with-libcurl

配置zabbix_proxy.conf

Server=192.168.21.61
Hostname=172.16.105.26
DBName=zabbix
DBPassword=zabbix
SNMPTrapperFile=/tmp/zabbix_traps.tmp
StartSNMPTrapper=1

启动zabbix_proxy服务

配置/etc/zabbix/zabbix_agentd.conf

Server=172.16.105.26
PidFile=/tmp/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=0
ServerActive=172.16.105.26
Hostname=172.16.105.15
Include=/etc/zabbix/zabbix_agentd.d/
UnsafeUserParameters=1

web中添加主机,选择代理程序

配置SNMPTrap接收告警

安装snmptrapd服务

CentOS直接执行yum install −y --nogpgcheck net-snmp-utils net-snmp-perl net-snmp

修改snmptrapd服务配置,然后重启snmptrapd服务:

 vim /etc/snmp/snmptrapd.conf 
# Example configuration file for snmptrapd
#
# No traps are handled by default, you must edit this file!
#
# authCommunity   log,execute,net public 如果开启团体字认证就取消注释
# traphandle SNMPv2-MIB::coldStart    /usr/bin/bin/my_great_script cold
disableAuthorization yes #关闭认证
perl do "/usr/bin/zabbix_trap_receiver.pl"

测试接收报警:

snmptrap -v 2c  172.16.105.26 '.1.3.6.1.6.3.1.1.5.4' '0.0.0.0' 6 33 '55' .1.3.6.1.6.3.1.1.5.4 s "test"

查看输出

tail -f  /tmp/zabbix_traps.tmp

发表评论

评论列表,共 0 条评论

    暂无评论