zabbix中snmp-traps设置解析
创始人
2024-07-25 00:31:14
0

zabbixsnmp-traps设置解析如下:

  It works something like this:

  (SNMP Trap) -> snmptrapd -> snmptrap.sh -> zabbix_sender -> (Zabbix)

  Basically, the point of snmptrap.sh is to translate a SNMP trap into a Zabbix trap

  在/etc/snmp/snmptrapd.conf文件添加

  traphandle default /bin/bash /path/to/zabbix/bin/snmptrap.sh

  启动snmptrapd服务:

  snmptrapd -C -c /etc/snmp/snmptrapd.conf -Lf /var/log/net-snmptrap.log

  Now edit /path/to/zabbix/bin/snmptrap.sh. If not found, check the zabbix source tree, and

  copy it to the zabbix/bin directory. For my application the following lines work great:

  ####### Begin snmptrap.sh #########

  ## GENERAL CONFIGURATION

  ZABBIX_SERVER="zabbix-host"; # hostname of zabbix server

  ZABBIX_PORT="nnnn"; # nnnn=same as 'Listen Port' in zabbix_server.conf

  ZABBIX_SENDER="/path/to/zabbix/bin/zabbix_sender"; # insert you path

  ## END OF GENERAL CONFIGURATION

  #According to the snmpdtrapd.conf man page, these

  # fields should be received in the following order:

  read hostname

  read ip

  read uptime

  read trapoid

  read payload

  # there may be several more payload fields, but one is all I need.

  # read more if it suits you.

  hostname=`echo $hostname|cut -f1 -d'.'` # trim off the fluff

  trapoid=`echo $trapoid|cut -f3 -d' '` # ditto

  # I don't need uptime or ip right now ...

  payload=`echo $payload1|cut -f3- -d' '` # ditto ditto

  ### This section records all traps under a 'dummy' host in zabbix, for debugging

  ### Delete if you don't need to do this.

  ### I use it to verify the OID of traps before using them as keys on specific hosts

  # create a string to send to zabbix.

  str="HOST=$hostname TRAP OID=$trapoid PAYLOAD=$payload"

  # now set the key and host name for zabbix

  KEY="alltraps";

  HOST="trapperjohn";

  #now call the zabbix_sender program with all parameters.

  $ZABBIX_SENDER $ZABBIX_SERVER $ZABBIX_PORT $HOST $KEY "$str"

  ### End dummy host section

  ### This section records traps for specific for specific hosts.

  ### Edit as needed for you situation.

  KEY="$trapoid";

  HOST="$hostname";

  str="$payload";

  $ZABBIX_SENDER $ZABBIX_SERVER $ZABBIX_PORT $HOST $KEY "$str"

  ######### End snmptrap.sh ###########

#p#

  调试可:

  echo $ZABBIX_SENDER $ZABBIX_SERVER $ZABBIX_PORT $HOST:$KEY "$str" > /tmp/testtrap.txt

  测试:

  snmptrap -v1 -cpublic localhost .1.3.6.1.6.3.1.1.5.2 0 0 "" "" .1.3.6.1.4.1 s "aaa"

  在zabbix服务器端:

  1. Added host:

  name=snmpTraps

  ip address = (didn't enter an ip address)

  port = 10005 (port which zabbix server is on) - do i need to set this to 162?

  Set status to monitored....didn't add anything else eg IP address, group etc

  2. Added item to host (i.e to snmpTraps)

  key=snmpTraps

  type=zabbix trapper

  type of info=numeric

  store value=As is

  Allowed host= (i have left this line blank)

手动起来完成了zabbix中snmp-traps设置环节,我们就可以配置其他zabbix了!

【编辑推荐】

  1. Zabbix 1.8 安装详解
  2. 分布式监控zabbix 汉化工作
  3. zabbix应用之proxy分布式部署
  4. zabbix应用之使用自动注册action批量添加主机
  5. CentOS 5.5下安装配置zabbix客户端
  6. CentOS下zabbix的安装指导

相关内容

热门资讯

如何允许远程连接到MySQL数... [[277004]]【51CTO.com快译】默认情况下,MySQL服务器仅侦听来自localhos...
如何利用交换机和端口设置来管理... 在网络管理中,总是有些人让管理员头疼。下面我们就将介绍一下一个网管员利用交换机以及端口设置等来进行D...
各种千兆交换机的数据接口类型详... 千兆交换机有很多值得学习的地方,这里我们主要介绍各种千兆交换机的数据接口类型,作为局域网的主要连接设...
施耐德电气数据中心整体解决方案... 近日,全球能效管理专家施耐德电气正式启动大型体验活动“能效中国行——2012卡车巡展”,作为该活动的...
Windows恶意软件20年“... 在Windows的早期年代,病毒游走于系统之间,偶尔删除文件(但被删除的文件几乎都是可恢复的),并弹...
规避非法攻击 用好路由器远程管... 单位在市区不同位置设立了科技服务点,每一个服务点的员工都通过宽带路由器进行共享上网,和单位网络保持联...
范例解读VB.NET获取环境变... VB.NET编程语言的使用范围非常广泛,可以帮助开发人员处理各种程序中的需求,而且还能对移动设备进行...
20个非常棒的扁平设计免费资源 Apple设备的平面图标PSD免费平板UI 平板UI套件24平图标Freen平板UI套件PSD径向平...