Forum Discussion

davidfisher's avatar
May 30, 2019

How to use integers or numbers in custom SNMP Traps?

Hi

I am asking this from some questions I came across.

How would you make a trap for

01010029:5: Clock advanced by <number> ticks

Is <number> the right way or should it be int or *int something?

Here we can see .* used as a wildcard of sorts for enabled or disabled

Custom SNMP trap example

A message that appears similar to the following example is logged to the /var/log/ltm file when switchboard failsafe is enabled:

`Sep 23 11:51:40 bigip1.askf5.com lacpd[27753]: 01160016:6: Switchboard Failsafe enabled`

To create a custom SNMP trap that is triggered whenever switchboard failsafe status changes are logged, add the following trap definition to the /config/user_alert.conf file:

alert SWITCHBOARD_FAILSAFE_STATUS "Switchboard Failsafe (.*)" {
 
 snmptrap OID=".1.3.6.1.4.1.3375.2.4.0.500"
 
}
 

Thanks!

4 Replies

  • The easiest way is to use "Clock advanced by (.*) ticks" as matching expression.

     

    KR,

    Dario.

    • davidfisher's avatar
      davidfisher
      Icon for Cirrus rankCirrus

      so .* only stands for numerics or integers or for any string?

      • Hamish's avatar
        Hamish
        Icon for Cirrocumulus rankCirrocumulus

        Its a regex...

         

        . == any character

        * == 0 or more of the preceding character

         

        So .* effectively matches ANY string. Including an empty one.

         

        See https://techdocs.f5.com/kb/en-us/products/big-ip-afm/manuals/product/dns-dos-firewall-implementations-11-6-0/6.html for details of alert configs

        Also see https://www.rexegg.com/regex-quickstart.html for a regex cheat sheet.