Hello,
Here a very simple script that runs pretty good:
#!/bin/ksh
COLUMN="prtdiag" # Name of the column, often same as tag in bb-hosts
ERROR=0
OK_COLOR="green" KO_COLOR="red"
OK_MSG="<PRE>&${OK_COLOR} All is OK Boss." KO_MSG="<PRE>&${KO_COLOR} Hardware Issue on the machine"
TMP=$BBTMP/prtdiag.tmp if [ -z "${TMP}" ] then TMP=/tmp/prtdiag.tmp fi
##############
Custom test
#############
PLATFORM=uname -i
/usr/platform/${PLATFORM}/sbin/prtdiag -v > $TMP 2>&1 CODE_RETOUR=$?
if [ $CODE_RETOUR -ne 0 ] then ERROR=1
fi
##############
Sending the message
#############
if [ $ERROR -eq 0 ]
then
COLOR=$OK_COLOR
MSG="$OK_MSG
cat $TMP
</PRE>"
else
COLOR=$KO_COLOR
MSG="$KO_MSG
cat $TMP
</PRE>"
fi
BB env var for the bb command
BBDISP env var for the XYMON srv
MACHINE env var for the XYMON client
$BB $BBDISP "status $MACHINE.$COLUMN $COLOR date $MSG"
exit 0
Cordialement, Regards,Mit freundlichen Grüßen,
Gautier BEGIN
Admin and Tools Team CSC Computer Sciences Luxembourg S.A. 12D Impasse Drosbach L-1882 Luxembourg
Global Outsourcing Service | p:+352 24 834 276 | m:+352 621 229 172 | gbegin at csc.com | www.csc.com
CSC • This is a PRIVATE message. If you are not the intended recipient, please delete without copying and kindly advise us by e-mail of the mistake in delivery. NOTE: Regardless of content, this e-mail shall not operate to bind CSC to any order or other contract unless pursuant to explicit written agreement or government initiative expressly permitting the use of e-mail for such purpose • CSC Computer Sciences SAS • Registered Office: Immeuble Le Balzac, 10 Place des Vosges, 92072 Paris La Défense Cedex, France • Registered in France: RCS Nanterre B 315 268 664
From: Roland Soderstrom <rolands at logicaltech.com.au> To: <xymon at xymon.com> Date: 10/11/2011 04:11 AM Subject: [Xymon] Solaris prtdiag
Hi,
I have used old good bb-prtdiag for many years. It works fairly well for a lot of old Sun machines but lack the new ones. The script is pretty nasty in nested loops and too many if's. It is not easy to update it to accommodate new machines.
Is there anyone out there that has a new version of it? Can't find any on xymonton. Or do you monitor SUN hw in another way than prtdiag -> xymonserver?
Otherwise I will rewrite it to support our new hw.
- Roland
Xymon mailing list Xymon at xymon.com http://lists.xymon.com/mailman/listinfo/xymon