Forum Discussion
Michaelyang
Dec 01, 2022Cirrostratus
About script
Hello, I want to make a script that sends alerts to /var/log/ltm every minute when the pool is not up. Here is the script I designed: modify script pool_script {
app-service none
de...
- Dec 01, 2022
Hi MIchaelyang,
check the iCall script below to get a picture how to LTM configs could be enumerated with foreach loops. No need to [exec] native BASH commands... 😉
sys icall handler periodic check_pool_state { interval 120 script check_pool_state } sys icall script check_pool_state { app-service none definition { tmsh::log_dest file tmsh::log_level debug foreach temp(pool_config) [tmsh::get_config /ltm pool] { set temp(pool_name) [tmsh::get_name $temp(pool_config)] if { [tmsh::show /ltm pool $temp(pool_name)] contains "Availability : available" } then { # Everything is fine... } else { tmsh::log debug "Pool Check: $temp(pool_name) is unhealthy" } } } description none events none }
Cheers, Kai
Kai_Wilke
Dec 01, 2022MVP
Hi MIchaelyang,
check the iCall script below to get a picture how to LTM configs could be enumerated with foreach loops. No need to [exec] native BASH commands... 😉
sys icall handler periodic check_pool_state {
interval 120
script check_pool_state
}
sys icall script check_pool_state {
app-service none
definition {
tmsh::log_dest file
tmsh::log_level debug
foreach temp(pool_config) [tmsh::get_config /ltm pool] {
set temp(pool_name) [tmsh::get_name $temp(pool_config)]
if { [tmsh::show /ltm pool $temp(pool_name)] contains "Availability : available" } then {
# Everything is fine...
} else {
tmsh::log debug "Pool Check: $temp(pool_name) is unhealthy"
}
}
}
description none
events none
}
Cheers, Kai
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects