Process Scheduler Monitor Script - Logic

Sharing my simple script created to monitor the status of the PRCS scheduler services.

1. PRCS-List.txt is a file referred by my logic which contains PRCS Domain names which we have to monitor…

[Sandeep]:/dba/scripts>cat PRCS-List.txt

SANDEEP

SANSNEW

[Sandeep]:/dba/scripts>

Script starts here….

ScriptPath="/dba/scripts”

rm $ScriptPath/PRCS-Report.txt

cat $ScriptPath/PRCS-List.txt while read line

do

psadmin -p status -d $line > $ScriptPath/PRCS-TMP.txt

#The below statement “egrep” checks for the services within that domain, in this case I have checked if that domain has 'BBLPSPRCSRVPSDSTSRV' running… you can change this according to version and based on requirement … When you change this list you have to change the count of process you are monitoring in the if loop “if [ ${status} -ne 3 ]” in the below line accordingly … in my case since I am monitoring only 'BBLPSPRCSRVPSDSTSRV' hence I have mentioned 3 in the if loop “if [ ${status} -ne 3 ]”

status=`egrep 'BBLPSPRCSRVPSDSTSRV' $ScriptPath/PRCS-TMP.txt wc -l`

if [ ${status} -ne 3 ]

then

echo "" >> $ScriptPath/PRCS-Report.txt

echo $line >> $ScriptPath/PRCS-Report.txt

`echo "Process Scheduler is DOWN" >> $ScriptPath/PRCS-Report.txt`

echo "" >> $ScriptPath/PRCS-Report.txt

echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" >> $ScriptPath/PRCS-Report.txt

else

#echo $status >> $ScriptPath/PRCS-Report.txt

echo "" >> $ScriptPath/PRCS-Report.txt

echo $line >> $ScriptPath/PRCS-Report.txt

`echo "Up & Running" >> $ScriptPath/PRCS-Report.txt`

echo "" >> $ScriptPath/PRCS-Report.txt

echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" >> $ScriptPath/PRCS-Report.txt

fi

done

Script Output - PRCS-Report.txt will look as below; you can e-mail this to your ID from the UNIX Server….

SANDEEP

Up & Running

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

SANSNEW

Process Scheduler is DOWN

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

 

0 comments: