Solved

from HMC How to get cpu and memory information of lpar ?

Posted on 2009-07-03
4
1,688 Views
Last Modified: 2013-11-17
Hi
          We are working on implementation project. Due to security reason SSH passwdless mechanism is not allowed here. We have 7 managed systems connected to HMC1 and 10 managed systems connected to another HMC . Each managed systems have some 40 lpars.  Every week I need to collect CPU and memory allocated to all lpars information.  I need a script to fullfill following.
1. The script need to collect all Managed systems from HMC .
2. Then  need to collect list of lpars  available in all managed belong that HMC
3. Then finally need to report CPU and memory resources belong to  all lpars.
Any help please. through lsshowres command it is possible I believe.
0
Comment
Question by:rammaghenthar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 2

Author Comment

by:rammaghenthar
ID: 24776125
This is required for planning purposes
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 24777907
Hi again,

sorry for the delay!

Here is the script.

You will notice that with HMC things are a bit complicated
and there is no such command like 'lsshowres'.

Change the line "HMCS= ..." to contain the hostnames of your HMC machines, e.g.
HMCS="hmc1 hmc2".

You're certainly aware that you will have to enter hscroot's password once for each HMC
when runnning the script, since you don't have passwordless access.

Run the script from any Unix machine which is allowed to access the HMCs via ssh.

It will give you a list contaning the information you requested including a header line,
which will be repeated every time the name of a managed system changes.

If you don't like that appearance, or if you'd like to have CSV output
suitable for e.g. MS Excel, please let me know.

Just redirect the script's output, if you'd like to have it in a file:

scriptname > /path/to/outputfile

Have fun!

wmp




#!/bin/ksh
HMCS="hmchost1 hmchost2"
for hmc in $HMCS
do
  ssh "hscroot"@$hmc '
    for sys in $(lssyscfg -r sys -F name)
      do
        printf "%s\n" "---------------------------------------------------------------------------------------"
        printf "%16s %16s %16s %16s %10s %8s\n" "Name of HMC" "Managed System" "LPAR name" "Profile" "CPU-Units" "Memory"
        printf "%s\n" "---------------------------------------------------------------------------------------"
        for line in $(lssyscfg -r lpar -m $sys -F "name,default_profile")
          do
            set -- ${line/,/  }
            lpar=$1
            prof=$2
            lparinfo=$(lssyscfg -r prof -m $sys --filter "lpar_names=$lpar,profile_names=$prof" -F "desired_proc_units desired_mem" )
            set -- $lparinfo
            printf "%16s %16s %16s %16s %10s %8s\n" '$hmc' $sys $lpar $prof $1 $2
          done
      done '
done
exit

Open in new window

0
 
LVL 2

Author Comment

by:rammaghenthar
ID: 24780713
I like to have script output in an excel file format  woolmilkporkji . what I need to do for it ?
0
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 500 total points
ID: 24781100
OK,

see attachment.

The heading is displayed only once.

All fields are separated using ";" (semicolon), strings are surrounded with double quotes ( " " ).

That's all.



#!/bin/ksh
HMCS="hmchost1 hmchost2"
for hmc in $HMCS
do
    ssh "hscroot"@$hmc '
        printf "%s;%s;%s;%s;%s;%s;\n" "\"Name of HMC"\" "\"Managed System"\" "\"LPAR name"\" "\"Profile"\" "\"CPU-Units"\" "\"Memory MB"\"
    for sys in $(lssyscfg -r sys -F name)
      do
        for line in $(lssyscfg -r lpar -m $sys -F "name,default_profile")
          do
            set -- ${line/,/  }
            lpar=$1
            prof=$2
            lparinfo=$(lssyscfg -r prof -m $sys --filter "lpar_names=$lpar,profile_names=$prof" -F "desired_proc_units desired_mem" )
            set -- $lparinfo
            printf "%s;%s;%s;%s;%s;%s;\n" \"'$hmc'\" \"$sys\" \"$lpar\" \"$prof\" $1 $2
          done
      done '
done

Open in new window

0

Featured Post

Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question