Learn F5 Technologies, Get Answers & Share Community Solutions Join DevCentral

Filter by:
  • Solution
  • Technology
Clear all filters

SNMP Keepalive / Heartbeat traps

Hi Guys,

Recently i was asked if F5 had the possibility to generate SNMP traps every once in a while. The person asking the question needed some kind of SNMP Trap Keepalive system to verify the F5 still sent out SNMP traps.

I have written an iapp for it, and thought it was a good idea to share it with you guys.

cli admin-partitions {
update-partition Common
sys application template /Common/f5.automated_snmptrap.v1.0 {
actions {
    definition {
        html-help {
        implementation {
            ## Template made by Roy van Dongen, SecureLink NL. B.v.
            package require iapp 1.0.0
            iapp::template start

            tmsh::cd ..

            ## Create script for SNMP-Trap

            set script {
                # Get the hostname of the device we're running on
                set host [tmsh::get_field_value [lindex [tmsh::get_config sys global-settings] 0] hostname]
                # Run the logger command
                exec logger -p local0.info "01070640:5: SNMP Heartbeat trap for host : $host."

            # create icall object
            iapp::conf create sys icall script f5.automated_snmptrap definition \{ $script \} app-service none

            # Set icall interval to 24 hours
            set interval 84600
            set cdate [clock format [clock seconds] -format "%Y-%m-%d"]
            iapp::conf create sys icall handler periodic f5.automated_snmptrap-handler \{ \
            interval $interval \
            first-occurrence $cdate:00:00 \
            script f5.automated_snmptrap \}

            iapp::template end

        macro {

        presentation {
        role-acl { admin manager resource-admin }
        run-as none
description none
ignore-verification false
requires-bigip-version-max none
requires-bigip-version-min 11.4.0
requires-modules { ltm }
signing-key none
tmpl-checksum none
tmpl-signature none

Please note the required 11.4.0 release, since iCall only works from version : 11.4.

Have fun with it!

Roy van Dongen

Rate this Discussion
Comments on this Discussion
Comment made 05-Feb-2015 by Roy van Dongen 3
As an additional note : This iApp uses the builtin SNMP-Trap destinations to make sure the settings for SNMP are correct. To send the SNMP-Traps the Logger command is used. This command forces the SNMP-daemon to send out a trap. For more information on using Logger, please see : https://support.f5.com/kb/en-us/solutions/public/11000/100/sol11127.html

Replies to this Discussion