#!/usr/bin/perl use strict; use warnings; sub trim($); sub ltrim($); sub rtrim($); my $pduserid; my $pdpasswd; my @auth_svrs; my $numAuthSvrs; my $authsvr; my $junk; my $host; if (@ARGV == 2) { $pduserid = $ARGV[0]; $pdpasswd = $ARGV[1]; @auth_svrs = `pdadmin -a $pduserid -p $pdpasswd server list | grep ivacld | sort`; $numAuthSvrs = @auth_svrs; if ($numAuthSvrs > 0) { print("There are $numAuthSvrs authorization servers reported for this TAM installation.\n\n"); foreach $authsvr (@auth_svrs) { chomp($authsvr); ($junk, $host) = split(/-/, $authsvr); $host = trim($host); print("[".trim($authsvr)."] "); `nc -w 2 -v -z $host 7136`; } } else { print("There are no configured authorization servers being reported by TAM.\n"); } } else { print("This script requires two parameters - TAM id and TAM passsword, for example:\n"); print("perl pd_list_authsvrs.pl sec_master password\n"); } # trim functions from www.somacon.com/p114.php # Perl trim function to remove whitespace from the start and end of the string sub trim($) { my $string = shift; $string =~ s/^\s+//; $string =~ s/\s+$//; return $string; } # Left trim function to remove leading whitespace sub ltrim($) { my $string = shift; $string =~ s/^\s+//; return $string; } # Right trim function to remove trailing whitespace sub rtrim($) { my $string = shift; $string =~ s/\s+$//; return $string; }