Ad Widget

Collapse

Offline method to test your SNMP traps Item prepossessing, triggers and actions

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • prasad_SL
    Member
    • May 2018
    • 35

    #1

    Offline method to test your SNMP traps Item prepossessing, triggers and actions

    Hi,

    This is a simple method.
    You need to modify code according to your zabbix platform and snmp trapping.
    I am using 3.4 appliance.

    write a Script file

    #!/bin/bash

    ratT="$(date +'%Y%m%d.%H%M%S')"
    ratip="$1"
    echo "$ratT ZBXTRAP $ratip $2" >> /var/log/snmptrap/snmptrap.log

    First you need to have a sample snmp trap message.
    Then you can trigger it within zabbix.

    When you need to test snmp

    call the script file with two arguments, IP address of the host and the SNMP text.

    ./trapTester.sh "x.x.x.x" "6 13 (null) SNMPv2-SMI::enterprises.2879.2.8.1.1.1.1.1.0 1330054251 SNMPv2-SMI::enterprises.2879.2.8.1.1.1.1.2.0 2 SNMPv2-SMI::enterprises.2879.2.8.1.1.1.1.3.0 2481898 SNMPv2-SMI::enterprises.2879.2.8.1.1.1.1.4.0 07 E2 0A 03 16 1F 05 00 SNMPv2-SMI::enterprises.2879.2.8.1.1.1.1.5.0 Packet port pkt0 on CE CMBSBC01S slot 1 with ifIndex 9 is DOWN SNMPv2-SMI::enterprises.2879.2.10.1.1.11.1.5.0 CMBSBC01S SNMPv2-SMI::enterprises.2879.2.10.1.1.11.1.4.0 pkt0 SNMPv2-SMI::enterprises.2879.2.1.7.2.2.4.1.0 57.1.1.200 SNMPv2-SMI::enterprises.2879.2.1.7.2.2.4.3.0 1 SNMPv2-SMI::enterprises.2879.2.1.7.2.2.4.4.0 39 01 01 C8"

    I capture this snmp text from the log file "/var/log/snmptrap/snmptrap.log"

    If you need to generate this trap periodically , Ex: 1 message for every 10 seconds, Make an Item, and call the script with the arguments, set item pulling time as your need.

    Work for me and hope this help to someone else.



Working...