zabbix启用snmptrap

安装应用

yum install -y net-snmp net-snmp-perl net-snmp-utils snmptt perl-Sys-Syslog perl-DBD-MySQL

下载MIB&&转换格式

cp inspur.mib /usr/share/snmp/mibs/INSPUR.txt
snmpttconvertmib --in=/usr/share/snmp/mibs/INSPUR.txt --out=/etc/snmp/snmptt.conf.inspur --net_snmp_perl

sed -i ‘s/FORMAT/FORMAT ZBXTRAP $aA/g‘ /etc/snmp/snmptt.conf.inspur

编辑 /etc/snmp/snmptrapd.conf

# snmp v2
authCommunity execute public
# snmp v3
createUser -e 0x0102030405 sipo SHA sipo@2021 AES sipo@2021
traphandle default /usr/sbin/snmptt

编辑 /etc/snmp/snmptt.ini

mode = daemon
net_snmp_perl_enable = 1
translate_log_trap_oid = 1
date_time_format = %Y/%m/%d %H:%M:%S
log_enable = 1
log_file = /var/log/snmptt/snmptt.log

snmptt_conf_files = <<END
/etc/snmp/snmptt.conf
/etc/snmp/snmptt.conf.inspur
END

编辑 /etc/sysconfig/snmptrapd

OPTIONS="-m +ALL -On"

编辑 /etc/zabbix/zabbix_server.conf

StartSNMPTrapper=1
SNMPTrapperFile=/var/log/snmptt/snmptt.log

启动服务

systemctl enable snmptrapd && systemctl start snmptrapd
systemctl restart zabbix-server

ps axu|grep snmp
root     13941  0.0  0.1 238452  7940 ?        Ss   09:35   0:00 /usr/sbin/snmptrapd -m +ALL -On -f
zabbix   15879  0.0  0.0 725908  2568 ?        S    10:37   0:00 /usr/sbin/zabbix_server: snmp trapper [processed data in 0.000041 sec, idle 1 sec]
root     15970  0.0  0.0 112816  1020 pts/0    S+   10:37   0:00 grep --color=auto snmp

测试snmptrap服务


参考

https://support.nagios.com/kb/article.php?id=493
https://www.cnblogs.com/sddai/p/5911031.html
http://blog.cactifans.com/2019/09/27/Zabbix%E7%9B%91%E6%8E%A7%E8%AE%BE%E5%A4%87SNMP-Trap%E6%B6%88%E6%81%AF/

zabbix启用snmptrap

上一篇:74. 搜索二维矩阵


下一篇:pytest.mark.parametrize里面indirect参数详细解释