Forum Discussion

refra_151287's avatar
Jul 23, 2018

Fire irule when condition met

Hello, is there a way to fire an irule when a condiftion met (such as VS connction limit is reached 90%). I thought about

"/etc/alertd/alert.conf"
file, but i don't know to fire the irule inside it, any thoughts....

2 Replies

  • Sample implementation:

    /config/alert_user.conf
    (see K14397) -- this attaches the iRule
    TestMe
    to the virtual
    vs
    when a message containing "I sense something" appears in
    /var/log/ltm
    .

    alert st_exec_command "I sense something" {
      exec command="tmsh modify ltm virtual vs rules { TestMe }"
    }
    

    Send a test log message:

     logger -p local0.info "I sense something; a presence I have not felt since..."
    

    Check if the iRule is attached:

     tmsh list ltm virtual vs rules
    ltm virtual vs {
        rules {
            TestMe
        }
    }
    

    Access the virtual. See if it fired. In this example, the

    TestMe
    iRule logs message (log local0. "xxxx").

    Jul 26 12:18:36 ltm1310 info tmm[12214]: Rule /Common/TestMe : Obi-Wan is here. The Force is with him.
    

    You need to find the exact log message that trigers the iRule. If the virtual already had other iRules, the logic may become more complex. In that case, you may want to write a tmsh script.