XIV Storagepool website overview

Within this post you will find a script I wrote with a colleague to create an overview of storage pools and snapshots with total/used capacity assigned via the xcli. It will create webpages for all of the XIVs you have.

Perfect usage for managers and sort of people that do not need to have access to the XIV itself 🙂

#!/bin/ksh

# XIV data collector

TODAY=`date +%Y-%m-%d`

export XIV_XCLIUSER=<yoursecureuser>
export XIV_XCLIPASSWORD=<yoursecurepassword>

if [ $# -ne 1 ]; then
echo “Illegal arguments.”
echo “”
echo “Usage: xiv_poolmon.sh {XIV_NAME}”
fi

OUTPUTFILE=”/var/www/htdocs/xiv/$1.html”

STGP_NAME=`/opt/XIVGUI/xcli -s -m $1 pool_list |tail +2 | cut -d “,” -f 1| sed ‘s/ /_/g’|tr ‘\n’ ‘ ‘`
STGP_TOTAL=`/opt/XIVGUI/xcli -s -m $1 pool_list |tail +2 | cut -d “,” -f 3| sed ‘s/ /_/g’|tr ‘\n’ ‘ ‘`
SNAPSHOT_TOTAL=`/opt/XIVGUI/xcli -s -m $1 pool_list |tail +2 | cut -d “,” -f 4| sed ‘s/ /_/g’|tr ‘\n’ ‘ ‘`
STGP_USED=`/opt/XIVGUI/xcli -s -m $1 pool_list |tail +2 | cut -d “,” -f 6| sed ‘s/ /_/g’|tr ‘\n’ ‘ ‘`
SNAPSHOT_USED=`/opt/XIVGUI/xcli -s -m $1 pool_list |tail +2 | cut -d “,” -f 7| sed ‘s/ /_/g’|tr ‘\n’ ‘ ‘`

set -A STGP_NAME `echo $STGP_NAME` #1
set -A STGP_TOTAL `echo $STGP_TOTAL` #3
set -A SNAPSHOT_TOTAL `echo $SNAPSHOT_TOTAL` #4
set -A STGP_USED `echo $STGP_USED` #6
set -A SNAPSHOT_USED `echo $SNAPSHOT_USED` #7

TIMESTAMP=`date`

rm $OUTPUTFILE

exec 1>>$OUTPUTFILE
exec 2>&1

echo “<!doctype html public \”-//w3c//dtd html 4.0 transitional//en\”>”
echo “<html>”
echo “<head>”
echo ”   <meta http-equiv=\”Content-Type\” content=\”text/html; charset=iso-8859-1\”>”
echo ”   <meta http-equiv=\”refresh\” content=\”300; url=/xiv/$1.html\”>”
echo ”   <meta name=\”GENERATOR\” content=\”Mozilla/4.7 [en] (Win98; I) [Netscape]\”>”
echo ”   <meta name=\”Author\” content=\”billy boy\”>”
echo ”   <meta name=\”Description\” content=\”Computacenter IS SAP Basis\”>”
echo ”   <title>XIV STGP MONITOR $1</title>”
echo “</head>”
echo “<body text=#000000 link=#000000 vlink=#000000 alink=#000000 bgcolor=$BGCOLOR>”
echo “”
echo “<font face=Courier,Tahoma,Verdana,Arial size=4>”
echo “<table border=1>”
echo “<th>”
echo “<tr>”
echo “<td>STGP NAME</td><td>STGP total Size</td><td>STGP used in GB</td><td>Snapshot size in GB</td><td>Snapshot used</td>”
echo “</tr>”

tLen=${#STGP_NAME[@]}
i=0
while [[ $i -lt $tLen ]]
do

echo “<tr>”
echo “<td>${STGP_NAME[$i]}</td><td>${STGP_TOTAL[$i]}</td><td>${STGP_USED[$i]}</td><td>${SNAPSHOT_TOTAL[$i]}</td><td>${SNAPSHOT_USED[$i]}</td>”| sed ‘s/”//g’
echo “</tr>”
let i=$i+1
echo “\n”;
done
echo “</th>”
echo “</table>”

echo “$TIMESTAMP”
echo “</body>”
echo “</html>”

Hope it does help some of you.

Advertisements
This entry was posted in aix, storage and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s