Ad Widget

Collapse

How create triggers for snmptra

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • FildaSmile
    Member
    • Jul 2019
    • 61

    #1

    How create triggers for snmptra

    Hello,

    i would like ask you for advice in case of making triggers for "snmptrap.fallback" item. I recieving traps but i dont know what is best practise of making triggers.

    Example of trap:
    Timestamp/Trap
    2020-05-13 11:12:41 11:12:40 2020/05/13 PDU INFO: version 1 transactionid 11 messageid 0 requestid 563664375 errorindex 0 errorstatus 0 community Hu@wei123 receivedfrom UDP: [10.0.0.214]:54421->[10.0.0.125]:162 notificationtype TRAP VARBINDS: DISMAN-EXPRESSION-MIB::sysUpTimeInstance type=67 value=Timeticks: (654694446) 75 days, 18:35:44.46 SNMPv2-MIB::snmpTrapOID.0 type=6 value=OID: HUAWEI-SERVER-IBMC-MIB::hwPowerSupplyInputLostDeassert HUAWEI-SERVER-IBMC-MIB::hwTrapSeq type=2 value=INTEGER: 108 HUAWEI-SERVER-IBMC-MIB::hwTrapSensorName type=4 value=STRING: "PS2 Status" HUAWEI-SERVER-IBMC-MIB::hwTrapEvent type=4 value=STRING: "The AC/DC input of PSU 2 is lost or out-of-range." HUAWEI-SERVER-IBMC-MIB::hwTrapSeverity type=2 value=INTEGER: 4 HUAWEI-SERVER-IBMC-MIB::hwTrapEventCode type=4 value=STRING: "0x0883FFFF" HUAWEI-SERVER-IBMC-MIB::hwTrapEventData2 type=2 value=INTEGER: 1 HUAWEI-SERVER-IBMC-MIB::hwTrapEventData3 type=4 value=STRING: "0x0300000E" HUAWEI-SERVER-IBMC-MIB::hwTrapServerIdentity type=4 value=STRING: "022HLV6THB001836" HUAWEI-SERVER-IBMC-MIB::hwTrapLocation type=4 value=STRING: "Huatech" HUAWEI-SERVER-IBMC-MIB::hwTrapTime type=4 value=STRING: "2020-05-13 09:03:40"
    I have searched solution here: https://zabbix.org/wiki/Start_with_SNMP_traps_in_Zabbix

    But unfortunately i didnt got it, can anyone share own experience with this task ? (triggers for snmp trap) do i need something extra instead item which recieving traps in text format ??

    Thank you for any advice ! have nice day.
  • Hamardaban
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • May 2019
    • 2713

    #2
    Depending on your tasks and needs, you can use any trigger functions that work with the text or string data type.
    Most useful for snmptrap are str, strlen, regexp and count.

    Comment

    • FildaSmile
      Member
      • Jul 2019
      • 61

      #3
      thank you for advice, now i should find how preprocess values and extract only important informations to the trigger.
      Maybe best option is Java script because i didnt find easier way - unfortunately i dont know how write java script but i hope that i will search some advice here or on the internet.

      For example i would preprocess trap and extract only valur from "
      HUAWEI-SERVER-IBMC-MIB::hwTrapSensorName type=4 value=STRING: "PS2 Status" vhere PS2 Status will be variable ,is there easier way to do it ? instead java scripts ?
      Last edited by FildaSmile; 14-05-2020, 10:19.

      Comment

      • Hamardaban
        Senior Member
        Zabbix Certified SpecialistZabbix Certified Professional
        • May 2019
        • 2713

        #4
        If the structure of the trap text is constant, use the regex group to extract the desired value.
        You can pre-process the trap at the snmptt level. And at the data element using regex and groups.

        Comment

        • FildaSmile
          Member
          • Jul 2019
          • 61

          #5
          we will probably use JavaScript in Zabbix for preprocessing, important is that zabbix recieving traps correctly.

          THX

          Comment

          Working...