Informing the IBM Community

Masterclass: how to monitor VIOS vSCSI disk performance

0
(0)

performance level conceptual meter

In my previous article I showed how you can use nmon in VIOS to display the performance statistics of hdisks that are mapped to client LPARs. This is achieved by creating a file which nmon reads and then displays the relevant performance data.

Let’s look at a script I created to automatically generate the file in the format nmon expects (see the end of this article). If you remember, the file has an initial field used to name the row followed by one or more hdisks in a comma-separated list.

I have created two versions of this script. A generic version which should suit all vSCSI environments and a customised version that expects the virtual target devices mapped to the client LPARs to use the LPARNAME_Lnn and LPARNAME_Xnn naming convention.

In my test environments I also have virtual CD drives and virtual logging devices mapped. The virtual CD drives are used to provide access to the ISO images stored in the Virtual Media Repository. The virtual log devices are used by PowerSC Trusted Logging to store audit and syslog data on the VIOS instead of the client AIX LPARs.

So my script ignores the virtual cd and virtual log devices. I have a line which excludes *_cd, *_dvd and vtlog* devices. Let’s take a look at the line which does the bulk of the work:

awk '/VTD/ { print $2 }' $VTDS|grep -v -e vtopt -e cd_ -e _cd -e _dvd -e vtlog|sed -e 's/_L.*//' -e 's/_X.*//'|sort|uniq >$TMPFILE

Basically, this line does the following:

●    Selects the lines with VTD from file /tmp/vtds
●    If any of the VTD lines contain
vtopt
cd_
_cd
_dvd
then exclude these entries.
●    Then select the lines with _L or _X in them and create a unique sorted list into a temporary file.

This is a little complicated but you can use this to customise this line for your environment.

Adding the script to VIOS

Remember that VIOS is a restricted environment within AIX so you cannot execute scripts within the VIOS environment. To execute a script you need to break out of VIOS mode and into AIX mode by entering:

oem_setup_env

Entering the exit command will return you to VIOS mode.

Once you are in AIX mode you can create the script and execute it. Carry out the following steps in AIX mode but first highlight and copy the lines in the attached script:
●    oem_setup_env
●    vi lsnmondisks.ksh <enter>
●    i
●    Paste the copied script in to your terminal session. If you are using Putty just press the right mouse button
●    <ESC>:wq<Enter>
●    chmod +x lsnmondisks.ksh

That’s it.

Running the script

As mentioned before, you can only run scripts in AIX mode so make sure you’ve entered oem_setup_env. Type the following:

./lsnmondisks.ksh

You must enter the ./ in front of the script name.

The script will now execute and will display information as it executes. The script can take between one and 20 seconds to complete depending on a number of factors. That’s computing for you.

Displaying the data in nmon

You now have two choices where you run nmon, either in AIX mode or in VIOS mode. There is no difference so it’s up to you. The information at the end of the script output shows the command you need to run, so copy and paste it in your terminal session.

Once the nmon first screen is displayed, simply press g to display the performance stats for the groups of hdisks on your VIOS.

nmon-g-screen

The display above shows that we have three LPARs.

●    LPAR1 has 6 hdisks mapped
●    LPAR2 has 5 hdisks mapped
●    LPAR3 has 8 hdisks mapped

The screen will refresh on its own showing you the utilisation of the hdisks mapped to each LPAR.

Press q to quit out of nmon.

Additional scripting for nmon -g

In my next article, I will discuss two more scripts. One to gather hdisk information for your LPARs with no naming convention dependency. I’ll also provide a script which allows you to look at the individual disks for a single LPAR rather than for groups of hdisks.

lsnmondisks.ksh script

#!/bin/ksh
#
# Author:    Glenn Robinson
# Script:    lsnmondisks.ksh
#
# Create a list of hdisks per LPAR to use with nmon -g function
#
# Usage:    ./lsnmondisks.ksh
#
 
set +x
exec 2>/dev/null
 
FILE=/tmp/lpar.hdisks
TMPFILE=/tmp/LPARS
VTDS=/tmp/vtds
HDISKS=""
ULINE="_"
 
clear
# Remove any existing files
rm $FILE $TMPFILE $VTDS >/dev/null
 
# Create a list of the LPARs
# Filter out virtual cd, dvd and virtual log devices
echo "Generating mapping list for all LPARs, please be patient..."
/usr/ios/cli/ioscli lsmap -all -field vtd backing> $VTDS
awk '/VTD/ { print $2 }' $VTDS|grep -v -e vtopt -e cd_ -e _cd -e _dvd -e vtlog|sed -e 's/_L.*//' -e 's/_X.*//'|sort|uniq >$TMPFILE
 
# Determine hdisks for each LPAR and write to file
while read LPAR
do
        echo "Discovering hdisks for LPAR $LPAR"
        HDISKS=""
        while read LSMAP
        do
                if [ "$LSMAP" != "" ]                   ## Ignore blank lines
                then
                        ULPAR=$LPAR$ULINE                                ## Make sure LPAR name is unique
                        if [[ $LSMAP == VTD* && $LSMAP == *$ULPAR* ]]    ## Entry found for this LPAR
                        then
                                read LSMAP                              ## Read next record for hdisk
 
## Make sure the list of hdisks is formatted correctly
                                if [ "$HDISKS" == "" ]
                                then
                                        HDISKS=$(echo $LSMAP|awk '{ print $3 }')
                                else
                                        HDISKS=$HDISKS","$(echo $LSMAP|awk '{ print $3 }')
                                fi
                        fi
                fi
        done<$VTDS
echo "$LPAR $HDISKS">>$FILE
done<$TMPFILE
 
rm $TMPFILE $VTDS >/dev/null
 
echo "\n\nFile: "$FILE" is now populated with LPAR hdisk information\n\n"
echo "Execute: nmon -g "$FILE
echo "At the nmon display press g to display the disk stats per LPAR"

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.