Zabbix监控接入SNMP硬件接口MIB数据指南

知识点*****
IP地址(同一网络域)、端口 (udp:162)、团体字 (public)

yum -y install net-snmp net-snmp-agent-libs net-snmp-devel net-snmp-libs net-snmp-perl net-snmp-utils

1.#开启proxy snmptrap,配置文件添加如下
#################################################(snmptrap配置+perl脚本)############################################

SNMPTrapperFile=/tmp/zabbix_traps.tmp
StartSNMPTrapper=1
2.#在/etc/snmp/ snmptrapd. conf指定recevie使用p1脚本 (suse默认无snmptt),需要重启snmptrap

authCommunity log, execute, net public
perl do home/ zabbix/ zabbix Itrap_ receiver. pl〞
#traphandle default /usr/sbin/snmptthandler
#traphandle default /usr/ sbin/ snmptt;

3.#从安装包拷贝zabbix_ trap receiver.p1到指定目录
位置:
cp /zbxproxy/zabbix4Instal1/zabbix-4.*.8/misc/snmptrap/zabbix_trap_receiver.pl /home/zabbix/

4. #snmDtrap接收文件位置(该文件位置需要与zabbix_trapreceiver.D1文件中指定一致)
#$SNMPTrapperFile
tmp/zabbix_ snmptraps. tmp

5#导入mib文件到指定目录
路径:
/usr/share/snmp/mibs

6.#配置snmp服务读取mib文件
/etc/snmp/snmpd. conf
mibs +ALL

7.#启动snmptrap
#/usr/sbin/snmptrapd-A-LFn/var/log/net-snmpd.log
systemctl restart snmptrapd
#################################################(snmptrap配置+snmptt服务)############################################
1#开启proxy snmptrap,
配置文件添加如下
SNMPTrapperFile=/ tmp/zabbix_traps. tmp
StartSNMPTrapper=1

2.#在/etc/snmp/ snmptrapd. conf指定recevie使用snmptt服务 (suse默认无snmptt),需要重启snmptrap
authCommunity log, execute, net public
#perl do home/zabbix/zabbix_trap_receiver.pl
traphandle default /usr/sbin/snmptthandler
#traphandle default /usr/sbin/ snmptt;

3.安装配置 snmptt服务

#存放snmptt服务系统日志
mkdir /var/10g/ snmptt

#存放启动snmptt启动脚本的路径
mkdir/var/spool/snmptt/

cd /etc/ snmp/

tar xvf snmptt_1. 4. tgz
cd snmptt_1.4
cp /etc/snmp/snmptt_1.4/snmptt /usr/sbin
cp /etc/snmp/snmptt_1.4/snmptt.ini /etc/snmp/

#which snmptt
#/usr/sbin/snmptt

#which snmptthandler
#/usr/sbin/snmptthandler

#vi /etc/snmp/snmptt. ini

#mode = standalone
#multiple_event =0
#translase log_trap_oid = 1
#date time format = %Y/%m %d %H: %M : %S
#syslog_enable = 0
#daemonuid = root
#1og_systemenable = 1
#1og_system_ file = /var/1og/ snmptt/snmpttsystem. 1og
#log file = /tmp/zabbix_traps. tmp
#net_snmp perl enable = 1

#4.#配置 snmptt处理格式
#vi /etc/ snmp/snmptt. conf

#EVENT general "General event" Normal
#FORMAT ZBXTRAP SaA name= $6, IP = $1, location = $9, Type = $8, Problems = $4
#FORMAT ZBXTRAP SaA Sar $1
#5.#导入mib文件到指定目录

#路径:
/usr/share/snmp/mibs

6,#配置snmp服务 读取mib文件
#/etc/snmp/snmp. conf
mibs +ALL

7.#启动snmptrap
/usr/sbin/snmptrapd-A-LFn/var/log/net-snmpd.logp/var/run/snmptrapd.pid
#systemctl restart snmptrapd

8. #启动snmptt
usr/bin/perl/usr/sbin/snmptt--daemon
#systemctl restart snmptt

ps:
#转换mib文件格式为snmptt服务可读
/usr/bin/snmpttconvertmib_-in=/usr/share/snmp/mibs/hatech-alarm.txt_-out=/etc/snmp/snmptt.conf.hatech-alarm--net_shmp_perl

测试命令通路:
snmptrap =v 1 -c public 127.0.0.1 ’.1.3.6.1.6.3.1.1.5.3' 0.0.0.0' 6 33 '55' . 1.3.6.1.6.3.1.1.5.3 s "teststring001"

snmptt服务系统日志路径:
/var/log/snmptt/snmpttsystem.log

posted @ 2022-08-13 17:26  呼长喜  阅读(2031)  评论(0编辑  收藏  举报