Hi 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 tmsh load sys config merge from-terminal
to import and merge the partial configuration.
Cheers, Kai