Forum Discussion
Dean_M_21414
Sep 13, 2011Nimbostratus
Report for down nodes
Hi all,
I need a script that will list all down nodes per pool, by partition. We need a daily report that will show our downed nodes along with their associated pool/s (via members). We also need this report to be per partition, as we have different departments that work on these different partitions.
I can see that this will require a loop within a loop: the inner loop works through the pools, checking for the inactive nodes, and the outer loop works through the partitions.
I've got a fair bit of coding experience, but not in tmsh or tcl. I've got the flow diagram for this (see attached jpg) (i.e. I know what I want this to do), but i need the code.
Any help would be appreciated.
Regards
Dean
- George_Watkins_Historic F5 AccountHi Dean,
!/usr/bin/ruby require 'rubygems' require 'f5-icontrol' def usage puts $0 + ' ' exit end usage if $*.size < 3 set up Management::Partition and LocalLB::Pool interfaces bigip = F5::IControl.new($*[0], $*[1], $*[2], \ ['Management.Partition', 'LocalLB.Pool']).get_interfaces grab a list of partition and loop through them partitions = bigip['Management.Partition'].get_partition_list partitions.each do |partition| set the active partition to query partitions = bigip['Management.Partition'].set_active_partition(partition['partition_name']) puts ('' * 5) + " {partition['partition_name']} " + ('' *5) puts grab a list of pools and stuff the array into a variable pools = bigip['LocalLB.Pool'].get_list.sort pool_active_members = bigip['LocalLB.Pool'].get_active_member_count(pools) [ pools, pool_active_members ].transpose.each do |pool| puts "{pool[0]} - {pool[1]} available members" end puts end
- George_Watkins_Historic F5 AccountI forgot to add the output. If you execute that script, your output will look like this:
f5-test-linux examples % ./report-down-pools.rb 10.0.0.1 admin admin Common test_http_pool - 0 available members ftp_pool - 0 available members laptop-iis - 0 available members ntp_pool - 0 available members p.test_local_dns - 2 available membersp.test_249_http - 1 available members ssh_pool - 0 available members ubuntu_http_pool - 0 available members
puts "{pool[0]} has ZERO available members" if pool[1] == 0
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