FLRT help: Scripting help

Fix Level Recommendation Tool help

Scripting help

FLRT allows administrators of IBM systems to monitor recommendations and assist in service planning. For AIX only, FLRT supports the ability to create a script, running on your machine, that can periodically query FLRT online for recommended updates. The documentation, commands and sample script provided on this page apply to the AIX operating system only.

The sample scripts on this page have been updated to reflect the changes made to the latest release of FLRT. If you currently use a script, refer to the sample scripts below for changes you might need to make to your existing script.

Getting started

To take advantage of the FLRT scripting capabilities, use an HTTP retrieval program, such as wget, to query FLRT for the recommended software levels for your machine.

Make sure your machine has network access to http://www14.software.ibm.com/webapp/set2/flrt/query.

Write a script to query FLRT by reading the FLRT scripting documentation listed below. Or, start with one of the sample ksh scripts provided on this page.

The scripts provided are sample scripts only. You must create your own script based on your environment. If you want to use one of the script samples as a starting point, please modify it to suit the needs of your machine. Comment out sections for software that is not running on your machine. Place your script in a directory where execution will have write authority so that it can create temporary files for processing.

Scripting documentation

Two example scripts are provided. The first allows inventory collection from multiple partitions. It uses ssh to pull version information for operating system, VIOS and other products.

When the script is called, use the host names of the AIX partitions as parameters. Use the vios: prefix if the partition is VIOS type.

# ./flrt_multi_inv.ksh ipv4-072 vios:ipv4-071 ipv4-073
reportname~FLRT Report 03 Apr 2013 01:54:33 PM
system.mtm~9133-55A
system.fw~SF240_259~release~2009.01.01~eosps~2099.09.09
system.fw~SF240_259~update~SF240_418~release~2012.11.19~eosps~2099.09.09
ipv4-072.aix~7100-00-03~release~2011.05.12~eosps~2013.09.10
ipv4-072.aix~7100-00-03~update~7100-00-08~release~2012.12.12~eosps~2013.09.10
ipv4-072.aix~7100-00-03~upgrade~7100-02-01~release~2012.11.09~eosps~2015.11.09
ipv4-071.vios~2.2.2.1~release~2012.11.09
ipv4-071.vios~2.2.2.1~fix VIOS_2.2.2.1_IV31624.121114
ipv4-071.vios~2.2.2.1~fix VIOS_2.2.2.1_IV32091.121116
ipv4-073.austin.ibm.com.aix~6100-05-01~release~2010.04.24~eosps~2012.07.18
ipv4-073.austin.ibm.com.aix~6100-05-01~update~6100-05-09~release~2012.07.18~eosps~2012.07.18
ipv4-073.austin.ibm.com.aix~6100-05-01~upgrade~6100-08-01~release~2012.11.09~eosps~2015.11.09
ipv4-073.austin.ibm.com.gpfs~3.4.0.6~release~2011.06.02
ipv4-073.austin.ibm.com.gpfs~3.4.0.6~update~3.4.0.20~release~2013.03.11

The second script uses an inventory file that was saved from the FLRT web page. Here is an example of a saved inventory file:

# cat sample.inventory.txt
reportname=Sample Inventory for FLRT
mtm=9133-55A
fw=SF240_259
p1.parnm=ipv4-071
p1.os=vios
p1.vios=2.2.2.1
p2.parnm=ipv4-073.austin.ibm.com
p2.os=aix
p2.aix=6100-05-01-1016
p2.gpfs=3.4.0.6
p3.parnm=ipv4-072
p3.os=aix
p3.aix=7100-00-03-1115

And here is an example of the output using that inventory:

# ./flrt_inventory.ksh sample.inventory.txt
reportname~Sample Inventory for FLRT
system.mtm~9133-55A
system.fw~SF240_259~release~2009.01.01~eosps~2099.09.09
system.fw~SF240_259~update~SF240_418~release~2012.11.19~eosps~2099.09.09
ipv4-071.vios~2.2.2.1~release~2012.11.09
ipv4-071.vios~2.2.2.1~fix VIOS_2.2.2.1_IV31624.121114
ipv4-071.vios~2.2.2.1~fix VIOS_2.2.2.1_IV32091.121116
ipv4-073.austin.ibm.com.aix~6100-05-01~release~2010.04.24~eosps~2012.07.18
ipv4-073.austin.ibm.com.aix~6100-05-01~update~6100-05-09~release~2012.07.18~eosps~2012.07.18
ipv4-073.austin.ibm.com.aix~6100-05-01~upgrade~6100-08-01~release~2012.11.09~eosps~2015.11.09
ipv4-073.austin.ibm.com.gpfs~3.4.0.6~release~2011.06.02
ipv4-073.austin.ibm.com.gpfs~3.4.0.6~update~3.4.0.20~release~2013.03.11
ipv4-072.aix~7100-00-03~release~2011.05.12~eosps~2013.09.10
ipv4-072.aix~7100-00-03~update~7100-00-08~release~2012.12.12~eosps~2013.09.10
ipv4-072.aix~7100-00-03~upgrade~7100-02-01~release~2012.11.09~eosps~2015.11.09

Sample scripts (Use the Feedback link to suggest improvements.)

Sample script 1

This sample script collects inventory from multiple partitions.


#/bin/ksh
# Sample script using wget to gather product versions and query FLRT.
# This current sample script provides commands for gathering MTM,
# AIX version, and System Firmware.
#
# The rest of the product queries are samples which are commented out,
# and have sample values hardcoded, to show sample output.
#
# Please provide additional samples through the feedback button at:
# http://www14.software.ibm.com/webapp/set2/sas/f/flrt/scripting.html

################################################################################
getHost() {
HOSTNAME="";
if [[ "$1" = "localhost" ]]
then
HOSTNAME=`hostname`
else
HOSTNAME=`ssh $1 'hostname'`
fi
}

################################################################################
getMTM() {
# Determine the System Model
if [[ "$1" = "localhost" ]]
then
MTMVALUE=`prtconf | grep "System Model" | cut -f 2 -d ,`
else
MTMVALUE=`ssh $1 'prtconf | grep "System Model" | cut -f 2 -d ,'`
fi
}

################################################################################
getMHZ() {
# MHZ - processor speed.
if [[ "$1" = "localhost" ]]
then
MHZVALUE=`prtconf | grep "Processor Clock Speed" | cut -f4 -d " "`
else
MHZVALUE=`ssh $1 'prtconf | grep "Processor Clock Speed" | cut -f4 -d " "'`
fi
}

################################################################################
getAIX() {
# AIX service pack level.
if [[ "$1" = "localhost" ]]
then
AIXv=`oslevel -s`
else
AIXv=`ssh $1 'oslevel -s 2>/dev/null'`
fi
if [[ -z "$AIXv" ]]
then
AIXVALUE=""
else
AIXVALUE=$AIXv
fi
}

################################################################################
getFW() {
# System firmware (booted) version
if [[ "$1" = "localhost" ]]
then
SFIRMWAREVALUE=`lsmcode -r system | cut -f1 -d " " | cut -f2 -d":"`
else
SFIRMWAREVALUE=`ssh $1 'lsmcode -r system | cut -f1 -d " " | cut -f2 -d":"'`
fi
}

################################################################################
getVIOS() {
if [[ "$1" = "localhost" ]]
then
VIOSv=`ioslevel 2>/dev/null`
else
VIOSv=`ssh -o PasswordAuthentication=no padmin@$1 'ioscli ioslevel'|cut -f1 -d'-'` > /dev/null 2>&1
fi
if [[ -z "$VIOSv" ]]
then
VIOSVALUE=""
else
VIOSVALUE=$VIOSv
fi
}

################################################################################
getHACMP() {
#HACMP version
if [[ "$1" = "localhost" ]]
then
HACMPv=`lslpp -L cluster.es.server.rte 2>/dev/null | grep cluster.es.server.rte | cut -f3 -d":"`
else
HACMPv=`ssh $1 'lslpp -L cluster.es.server.rte 2>/dev/null | grep cluster.es.server.rte | cut -f3 -d":"'`
#BRAD - hardcode
HACMPv=5.3
fi
if [[ -z "$HACMPv" ]]
then
HACMPVALUE=""
else
HACMPVALUE=$HACMPv
fi
}

################################################################################
getGPFS() {
#GPFS version
if [[ "$1" = "localhost" ]]
then
GPFSv=`lslpp -Lc gpfs.base 2>/dev/null | grep gpfs.base | cut -f3 -d":"`
else
GPFSv=`ssh $1 'lslpp -Lc gpfs.base 2>/dev/null | grep gpfs.base | cut -f3 -d":"'`
fi
if [[ -z "$GPFSv" ]]
then
GPFSVALUE=""
else
GPFSVALUE=$GPFSv
fi
}

################################################################################
getCSM() {
if [[ "$1" = "localhost" ]]
then
CSMv=`lslpp -Lc csm.client 2>/dev/null | grep csm.client | cut -f3 -d":"`
else
CSMv=`ssh $1 'lslpp -Lc csm.client 2>/dev/null | grep csm.client | cut -f3 -d":"'`
fi
if [[ -z "$CSMv" ]]
then
CSMVALUE=""
else
CSMVALUE=$CSMv
fi
}

################################################################################
getHMC() {
# HMC version requires a call to the HMC box. Using ssh is one way to do this.
# This requires setup of ssh which is not discussed here.
if [[ -z "$HMC_USER" ]]
then
HMCVALUE=""
else
HMC_OUTPUT=`ssh -l $HMC_USER $HMC_HOST lshmc -V > hmc.out`
HMC_VERSION=`grep -i version hmc.out | grep -v base_version| cut -f 3 -d " "`
HMC_RELEASE=`grep -i release hmc.out | cut -f 3 -d " "`
HMCVALUE=$HMC_VERSION.$HMC_RELEASE
fi
}


################################################################################
processAIX() {
# Parse AIX results
AIXVer=`grep ^aix getflrt.rpt|cut -f2 -d' '`
if [[ -z $AIXVer ]]
then
#no AIX results returned
AIXVer=none
else
AIXRes=`grep ^aix getflrt.rpt|cut -f3- -d' '`
if [[ $AIXRes == "ok" ]]
then
echo " AIX Version installed: $AIXVer - OK"
else
echo "** AIX Version installed: $AIXVer - Lower than recommended"
AIXRec=`grep "The current recommended SP level for this AIX TL is" getflrt.rpt`
echo \\t$AIXRec
fi
echo
fi
}

################################################################################
processFW() {
# Parse System Firmware results
FWVer=`grep ^fw getflrt.rpt|cut -f2 -d' '`
if [[ -z $FWVer ]]
then
#no firmware results returned
FWVer=none
else
FWRes=`grep ^fw getflrt.rpt|cut -f3 -d' '`
FWRec=`grep ^fw getflrt.rpt|cut -f4 -d' '`
if [[ $FWRes == "ok" ]]
then
echo " System Firmware version: $FWVer - OK"
else
echo "** System Firmware version: $FWVer - Upgrade recommended"
echo \\tRecommended version: $FWRec
fi
echo
fi
}

################################################################################
processVIOS() {
# Parse VIOS results
VIVer=`grep ^vios getflrt.rpt|cut -f2 -d' '`
if [[ -z $VIVer ]]
then
#no vios results returned
VIVer=none
else
VIRes=`grep ^vios getflrt.rpt|cut -f3 -d' '`
VIRec=`grep ^vios getflrt.rpt|cut -f4 -d' '`
if [[ $VIRes == "ok" ]]
then
echo " VIOS version: $VIVer - OK"
else
echo "** VIOS version: $VIVer - Upgrade recommended"
echo \\tRecommended version: $VIRec
fi
echo
fi
}

################################################################################
processHACMP() {
# Parse HACMP results
HAVer=`grep ^hacmp getflrt.rpt|cut -f2 -d' '`
if [[ -z $HAVer ]]
then
#no hacmp results returned
HAVer=none
else
HARes=`grep ^hacmp getflrt.rpt|cut -f3 -d' '`
HARec=`grep ^hacmp getflrt.rpt|cut -f4 -d' '`
if [[ $HARes == "ok" ]]
then
echo " HACMP version: $HAVer - OK"
else
echo "** HACMP version: $HAVer - Unsupported"
HAMessage=`grep ^hacmp getflrt.rpt`
echo \\tMessage: $HAMessage
fi
echo
fi
}

################################################################################
processGPFS() {
# Parse GPFS results
GPFSVer=`grep ^gpfs getflrt.rpt|cut -f2 -d' '`
if [[ -z $GPFSVer ]]
then
#no GPFS results returned
GPFSVer=none
else
GPFSRes=`grep ^gpfs getflrt.rpt|cut -f3 -d' '`
GPFSRec=`grep ^gpfs getflrt.rpt|cut -f4 -d' '`
if [[ $GPFSRes == "ok" ]]
then
echo " GPFS version: $GPFSVer - OK"
else
echo "** GPFS version: $GPFSVer - Upgrade recommended"
echo \\tRecommended version: $GPFSRec
fi
echo
fi
}

################################################################################
processCSM() {
# Parse CSM results
CSVer=`grep ^csm getflrt.rpt|cut -f2 -d' '`
if [[ -z $CSVer ]]
then
#no CSM results returned
CSVer=none
else
CSRes=`grep ^csm getflrt.rpt|cut -f3 -d' '`
CSRec=`grep ^csm getflrt.rpt|cut -f4 -d' '`
if [[ $CSRes == "ok" ]]
then
echo " Cluster Systems Management version: $CSVer - OK"
else
echo "** Cluster Systems Management version: $CSVer - Upgrade recommended"
echo \\tRecommended version: $CSRec
fi
echo
fi
}

################################################################################
processHMC() {
# Parse HMC results
HMVer=`grep ^hmc getflrt.rpt|cut -f2 -d' '`
if [[ -z $HMVer ]]
then
#no hmc results returned
HMVer=none
else
HMRes=`grep ^hmc getflrt.rpt|cut -f3 -d' '`
HMRec=`grep ^hmc getflrt.rpt|cut -f4 -d' '`
if [[ $HMRes == "ok" ]]
then
echo " HMC version: $HMVer - OK"
else
echo "** HMC version: $HMVer - Upgrade recommended"
echo \\tRecommended version: $HMRec
fi
echo
fi
}


################################################################################
################################################################################
# MAIN
################################################################################
################################################################################

FLRTURL="http://www14.software.ibm.com/webapp/set2/flrt"

HMC_USER=hscroot
HMC_HOST=9.3.108.4

WGET=`which wget`

if [[ -z $WGET ]]
then
echo "wget not found, quitting"
exit 1
fi

TR=/usr/bin/tr
format="text"
hostlist=""
ts=`date +"%d %h %Y %r"`
name="FLRT Report $ts"
typeset -i system_number
system_number=0

############################################################
# process arguments
############################################################
while [ $# -gt 0 ]
do
case "$1" in
-f) #format
shift
format=$1
;;
*) #host name
hostlist="$hostlist $1"
;;
esac
shift
done

if [[ $hostlist = "" ]]; then
hostlist="localhost"
fi

if [[ $format != "html" ]] && [[ $format != "btext" ]] && [[ $format != "text" ]]; then
echo "Error: format must be html, text, or btext"
exit 1
fi

# need temporary files to hold inventory info
TMP=/tmp/tmp_inventory_`date +%s`_$$
TMPF="/tmp/testQuery$$"

trap '/bin/rm -f $TMP $TMPF' 0
trap "exit 2" 1 2 3 13 15

echo "reportname=$name" > $TMP

# gather information for inventory file

first_host="true"
for host in `echo $hostlist`
do
#check for special vios handling
isvios=`echo $host|cut -f1 -d':'`
if [[ "$isvios" = "vios" ]]; then # vios processing
realhost=`echo $host|cut -f2 -d':'`
host=$realhost
getVIOS $host
AIXVALUE=""
else
getAIX $host
VIOSVALUE=""
fi
getHost $host
#getAIX $host
if [[ -z $AIXVALUE && -z $VIOSVALUE ]]
then
# Non-AIX systems aren't going to support most of the commands we'll be using
echo $HOSTNAME does not appear to be an AIX or VIOS partition, cannot continue processing this partition
continue;
else
let system_number+=1
# gather data for host
#getMHZ $host
#getHMC $host
#getVIOS $host
#getHACMP $host
getGPFS $host
#getCSM $host
# data collected, write to inventory file
if [[ $first_host = "true" ]]; then
getMTM $host
getFW $host
first_host="false"
echo mtm=$MTMVALUE >> $TMP
echo fw=$SFIRMWAREVALUE >> $TMP
fi
echo p$system_number.parnm=$HOSTNAME >> $TMP
echo p$system_number.os=aix >> $TMP
if [[ $AIXVALUE != "" ]]; then
echo p$system_number.aix=$AIXVALUE >> $TMP
fi
if [[ $HACMPVALUE != "" ]]; then
echo p$system_number.hacmp=$HACMPVALUE >> $TMP
fi
if [[ $CSMVALUE != "" ]]; then
echo p$system_number.csm=$CSMVALUE >> $TMP
fi
if [[ $VIOSVALUE != "" ]]; then
echo p$system_number.vios=$VIOSVALUE >> $TMP
fi
if [[ $GPFSVALUE != "" ]]; then
echo p$system_number.gpfs=$GPFSVALUE >> $TMP
fi

#$WGET "$FLRTURL/query?format=text&$MHZVALUE$$$HMCVALUE$$$GPFSVALUE$$CSMHAVALUE" -o getflrt.stdout -O getflrt.rpt
#process results
#processAIX
#processFW
#processGPFS
#processHACMP
#processVIOS
#processCSM
fi
done

#echo $TMP
$TR '\n' '&' < ${TMP} > $TMPF
echo "&format=$format" >> $TMPF

URL=${FLRTURL}"/query"
#echo URL $URL

#$WGET -nv -O out --post-file=${TMPF} ${URL}
$WGET -q -O out --post-file=${TMPF} ${URL}

cat out

exit


Sample script 2

This sample script uses an inventory file, saved from the FLRT application, to generate a report.


#/bin/ksh

# Sample script to update preexisting inventory file to FLRT, and
# display the results

if [[ $# -eq 0 ]];then
print "usage: flrt_inventory.ksh [inventory file]"
print " uploads [inventory file] to FLRT, displays results"
exit
fi

WGET=`which wget`

if [[ -z $WGET ]]
then
echo "wget not found, quitting"
exit 1
fi

FLRTURL="http://www14.software.ibm.com/webapp/set2/flrt"

TR=/usr/bin/tr
URL=${FLRTURL}"/query"
format="text"
TMPF="/tmp/testQuery$$"

trap '/bin/rm -f $TMP $TMPF' 0
trap "exit 2" 1 2 3 13 15

$TR '\n' '&' < ${1} > $TMPF
echo "&format=$format" >> $TMPF

$WGET -q -O out --post-file=${TMPF} ${URL}

cat out


Syntax details for writing your own script

HTTP GET URL: http://www14.software.ibm.com/webapp/set2/flrt/query


Product codes

For the complete list of codes for all supported products, refer to FLRT products and codes. The entry in the Codes column represents the HTTP attribute to use in the script for the indicated product.


Values for HTTP attributes

The following list shows samples of the attribute values to use with the HTTP attribute codes for some of the products supported in FLRT.

ProductHTTP attributeSample value
AIXsseq6u9999-99-99 or 9999-99-CSP
General Parallel File Systemsg6mspversion (for example, 3.3.0)
Hardware Management Consoleswg20version (for example, 6.1.2)
PowerHAsgl4g4version (for example, 5.4.1.0)
Parallel Environmentsg6mu7version (for example, 4.2)
Parallel ESSLsg4pslversion (for example, 3.3.0)
Virtual I/O Serversgs8jyversion (for example, 2.1.3)

The following list entails HTTP attributes that are used for product family or non-product items, along with sample values for those attributes.

HTTP attributeSample value
mtm9999-XXX (for example, 9119-FHA or 8233-E8B)
delima delimiter character used for returning results (default=' ')
disk*DS9999 (for example, DS5200)
dsfwdisk firmware version (for example, 7.60.x)
fwAA999_999 or 999_999 (for example, AM720_064 or 720_064)
formattext | btext | html (default='text')
ghzcpu speed in decimal gigahertz (for example, 1.9)

*For FLRT to report on more than one disk system for the same partition or host, disk product codes must be modified with a suffix. These suffixes are used by FLRT to associate disk software data in the HTTP request with disk hardware data. The suffixes are of the form "_g9" where "9" represents a positive integer. Parameter names for versions of disk software components must have the same suffix as the parameter name of the disk hardware version that they are associated with. Any positive integer may be used as long as associated product versions use the same integer, and unassociated product versions use distinct integers.

For example, suppose that a host contains a DS5100 disk system running controller firmware 7.50.x, and a DS4500 system running 6.23.x firmware. Valid parameters corresponding to this configuration would be:

disk_g3=DS5100 dsfw_g3=7.50.x disk_g1=DS4500 dsfw_g1=6.23.x


Example of wget command:

Note that although the following command wraps in the browser, there are no spaces in the URL part of the command:

./wget "http://www14.software.ibm.com/webapp/set2/flrt/query?format=text
    &mtm=9117-570&ghz=4.7&sseq6u=5300-04-03&fw=SF240_219"

Translate this page

FLRT suggestion box

Survey to improve FLRT

We would appreciate your suggestions to improve FLRT. Please follow the link below to answer a few questions and also tell us what you'd like to see added to or changed in FLRT.


Translate this page