赞
踩
目录
以华为ar3260为例
(1)对线路配置bfd探测
- #单向回声探测
- bfd example-bfd bind peer-ip 10.10.10.2 interface GigabitEthernet8/0/0.1003 one-arm-echo
- discriminator local 1003
- commit
(2)开启snmp功能
- ###这两行开启后,虚拟机上可用snmpwalk命令进行测试###
- snmp-agent sys-info version all
- snmp-agent community read huawei
-
- ###开启华为ar3260的snmptrap发送功能,注意securityname的设置需要和nms设备snmptrap配置文件中authcommunity一致
- snmp-agent target-host trap-hostname nms-zabbix address 192.168.1.9 trap-paramsname trap-huawei
- snmp-agent target-host trap-paramsname trap-huawei v2c securityname sec-huawei-zabbix
-
- ###使能trap功能
- snmp-agent trap enable
- ###安装源用的都是阿里云镜像的epel源与centos7源
- yum install -y net-snmp
- yum install -y snmptt
- yum install -y net-snmp-utils
- yum install -y net-snmp-perl
- yum install -y perl-Sys-Syslog
编辑/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
- traphandle default /usr/sbin/snmptthandler
- authCommunity log,execute,net sec-huawei-zabbix
snmptt运行在daemon模式,与目前公司生产环境的模式一样,/etc/snmp/snmptt.ini配置文件如下,change代表被更改的部分
- [General]
- snmptt_system_name =
- ######change######
- mode = daemon
- multiple_event = 1
- dns_enable = 0
- strip_domain = 0
- strip_domain_list = <<END
- domain.com
- END
- resolve_value_ip_addresses = 0
- ##########################change##########################
- net_snmp_perl_enable = 1
- net_snmp_perl_cache_enable = 1
- ##########################change##########################
- net_snmp_perl_best_guess = 2
- translate_log_trap_oid = 0
- translate_value_oids = 1
- translate_enterprise_oid_format = 1
- translate_trap_oid_format = 1
- translate_varname_oid_format = 1
- translate_integers = 1
- wildcard_expansion_separator = " "
- allow_unsafe_regex = 0
- remove_backslash_from_quotes = 0
- dynamic_nodes = 0
- description_mode = 0
- description_clean = 1
- threads_enable = 0
- threads_max = 10
- ##########################change##########################
- date_time_format = %H:%M:%S %Y%m%d
- [DaemonMode]
- daemon_fork = 1
- daemon_uid = snmptt
- pid_file = /var/run/snmptt.pid
- spool_directory = /var/spool/snmptt/
- sleep = 5
- use_trap_time = 1
- keep_unlogged_traps = 1
- duplicate_trap_window = 0
- [Logging]
- stdout_enable = 0
- log_enable = 1
- log_file = /var/log/snmptt/snmptt.log
- ##########################change##########################
- log_system_enable = 1
- log_system_file = /var/log/snmptt/snmpttsystem.log
- ##########################change##########################
- unknown_trap_log_enable = 1
- unknown_trap_log_file = /var/log/snmptt/snmpttunknown.log
- statistics_interval = 0
- ##########################change##########################
- syslog_enable = 0
- syslog_facility = local0
- syslog_level_debug = <<END
- END
- syslog_level_info = <<END
- END
- syslog_level_notice = <<END
- END
- syslog_level_warning = <<END
- END
- syslog_level_err = <<END
- END
- syslog_level_crit = <<END
- END
- syslog_level_alert = <<END
- END
- syslog_level = warning
- syslog_system_enable = 1
- syslog_system_facility = local0
- syslog_system_level = warning
- [SQL]
- db_translate_enterprise = 0
- db_unknown_trap_format = '$-*'
- sql_custom_columns = <<END
- END
- sql_custom_columns_unknown = <<END
- END
- mysql_dbi_enable = 0
- mysql_dbi_host = localhost
- mysql_dbi_port = 3306
- mysql_dbi_database = snmptt
- mysql_dbi_table = snmptt
- mysql_dbi_table_unknown = snmptt_unknown
- mysql_dbi_table_statistics =
- mysql_dbi_username = snmpttuser
- mysql_dbi_password = password
- mysql_ping_on_insert = 1
- mysql_ping_interval = 300
- postgresql_dbi_enable = 0
- postgresql_dbi_module = 0
- postgresql_dbi_hostport_enable = 0
- postgresql_dbi_host = localhost
- postgresql_dbi_port = 5432
- postgresql_dbi_database = snmptt
- postgresql_dbi_table_unknown = snmptt_unknown
- postgresql_dbi_table_statistics =
- postgresql_dbi_table = snmptt
- postgresql_dbi_username = snmpttuser
- postgresql_dbi_password = password
- postgresql_ping_on_insert = 1
- postgresql_ping_interval = 300
- dbd_odbc_enable = 0
- dbd_odbc_dsn = snmptt
- dbd_odbc_table = snmptt
- dbd_odbc_table_unknown = snmptt_unknown
- dbd_odbc_table_statistics =
- dbd_odbc_username = snmptt
- dbd_odbc_password = password
- dbd_odbc_ping_on_insert = 1
- dbd_odbc_ping_interval = 300
- [Exec]
- exec_enable = 1
- pre_exec_enable = 1
- unknown_trap_exec =
- unknown_trap_exec_format =
- exec_escape = 1
- [Debugging]
- DEBUGGING = 0
- DEBUGGING_FILE =
- DEBUGGING_FILE_HANDLER =
- [TrapFiles]
- snmptt_conf_files = <<END
- /etc/snmp/snmptt.conf
- END
编辑snmptt.conf添加以下配置,以下以bfd,nqa,sla为例
- #######测试配置
- ############bfd#################
- EVENT bfd-Up .1.3.6.1.4.1.2011.5.25.38.3.2 "Status Events" Normal
- FORMAT ZBXTRAP $aA $aA peerIp:$2 Up
- EVENT bfd-Down .1.3.6.1.4.1.2011.5.25.38.3.1 "Status Events" Normal
- FORMAT ZBXTRAP $aA $aA peerIp:$2 Down
- ####这个是生产配置
- #Huawei-AR3260 bfd alert
- EVENT bfdUp-10.10.20.10-yidong .1.3.6.1.4.1.2011.5.25.38.3.2 "Status Events" Normal
- #FORMAT ZBXTRAP $aA $aA interface:$4 peerIp:$2 Up
- FORMAT ZBXTRAP $aA $aA peerIp:$2 Up
- EVENT bfdDown-10.10.20.10-yidong .1.3.6.1.4.1.2011.5.25.38.3.1 "Status Events" Normal
- #FORMAT ZBXTRAP $aA $aA interface:$4 peerIp:$2 Down
- FORMAT ZBXTRAP $aA $aA peerIp:$2 Down
- #EVENT slaUp .1.3.6.1.4.1.9.9.42.2.0.5 "Status Events" Normal
- #Huawei-AR3260 nqa alert
- EVENT nqaUp-ft3q-yidong .1.3.6.1.4.1.2011.5.25.111.6.2 "Status Events" Normal
- FORMAT ZBXTRAP $aA $aA peerIp:$2 Down
- EVENT nqaDown-ft3q-yidong .1.3.6.1.4.1.2011.5.25.111.6.3 "Status Events" Normal
- FORMAT ZBXTRAP $aA $aA peerIp:$2 Up
- #FORMAT ZBXTRAP $aA $+*
- EVENT slaUp-10.10.30.1-dianxin .1.3.6.1.4.1.9.9.41.2.0.1 "Status Events" Normal
- FORMAT ZBXTRAP $aA $aA $4
- #FORMAT ZBXTRAP $aA $aA $+*
- EVENT yidong-10.10.20.1-zhuanxian .1.3.6.1.4.1.9.9.42.2.0.2 "Status Events" Normal
- FORMAT ZBXTRAP $aA $aA $+*
- EVENT beixian-10.10.50.1-zhuanxian .1.3.6.1.4.1.9.9.42.2.0.5 "Status Events" Normal
- FORMAT ZBXTRAP $aA $aA $+*
- systemctl start snmptt
- systemctl start snmptrapd
在网络设备中down掉bfd相关接口,进行trap消息的发送测试
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。