Forum Discussion
Raj_135327
Nimbostratus
Aug 29, 2016How to find if datagroup is empty
How to find if datagroup is empty through icall script?
Kai_Wilke
MVP
Aug 29, 2016Hi Prajwal,
use the iCall script below as a startingpoint...
sys icall script Report_Empty_Datagroups {
app-service none
definition {
tmsh::cd "/Common"
foreach datagroup [tmsh::get_config /ltm data-group internal] {
if { [catch {
if { [tmsh::get_field_value $datagroup "records"] ne "" } then {
tmsh::log "iCall: The data-group \"[tmsh::get_name $datagroup]\" has records."
}
}] } then {
tmsh::log "iCall: The data-group \"[tmsh::get_name $datagroup]\" is empty"
}
}
}
description none
events none
}
sys icall handler periodic Report_Empty_Datagroups {
first-occurrence 2016-08-15:00:00:00
interval 5
script Report_Empty_Datagroups
}
Note: The provided script tries to
the [tmsh::get_field_value]
section of each single data-group. If this command fails the record { }
exemption is getting fired and you know that the data-group is empty...[catch]
Cheers, Kai
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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