Node Name
From Tech-Wiki
Revision as of 18:46, 20 May 2019 by Fabricio.Lima (Talk | contribs) (Created page with "Category:F5 Networks '''Back to iRules''' # set member_name [class match -value $member_ip eq nodename_dg] sys icall handler periodic node_names...")
# set member_name [class match -value $member_ip eq nodename_dg] sys icall handler periodic node_names { first-occurrence 2016-08-15:00:00:00 interval 43200 script node_names } sys icall script node_names { app-service none definition { set node_rd "" set node_no_rd "" 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]" set node_rd [tmsh::get_field_value $node "address"] set node_no_rd [string map {%1 "" %2 "" %3 "" %4 ""} $node_rd] append nodelist "\"$node_no_rd\" \{ 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 nodename_dg") } then { #tmsh::log "icall: created the data-group \"nodename_dg\"." tmsh::create /ltm data-group internal "nodename_dg" type "string" } else { #tmsh::log "icall: the datagroup does exist." } eval "tmsh::modify /ltm data-group internal nodename_dg \{ records replace-all-with \{ $nodelist \} \}" tmsh::log "icall: updated the data-group nodename_dg with \"$nodecounter\" entries." } description none events none }