If you have a large IBM System p environment with several HMC's it can be challenging to find which HMC manages any given LPAR.
It is usually possible to find out the HMC that manages the LPAR from the actual LPAR using the lsrsrc IBM. Mana geme ntSe rver command (or lsrsrc IBM.MCP on AIX 7), however this has a couple of drawbacks. The biggest drawback is if you are getting paged in the middle of the night because an LPAR just went down, you are obviously not going to be able to login to the LPAR to run this command to find the HMC. Even if the LPAR is up and running the lsrsrc IBM. Mana geme ntSe rver (or lsrsrc IBM.MCP on AIX 7) might not work if the RMC connection to the LPAR isn't working correctly.
$ cat hmcservers.txt testhmc01 testhmc02
./hmcreport.pl hmcservers.txt > hmcreport.html
#!/usr/bin/perl use strict; my ($inputfile, $hmcserver, @systems, $systemline, $system, @lpars, $lpar, $lparline); if ($#ARGV == 0){ $inputfile = $ARGV[0]; }else{ print " You must specify a text input file that contais a list of HMC's as an argument.\n\n" ; exit 2; } open INPUT, " < $inputfile" or die " Unable to open file $inputfile\n" ; print " < HTML> \n< BODY> \n" ; while (< INPUT> ){ $hmcserver = $_; chomp($hmcserver); print " < TABLE bgcolor=\" F0FFF0\" border=\" 3\" > \n" ; print " < tr> < th width=\" 400\" > < h3> < a href=\" https://$hmcserver\" > $hmcserver< /a> < /h3> \n" ; @systems = `ssh -o " BatchMode yes" -q $hmcserver lssyscfg -r sys -F " name,state" | sort`; foreach $systemline (@systems){ chomp ($systemline); if ($systemline =~ /(\S+),Operating/){ $system = $1; print '< center> < table cellpadding=" 2" border=" 2" bordercolor=" #000000" cellspacing=" 0" > '; print " \n< tr> < th bgcolor=\" 00BFFF\" width=\" 350\" > \n" ; print " $system\n" ; print " < /tr> < /th> \n" ; @lpars = `ssh -o " BatchMode yes" -q $hmcserver lssyscfg -m $system -r lpar -F " name,state" | sort`; foreach $lparline (@lpars){ chomp($lparline); if ($lparline =~ /(\S+),Running/){ $lpar = $1; print " < tr> < td bgcolor=\" FFFAFA\" > $lpar< /td> < /tr> " ; } } print " < /center> < /table> \n" ; print " < br/> < br/> " ; } } print " < /table> \n< br/> < br/> " ; } print " < /BODY> \n< /HTML> \n" ;
Courtesy :https://www.ibm.com/developerworks/mydeveloperworks/blogs/brian/entry/aix_finding_your_hmc_the_easy_way11?lang=en
No comments:
Post a Comment