<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Finally I got the time to implement it,<br>
Thanks Vernon, it works like a charm.<br>
<br>
- Roland<br>
<br>
I changed it for XYMON only, if someone is interested...<br>
That is changing BBHOME to XYMONHOME etc etc.<br>
<br>
#!/usr/bin/ksh<br>
<br>
#<br>
# PURPOSE<br>
# This is an very simple script/test, but extremely useful.<br>
# It detects ANY hardware failure in Sun SPARC systems by using the
standard 'prtdiag' command. Prtdiag exits with a value of<br>
# '1' if there is an hardware error, otherwise with an exit code of
'0'.<br>
# This way, no model/platform specific (i.e. V240/V890/15K, etc.)
customizations are required, as the output of 'prtdiag'<br>
# differs on most systems. It works fine on Fujitsu-Siemens systems
too.<br>
#<br>
# Provided by: Wim Olivier, Senior Solaris/VERITAS Engineer, AL
Indigo, Johannesburg, South Africa<br>
# sunhw<br>
<br>
# INSTALLATION<br>
# 1. Copy the script to $XYMONHOME/ext/xymon-prtdiag.ksh<br>
# 2. Add it to the $XYMONHOME/etc/clientlaunch.cfg file<br>
#<br>
<br>
TEMPFILE=/$XYMONTMP/prtdiag.OUTPUT.$$<br>
TEST=prtdiag<br>
COLOR="green"<br>
<br>
if [ "$XYMONHOME" = "" ]<br>
then<br>
echo "XYMONHOME is not set... exiting"<br>
exit 1<br>
fi<br>
<br>
if [ ! "$XYMONTMP" ] # GET DEFINITIONS IF NEEDED,
should never happen...<br>
then<br>
# echo "*** LOADING XYMON SETTINGS ***"<br>
. $XYMONHOME/etc/xymonclient.cfg # INCLUDE STANDARD
DEFINITIONS<br>
fi<br>
<br>
# What is this doing?<br>
PANIC="1" # GO RED AND PAGE AT THIS LEVEL<br>
<br>
PLATFORM=`uname -i`<br>
/usr/platform/$PLATFORM/sbin/prtdiag -v > $TEMPFILE<br>
RESULT=$?<br>
#echo $RESULT<br>
#<br>
# DETERMINE RED/YELLOW/GREEN<br>
#<br>
if [ "$RESULT" -ne 0 ]<br>
then<br>
COLOR="red"<br>
fi<br>
<br>
#<br>
# AT THIS POINT WE HAVE OUR RESULTS. NOW WE HAVE TO SEND IT TO<br>
# THE XYMSRV TO BE DISPLAYED...<br>
#<br>
<br>
MACHINE=`uname -n`<br>
<br>
#<br>
# THE FIRST LINE IS STATUS INFORMATION... STRUCTURE IMPORANT!<br>
# THE REST IS FREE-FORM - WHATEVER YOU'D LIKE TO SEND...<br>
#<br>
LINE="status $MACHINE.$TEST $COLOR `date`<br>
`cat $TEMPFILE`"<br>
<br>
$RM -f $TEMPFILE<br>
<br>
# NOW USE THE XYMON COMMAND TO SEND THE DATA ACROSS<br>
$XYMON $XYMSRV "$LINE" # SEND IT TO XYMONSRV<br>
<br>
On 11/10/11 11:09 PM, Vernon Everett wrote:
<blockquote
cite="mid:CAGo4kcYx-D-kCeDqR1jc==rc1m_0L7U6DK64N6+Og5gXrbzmYw@mail.gmail.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<div><font class="Apple-style-span" face="arial, helvetica,
sans-serif">Hi Roland</font></div>
<div><font class="Apple-style-span" face="arial, helvetica,
sans-serif"><br>
</font></div>
<div><font class="Apple-style-span" face="arial, helvetica,
sans-serif">This is what I am using. I made a mistake though,
I did not write it. I must have got confused with another
script I wrote. (I confuse easily) </font></div>
<div><font class="Apple-style-span" face="arial, helvetica,
sans-serif">Credit where due though, and credit goes to Wim
Olivier (See comments)</font></div>
<div><font class="Apple-style-span" face="arial, helvetica,
sans-serif">It also looks like it does pretty much the same as
Gautier's script.</font></div>
<div><font class="Apple-style-span" face="arial, helvetica,
sans-serif"><br>
</font></div>
<div><font class="Apple-style-span" face="arial, helvetica,
sans-serif">Only issue you may have, there is a bug in the
picl daemon, and it sometime crashes. (Recent patching may
have fixed this)</font></div>
<div><font class="Apple-style-span" face="arial, helvetica,
sans-serif">When that happens, all bets are off, and results
could vary.</font></div>
<div><font class="Apple-style-span" face="arial, helvetica,
sans-serif">Restarting picl service normally fixes everything.</font></div>
<div><font class="Apple-style-span" face="arial, helvetica,
sans-serif">Might want to add /system/picl to the list of
monitored services.</font></div>
<div><font class="Apple-style-span" face="arial, helvetica,
sans-serif">There are two good SMF monitoring scripts on the
Xymonton page.</font></div>
<div><a moz-do-not-send="true"
href="http://www.xymonton.org/monitors:smf.sh"><font
class="Apple-style-span" face="arial, helvetica, sans-serif">http://www.xymonton.org/monitors:smf.sh</font></a></div>
<div><font class="Apple-style-span" face="arial, helvetica,
sans-serif">and</font></div>
<div><a moz-do-not-send="true"
href="http://www.xymonton.org/monitors:smf2.ksh"><font
class="Apple-style-span" face="arial, helvetica, sans-serif">http://www.xymonton.org/monitors:smf2.ksh</font></a></div>
<div>I prefer the 2nd one, obviously :-) but the first one is
simpler to configure.</div>
<div>The choice is yours.</div>
<div><br>
</div>
<div>Regards</div>
<div> Vernon</div>
<div><font class="Apple-style-span" face="'courier new',
monospace"><br>
</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace">#!/usr/bin/ksh</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace"><br>
</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace">#</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace"># PURPOSE</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace"># This is an very simple script/test, but extremely
useful.</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace"># It detects ANY hardware failure in Sun SPARC
systems by using the standard 'prtdiag' command. Prtdiag
exits with a value of</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace"># '1' if there is an hardware error, otherwise with
an exit code of '0'.</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace"># This way, no model/platform specific (i.e.
V240/V890/15K, etc.) customizations are required, as the
output of 'prtdiag'</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace"># differs on most systems. It works fine on
Fujitsu-Siemens systems too.</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace">#</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace"># Provided by: Wim Olivier, Senior Solaris/VERITAS
Engineer, AL Indigo, Johannesburg, South Africa</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace"># sunhw</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace"><br>
</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace"># INSTALLATION</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace"># 1. Copy the script to $BBHOME/ext/sunhw.sh</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace"># 2. Add it to the $BBHOME/etc/bb-bbexttab file</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace"># 3. Restart the BB client</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace">#</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace"><br>
</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace">BBPROG=sunhw; export BBPROG</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace">TEMPFILE=/$BBTMP/sunwh.OUTPUT.$$</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace">TEST="sunhw"</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace">COLOR="green"</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace"><br>
</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace">if [ "$BBHOME" = "" ]</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace">then</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace"> echo "BBHOME is not set... exiting"</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace"> exit 1</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace">fi</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace"><br>
</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace">if [ ! "$BBTMP" ] # GET
DEFINITIONS IF NEEDED</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace">then</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace"> # echo "*** LOADING BBDEF ***"</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace"> . $BBHOME/etc/bbdef.sh # INCLUDE
STANDARD DEFINITIONS</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace">fi</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace">PANIC="1" # GO RED AND PAGE AT THIS LEVEL</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace"><br>
</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace">PLATFORM=`uname -i`</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace">/usr/platform/$PLATFORM/sbin/prtdiag -v >
$TEMPFILE</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace">RESULT=$?</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace">#echo $RESULT</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace"> #</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace"> # DETERMINE RED/YELLOW/GREEN</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace"> #</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace">if [ "$RESULT" -ne 0 ]</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace">then</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace"> COLOR="red"</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace">fi</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace"><br>
</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace">#</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace"># AT THIS POINT WE HAVE OUR RESULTS. NOW WE HAVE
TO SEND IT TO</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace"># THE BBDISPLAY TO BE DISPLAYED...</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace">#</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace"><br>
</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace">MACHINE=`uname -n`</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace"><br>
</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace">#</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace"># THE FIRST LINE IS STATUS INFORMATION... STRUCTURE
IMPORANT!</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace"># THE REST IS FREE-FORM - WHATEVER YOU'D LIKE TO
SEND...</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace">#</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace">LINE="status $MACHINE.$TEST $COLOR `date`</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace">`cat $TEMPFILE`"</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace"><br>
</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace">$RM -f $TEMPFILE</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace"><br>
</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace"># NOW USE THE BB COMMAND TO SEND THE DATA ACROSS</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace">$BB $BBDISP "$LINE" # SEND IT
TO BBDISPLAY</font></div>
<div><br>
</div>
<br>
<div class="gmail_quote">On 11 October 2011 10:12, Roland
Soderstrom <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:rolands@logicaltech.com.au">rolands@logicaltech.com.au</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi,<br>
<br>
I have used old good bb-prtdiag for many years.<br>
It works fairly well for a lot of old Sun machines but lack
the new ones.<br>
The script is pretty nasty in nested loops and too many if's.<br>
It is not easy to update it to accommodate new machines.<br>
<br>
Is there anyone out there that has a new version of it?<br>
Can't find any on xymonton.<br>
Or do you monitor SUN hw in another way than prtdiag ->
xymonserver?<br>
<br>
Otherwise I will rewrite it to support our new hw.<br>
<br>
- Roland<br>
_______________________________________________<br>
Xymon mailing list<br>
<a moz-do-not-send="true" href="mailto:Xymon@xymon.com"
target="_blank">Xymon@xymon.com</a><br>
<a moz-do-not-send="true"
href="http://lists.xymon.com/mailman/listinfo/xymon"
target="_blank">http://lists.xymon.com/mailman/listinfo/xymon</a><br>
</blockquote>
</div>
<br>
</blockquote>
</body>
</html>