Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Monitoring PSSP conditions

Status
Not open for further replies.
Apr 13, 2004
316
US
Below are three scripts used to check conditions using haemqvar on an SP complex which I have worked on occasionally for the past two weeks. Please feel free to make any changes that you want to. If you aren’t using Perspectives and manually run scripts or however else, maybe this could be used.

It isn’t complete and I am still working on the GetDisks function because it is not looping to the next disk, but that is just minor.

Hope somebody will find it useful.

#cat psspchk.sh
#!/usr/dt/bin/dtksh

GetDisks() {
x=$(grep hdisk /tmp/work.txt)
if [[ $? -eq 0 ]]
then
R=${x#*=}
L=${R%%;*}
yogi=${L##*k}
if [[ $yogi = "*" ]]
then
NodeNum="1 5 7 9 11 13"
for NODE in $NodeNum
do
dsh -w c2f1n${NODE}ex lspv | grep power | grep -iv none > /tmp/disk.work
if [[ -f /tmp/disk.work ]]
then
disks=$(cat /tmp/disk.work | grep "c2f1n${NODE}ex" | awk -F' ' '{print $2}')
for power in $disks
do
sed "s/NodeNum\=\*/NodeNum\=$NODE/" /tmp/work.txt > /tmp/work.txt.tmp
mv /tmp/work.txt.tmp /tmp/work.txt
chop=${power##*k}
sed "s/$yogi/$chop/" /tmp/work.txt > /tmp/work.txt.disk
vars=$(cat /tmp/work.txt.disk)
/usr/sbin/rsct/bin/haemqvar -c "" "$i" "$vars"
done
else
print "BREAK"
break
fi
done
fi
else
return
fi
return
}

PrintDot() {
while :; do
sleep 1
echo ".\c"
done &
PID=$!
}

FStotal() {
for LogVol in $(lsvg -l rootvg | grep -v "N/A" | tail +3l | awk '{print $1}')
do
FileSys=$(df | grep $LogVol | awk '{print $7}')
print "$LogVol ($FileSys)"
/usr/sbin/rsct/bin/haemqvar -c "" "IBM.PSSP.aixos.FS.%totused" "VG=rootvg;LV=$LogVol;NodeNum=*"
print
done
Menu
}

PagSpTotal() {
print "Paging Space"
/usr/sbin/rsct/bin/haemqvar -c "" "IBM.PSSP.aixos.PagSp.%totalused" NodeNum=*
Menu
}

KMBF() {
print
#Nodes="1 5 7 9 11 13"
Types="mbuf socket protcb otherip mblk streams other"
print "Kernel Memory Buffer Failures"
for a in $Types
do
#Types="mbuf socket protcb otherip mblk streams other"
Nodes="1 5 7 9 11 13"
#for c in $Types
for c in $Nodes
do
/usr/sbin/rsct/bin/haemqvar -c "" "IBM.PSSP.aixos.Mem.Kmem.failures" "Type=$a;NodeNum=$c"
#/usr/sbin/rsct/bin/haemqvar -c "" "IBM.PSSP.aixos.Mem.Kmem.failures" "Type=$c;NodeNum=$a"
done
print
done
Menu
}

Switch_IO_Errs() {
print
Nodes="1 5 7 9 11 13"
print "Switch Input and Output Errors"
for i in $Nodes
do
Resource="ibadpackets ipackets_drop ierrors opackets_drop oerrors xmitque_ovf"
for b in $Resource
do
/usr/sbin/rsct/bin/haemqvar -c "" "IBM.PSSP.CSS.$b" NodeNum=$i
done
print
done
Menu
}

DaemonActivity() {
print
Nodes="1 5 7 9 11 13"
print "Daemon Activity"
for y in $Nodes
do
DaemonProg="inetd srcmstr"
for d in $DaemonProg
do
/usr/sbin/rsct/bin/haemqvar -c "" "IBM.PSSP.Prog.xpcount" "ProgName=$d;UserName=root;NodeNum=$y"
done
print
done
Menu
}

DaemonActivityOther() {
print
Nodes="1 5 7 9 11 13"
print "Daemon Activity"
for z in $Nodes
do
DaemonProgs="biod portmap xntpd kerberos sdrd"
for m in $DaemonProgs
do
/usr/sbin/rsct/bin/haemqvar -c "" "IBM.PSSP.Prog.pcount" "ProgName=$m;UserName=root;NodeNum=$z"
done
print
done
Menu
}

__RunIt() {
#x=$(cat /tmp/search.f); xx=${x:89}; i=$(echo $xx | awk -F'"' '{print $1}')
i=$cond; export i; print
/tmp/search.f > /tmp/work.txt
tr -d ' ' < /tmp/work.txt > /tmp/work.txt1
mv /tmp/work.txt1 /tmp/work.txt
x=$(cat /tmp/work.txt); variables=${x##*:}
echo $variables > /tmp/work.txt
sed 's/[0-9]/\*/g' /tmp/work.txt > /tmp/work.txt1
mv /tmp/work.txt1 /tmp/work.txt
vars=$(cat /tmp/work.txt | sed -e 's/\*\*/\*/')
GetDisks
print "Checking condition '$i'"
PrintDot
/usr/sbin/rsct/bin/haemqvar -c "" "$i" "$vars"
kill -1 $PID
print
return
}

Search() {
print
print -n "Enter a word to search: "
read gotit
/usr/sbin/rsct/bin/haemqvar -d | grep "$gotit" > /tmp/workfile
more -e workfile
print -u2 "\n"
print -n "Copy & paste or type the Resource Variable Name you want to check for conditions: "
read cond
export cond
#vi /tmp/search.f
__RunIt
Menu
}

Cleanup() {
rm /tmp/workfile 2>/dev/null
rm /tmp/work.txt 2>/dev/null
echo
}

Menu() {
print 'Select the SP conditions to monitor:'
PS3='condition? '
print
select list in 'File System becoming full' 'Kernel Memory Buffer Failures' 'Paging Space Low' 'Switch Input Output Errors' 'inetd srcmstr -- Daem
on Activity' 'biod portmap xntpd kerberos sdrd -- Daemon Activity' 'Search for an event' 'Quit'
do
case $REPLY in
1) FStotal ;;
2) KMBF ;;
3) PagSpTotal ;;
export cond
#vi /tmp/search.f
__RunIt
Menu
}

Cleanup() {
rm /tmp/workfile 2>/dev/null
rm /tmp/work.txt 2>/dev/null
echo
}

Menu() {
print 'Select the SP conditions to monitor:'
PS3='condition? '
print
select list in 'File System becoming full' 'Kernel Memory Buffer Failures' 'Paging Space Low' 'Switch Input Output Errors' 'inetd srcmstr -- Daem
on Activity' 'biod portmap xntpd kerberos sdrd -- Daemon Activity' 'Search for an event' 'Quit'
do
case $REPLY in
1) FStotal ;;
2) KMBF ;;
3) PagSpTotal ;;
4) Switch_IO_Errs ;;
5) DaemonActivity ;;
6) DaemonActivityOther ;;
7) Search ;;
8) Cleanup; exit 0 ;;
*) if [[ ${#REPLY} -ne 1 ]]; then
clear; Menu
else
clear; Menu
fi ;;

esac
done
}

#trap 'rm -f workfile work.txt 2>/dev/null; exit ' 0 1 2 3 15
Menu

#cat search.f
awk -f findnode.awk -v first='(Resource variable:)|(Resource Variable Name:)' -v sought="$cond" /tmp/vardefs.out

#cat findnode.awk
$0 ~ first {
if ( index( $0, sought ) )
{ getline;
print
}
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top