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

Filter by:
  • Solution
  • Technology
Answers

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....

0
Rate this Question

Answers to this Question

placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

This one? K14397: Running a command or custom script based on a syslog message

You can write a code that attaches an iRule to a virtual using tmsh scripting. See TMSH Scripting in v10.1

0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

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 <HTTP_REQUEST>: 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.

0