Forum Discussion
sas1
Nimbostratus
Aug 15, 2016Get pool member NAMES in irule?
members -list and nodes -list produces a list of IP addresses of the pool members. Node command does not seem to have an option to get the node name from an IP. Is there any command that can retrie...
Kai_Wilke
MVP
Aug 15, 2016Hi Sas,
had some spare time in the evening to play around with iCall. The iCall script below will dump your Node Names and Node IPs of every single /Partition/ every 60 seconds into the datagroup "/Common/DG_IP_2_NODENAME". Enjoy... 😉
sys icall script NodeList_2_Datagroup {
app-service none
definition {
set nodelist ""
set nodecounter 0
tmsh::log "iCall: Starting to enumerate existing node objects..."
foreach partition [tmsh::get_config auth partition] {
set partition "/[tmsh::get_name $partition]"
tmsh::log "iCall: Processing Partition: $partition"
tmsh::cd $partition
set nodes [tmsh::get_config /ltm node]
foreach node $nodes {
tmsh::log "Processing Node : $partition/[tmsh::get_name $node]"
append nodelist "\"[tmsh::get_field_value $node "address"]\" \{ data \"[tmsh::get_name $node]\" \}\n"
incr nodecounter
}
tmsh::log "Finished Partition: $partition"
}
tmsh::cd "/Common"
if { not ([tmsh::list /ltm data-group] contains "ltm data-group internal DG_IP_2_NODENAME") } then {
tmsh::log "iCall: Created the data-group \"DG_IP_2_NODENAME\"."
tmsh::create /ltm data-group internal "DG_IP_2_NODENAME" type "string"
} else {
tmsh::log "iCall: The DataGroup does exist."
}
eval "tmsh::modify /ltm data-group internal DG_IP_2_NODENAME \{ records replace-all-with \{ $nodelist \} \}"
tmsh::log "iCall: Updated the data-group DG_IP_2_NODENAME with \"$nodecounter\" entries."
}
description none
events none
}
sys icall handler periodic NodeList_2_Datagroup {
first-occurrence 2016-08-15:00:00:00
interval 60
script NodeList_2_Datagroup
}
Note: Tweak the periodic update interval (in seconds) as needed. Then use
to import and merge the partial configuration.tmsh load sys config merge from-terminal
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