How to get paging space and memory for all lpars ?

rammaghenthar
rammaghenthar used Ask the Experts™
on
Hi
                In our Implementation project we have around 450 lpars in around 12 managed systems configured with 3 HMCs. We are not alllowed to use ssh keygen to enable passwdless authentication for security reason. We need to get  paging space and memory allocated to all lpars for every week. Currently we are manually logging to all lpars and getting the memory and paging space information took around 30 hours. We need  answer to following question.
Do we able to get paging space through HMC ? as per my understanding it is not possible .if yes do we able to get any script to run on HMC and  get  paging space and memory size .
The output should show HMC IP, Managed system,lpar name and paging size and memory size.


2. Suppose if we could not use HMC . We have NIM server through which we can login to lpar and get paging space and memory info.
We need a script  which will get lparname and passwd from a file and login to lpar then get paging space and memory size  AND IFCONFIG OUTPUT of lpar and put it to output file.
Output file should have lpar name and paging space and memory size. (if the output file shows frame name , lparname and IP configured(ifconfig output) paging space and memory  it will be helpfull) It will give relief from 40 hours of manual painfull work.
ANY HELP PLEASE.
Manual passwd entry method also oK because we are using same passwd for most of the lpars
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Author

Commented:
Excel output file format is very helpfull for us
Most Valuable Expert 2013
Top Expert 2013

Commented:
Hi again, rammaghentharji,

1) You're right, it's not possible to get the LPARs' page space information by querying the HMC,
because the HMC doesn't know anything about LPAR paging.

2) Of course you could use a script to get the required information. But since you don't have the
ability to login using ssh keys, this would be a tedious thing, as you have already noticed.

Instead, I'd suggest that we do the following:

We create a script and transfer it once to each of the LPARs (maybe via scp or FTP).
The script will gather the required info regularly (via crontab) and transfer it to your NIM server
using FTP.
Here, in turn, we will run a small second script which will take the transferred files and form a
single report out of them.

Please tell me if you'd like to proceed that way.

I'll try to work out 'model' versions of the two scripts tomorrow. Please try them out.

Note that the script will not find the name of the managed system, but it will find a 'systemid',
which is essentially the serial number of the managed system. If you like, I can write a piece of
code which will translate the systemid to a managed system name, but for that to work we'll need a
file containing both in the form "systemid managed_system_name", one pair per line.

A systemid looks like this:  IBM,0739FD25D

You get it by issuing 'lsattr -El sys0' at an LPAR.

CU tomorrow

wmp







Most Valuable Expert 2013
Top Expert 2013
Commented:
Hi again,
I'll attach two scripts for you.
Some things to consider -
script1
It must be deployed to every LPAR and should be run regularly, either by cron or manually. It will collect the desired information, create one file per LPAR and send it via FTP to a central server (your NIM server). The file created will look like this -
SYSTEMID;LPAR;MEMORY;PAGING;RUNDATE
"IBM,0123456789";"lpar1";8192;20480;2009-07-20

I called the FTP target host "your_nim_host", the user is "your_nim_user", the password is "your_nim_passwd". Please customize!  
The name of the outputfile takes the form lparname.pag_mem.YYYY-MM-DD. Please leave as is, if possible.
/tmp is used as an intermediate directory.
The FTP target directory is /var/lparinfo/pag_mem. Change name and location if you like (in both scripts!). Don't forget to create the directory and make it accessible/writeable to "your_nim_user"!
script2

Once all files are created/transferred, run this script at your NIM host. It will take the transferred files located in /var/lparinfo/pag_mem and create a single file in .csv format.
The target directory for this report is /var/lparinfo/reports. Change it if you like, and as above, don't forget to create the directory and make it accessible/writeable to "your_nim_user"!
The filename of the report takes the form report.pag_mem.YYYY-MM-DD.csv Don't change, if possible.
Once completed, the script2 will have changed the processed filenames to lparname.pag_mem.YYYY-MM-DD.previous, to avoid processing them multiple times.
As for ifconfig - its output doesn't really fit into the above scheme. If you wish, I could write a short script to create ifconfig output an send it over to the central server - but I fear I won't be able to create a nice report out of it.
Anyway, look at the first two scripts and tell me what yout think.
wmp
 

SCRIPT1
 
#!/bin/ksh
nimhost="your_nim_host"
nim_user="your_nim_user"
nim_passwd="your_nim_passwd"
rundate=$(date +"%Y-%m-%d")
outdir="/var/lparinfo/pag_mem"
#
# Collect data
#
sysid=$(lsattr -El sys0 | grep "systemid" | awk '{print $2}')
lpar=$(lparstat -i | grep "Partition Name" |awk '{print $4}')
mem=$(lparstat -i | grep "Online Memory" |awk '{print $4}')
pag=$(
 size=0
 lsps -a | grep -v "Page" | while read line
  do
   set $line
   size=$((${4%%MB} + $size))
  done
 echo $size
     )
outfile="${lpar}.pag_mem.${rundate}"
echo "SYSTEMID;LPAR;MEMORY;PAGING;RUNDATE" > /tmp/$outfile
echo "\"$sysid\";\"$lpar\";$mem;$pag;$rundate" >> /tmp/$outfile
#
# Transfer it
#
ftp -n $nimhost >/dev/null <<EOF
  user $nim_user $nim_passwd
  lcd /tmp
  cd $outdir
  bin
  put $outfile
  quit
EOF
rm /tmp/$outfile 2>/dev/null
exit
 
SCRIPT2
 
#!/bin/ksh
rundate=$(date +"%Y-%m-%d")
datadir="/var/lparinfo/pag_mem"
reportdir="/var/lparinfo/reports"
reportfile="${reportdir}/report.pag_mem.${rundate}.csv"
cd $datadir
echo "\"PAGING/MEMORY REPORT as of ${rundate}\"" > $reportfile
echo "\"SYSTEMID\";\"LPAR\";\"MEMORY\";\"PAGING\";\"RUNDATE\"" >> $reportfile
ls -1 | grep "pag_mem" | grep -v "previous" | while read file
 do
  cat $file | tail +2 >> $reportfile
  mv $file ${file}.previous
 done
exit

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial