当前位置:   article > 正文

【zabbix】自动化监控网络链路状态(上)_zabix 监控 bfd

zabix 监控 bfd

目录

1.拓扑及思路

2.网络设备

3.NMS虚拟机配置

(1)安装必要snmp相关组件

(2)编辑snmptrapd配置文件

(3)编辑snmptt配置文件

(4)启动snmptrap及snmptt服务

(5)测试结果


1.拓扑及思路

 

2.网络设备

 以华为ar3260为例

(1)对线路配置bfd探测

  1. #单向回声探测
  2. bfd example-bfd bind peer-ip 10.10.10.2 interface GigabitEthernet8/0/0.1003 one-arm-echo
  3. discriminator local 1003
  4. commit

(2)开启snmp功能

  1. ###这两行开启后,虚拟机上可用snmpwalk命令进行测试###
  2. snmp-agent sys-info version all
  3. snmp-agent community read huawei
  4. ###开启华为ar3260的snmptrap发送功能,注意securityname的设置需要和nms设备snmptrap配置文件中authcommunity一致
  5. snmp-agent target-host trap-hostname nms-zabbix address 192.168.1.9 trap-paramsname trap-huawei
  6. snmp-agent target-host trap-paramsname trap-huawei v2c securityname sec-huawei-zabbix
  7. ###使能trap功能
  8. snmp-agent trap enable

  

3.NMS虚拟机配置

(1)安装必要snmp相关组件

  1. ###安装源用的都是阿里云镜像的epel源与centos7源
  2. yum install -y net-snmp
  3. yum install -y snmptt
  4. yum install -y net-snmp-utils
  5. yum install -y net-snmp-perl
  6. yum install -y perl-Sys-Syslog

(2)编辑snmptrapd配置文件

编辑/etc/snmp/snmptrapd.conf

  1. # Example configuration file for snmptrapd
  2. #
  3. # No traps are handled by default, you must edit this file!
  4. #
  5. # authCommunity log,execute,net public
  6. # traphandle SNMPv2-MIB::coldStart /usr/bin/bin/my_great_script cold
  7. traphandle default /usr/sbin/snmptthandler
  8. authCommunity log,execute,net sec-huawei-zabbix

(3)编辑snmptt配置文件

snmptt运行在daemon模式,与目前公司生产环境的模式一样,/etc/snmp/snmptt.ini配置文件如下,change代表被更改的部分

  1. [General]
  2. snmptt_system_name =
  3. ######change######
  4. mode = daemon
  5. multiple_event = 1
  6. dns_enable = 0
  7. strip_domain = 0
  8. strip_domain_list = <<END
  9. domain.com
  10. END
  11. resolve_value_ip_addresses = 0
  12. ##########################change##########################
  13. net_snmp_perl_enable = 1
  14. net_snmp_perl_cache_enable = 1
  15. ##########################change##########################
  16. net_snmp_perl_best_guess = 2
  17. translate_log_trap_oid = 0
  18. translate_value_oids = 1
  19. translate_enterprise_oid_format = 1
  20. translate_trap_oid_format = 1
  21. translate_varname_oid_format = 1
  22. translate_integers = 1
  23. wildcard_expansion_separator = " "
  24. allow_unsafe_regex = 0
  25. remove_backslash_from_quotes = 0
  26. dynamic_nodes = 0
  27. description_mode = 0
  28. description_clean = 1
  29. threads_enable = 0
  30. threads_max = 10
  31. ##########################change##########################
  32. date_time_format = %H:%M:%S %Y%m%d
  33. [DaemonMode]
  34. daemon_fork = 1
  35. daemon_uid = snmptt
  36. pid_file = /var/run/snmptt.pid
  37. spool_directory = /var/spool/snmptt/
  38. sleep = 5
  39. use_trap_time = 1
  40. keep_unlogged_traps = 1
  41. duplicate_trap_window = 0
  42. [Logging]
  43. stdout_enable = 0
  44. log_enable = 1
  45. log_file = /var/log/snmptt/snmptt.log
  46. ##########################change##########################
  47. log_system_enable = 1
  48. log_system_file = /var/log/snmptt/snmpttsystem.log
  49. ##########################change##########################
  50. unknown_trap_log_enable = 1
  51. unknown_trap_log_file = /var/log/snmptt/snmpttunknown.log
  52. statistics_interval = 0
  53. ##########################change##########################
  54. syslog_enable = 0
  55. syslog_facility = local0
  56. syslog_level_debug = <<END
  57. END
  58. syslog_level_info = <<END
  59. END
  60. syslog_level_notice = <<END
  61. END
  62. syslog_level_warning = <<END
  63. END
  64. syslog_level_err = <<END
  65. END
  66. syslog_level_crit = <<END
  67. END
  68. syslog_level_alert = <<END
  69. END
  70. syslog_level = warning
  71. syslog_system_enable = 1
  72. syslog_system_facility = local0
  73. syslog_system_level = warning
  74. [SQL]
  75. db_translate_enterprise = 0
  76. db_unknown_trap_format = '$-*'
  77. sql_custom_columns = <<END
  78. END
  79. sql_custom_columns_unknown = <<END
  80. END
  81. mysql_dbi_enable = 0
  82. mysql_dbi_host = localhost
  83. mysql_dbi_port = 3306
  84. mysql_dbi_database = snmptt
  85. mysql_dbi_table = snmptt
  86. mysql_dbi_table_unknown = snmptt_unknown
  87. mysql_dbi_table_statistics =
  88. mysql_dbi_username = snmpttuser
  89. mysql_dbi_password = password
  90. mysql_ping_on_insert = 1
  91. mysql_ping_interval = 300
  92. postgresql_dbi_enable = 0
  93. postgresql_dbi_module = 0
  94. postgresql_dbi_hostport_enable = 0
  95. postgresql_dbi_host = localhost
  96. postgresql_dbi_port = 5432
  97. postgresql_dbi_database = snmptt
  98. postgresql_dbi_table_unknown = snmptt_unknown
  99. postgresql_dbi_table_statistics =
  100. postgresql_dbi_table = snmptt
  101. postgresql_dbi_username = snmpttuser
  102. postgresql_dbi_password = password
  103. postgresql_ping_on_insert = 1
  104. postgresql_ping_interval = 300
  105. dbd_odbc_enable = 0
  106. dbd_odbc_dsn = snmptt
  107. dbd_odbc_table = snmptt
  108. dbd_odbc_table_unknown = snmptt_unknown
  109. dbd_odbc_table_statistics =
  110. dbd_odbc_username = snmptt
  111. dbd_odbc_password = password
  112. dbd_odbc_ping_on_insert = 1
  113. dbd_odbc_ping_interval = 300
  114. [Exec]
  115. exec_enable = 1
  116. pre_exec_enable = 1
  117. unknown_trap_exec =
  118. unknown_trap_exec_format =
  119. exec_escape = 1
  120. [Debugging]
  121. DEBUGGING = 0
  122. DEBUGGING_FILE =
  123. DEBUGGING_FILE_HANDLER =
  124. [TrapFiles]
  125. snmptt_conf_files = <<END
  126. /etc/snmp/snmptt.conf
  127. END

编辑snmptt.conf添加以下配置,以下以bfd,nqa,sla为例

  1. #######测试配置
  2. ############bfd#################
  3. EVENT bfd-Up .1.3.6.1.4.1.2011.5.25.38.3.2 "Status Events" Normal
  4. FORMAT ZBXTRAP $aA $aA peerIp:$2 Up
  5. EVENT bfd-Down .1.3.6.1.4.1.2011.5.25.38.3.1 "Status Events" Normal
  6. FORMAT ZBXTRAP $aA $aA peerIp:$2 Down
  1. ####这个是生产配置
  2. #Huawei-AR3260 bfd alert
  3. EVENT bfdUp-10.10.20.10-yidong .1.3.6.1.4.1.2011.5.25.38.3.2 "Status Events" Normal
  4. #FORMAT ZBXTRAP $aA $aA interface:$4 peerIp:$2 Up
  5. FORMAT ZBXTRAP $aA $aA peerIp:$2 Up
  6. EVENT bfdDown-10.10.20.10-yidong .1.3.6.1.4.1.2011.5.25.38.3.1 "Status Events" Normal
  7. #FORMAT ZBXTRAP $aA $aA interface:$4 peerIp:$2 Down
  8. FORMAT ZBXTRAP $aA $aA peerIp:$2 Down
  9. #EVENT slaUp .1.3.6.1.4.1.9.9.42.2.0.5 "Status Events" Normal
  10. #Huawei-AR3260 nqa alert
  11. EVENT nqaUp-ft3q-yidong .1.3.6.1.4.1.2011.5.25.111.6.2 "Status Events" Normal
  12. FORMAT ZBXTRAP $aA $aA peerIp:$2 Down
  13. EVENT nqaDown-ft3q-yidong .1.3.6.1.4.1.2011.5.25.111.6.3 "Status Events" Normal
  14. FORMAT ZBXTRAP $aA $aA peerIp:$2 Up
  15. #FORMAT ZBXTRAP $aA $+*
  16. EVENT slaUp-10.10.30.1-dianxin .1.3.6.1.4.1.9.9.41.2.0.1 "Status Events" Normal
  17. FORMAT ZBXTRAP $aA $aA $4
  18. #FORMAT ZBXTRAP $aA $aA $+*
  19. EVENT yidong-10.10.20.1-zhuanxian .1.3.6.1.4.1.9.9.42.2.0.2 "Status Events" Normal
  20. FORMAT ZBXTRAP $aA $aA $+*
  21. EVENT beixian-10.10.50.1-zhuanxian .1.3.6.1.4.1.9.9.42.2.0.5 "Status Events" Normal
  22. FORMAT ZBXTRAP $aA $aA $+*

(4)启动snmptrap及snmptt服务

  1. systemctl start snmptt
  2. systemctl start snmptrapd

(5)测试结果

在网络设备中down掉bfd相关接口,进行trap消息的发送测试

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/盐析白兔/article/detail/304253?site
推荐阅读
相关标签
  

闽ICP备14008679号