BB Unix Network Monitor - Message
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
{bb} BB do not send email for a specific colums
- To: <bb@bb4.com>
- Subject: {bb} BB do not send email for a specific colums
- From: "MOULIN Olivier" <omoulin@newport-com.com>
- Date: Mon, 30 Aug 2004 16:09:40 +0200
- Content-class: urn:content-classes:message
- Content-transfer-encoding: 8bit
- Content-type: text/plain; charset="iso-8859-1"
- Reply-to: bb@bb4.com
- Sender: owner-bb@bb4.com
- Thread-index: AcSDzPaqirho5ikRS1agRQrLhIwofgBZ4rgdAFdJvkQCAkqYgA==
- Thread-topic: {bb} BB do not send email for a specific colums
Ok,
Thank's you
This is my script : very simple , could you check it please
(Some stuff are written in french)
#!/usr/bin/perl
# Check UPS Infosec status
#
# Paths
# File to parse
$file="/etc/upsilon/upsilon.q1";
#$file="/etc/upsilon/upsilon.red";
#$file="/etc/upsilon/upsilon.yellow";
# default BB color
$COLOR="green";
# Default comments
$COMMENTS="";
# Get the system Date and time
$DATE=`date`;
$DATE=substr($DATE, 0, length($DATE)-1);
# Open the log file to read the data
open(FILE, $file) or die "Cannot open fichier: $file";
@ligne = <FILE>;
$ligneCourante=@ligne[0];
chomp ($ligneCourante);
$ligneCourante=~ s/^.//;
($input,$null,$output,$charge,$freq,$niv,$temp,$status)=split " ",$ligneCourante;
$nb_el = scalar(@ligne);
if ($nb_el == 0)
{
$COLOR = "Red";
$COMMENTS = " Aucune ligne dans le fichier : $status !\n";
}
else
{
# Test de charge 1
if (($charge >= 80) && ($charge < 90))
{
$COLOR = "yellow";
$COMMENTS = "<h2><center><b>Charge à 80 %</b></center></h2>\n";
}
# Test de température
if ($temp >= 40)
{
$COLOR = "yellow";
$COMMENTS = $COMMENTS."<h2><center><b>Température trop élevée !!!</b></center></h2>\n";
}
# Test de charge 2
if ($charge >= 90)
{
$COLOR = "red";
$COMMENTS = $COMMENTS."<h1><center><b>Surcharge !!!</b></center></h1>\n";
}
# Test de courant
if (($input == 0) && ($status == "10001000"))
{
$COLOR = "red";
$COMMENTS = $COMMENTS."<h1><center><b>Pas d'alimentation electrique !!!</b></center></h1>\n";
}
}
# Calcul le niveau de batterie - a finir
#$niveau = $niv *
# Calcul de la charge
$charge = $charge * 1;
# Generate BB HTML information
$COMMENTS=$COMMENTS."<center>";
$COMMENTS=$COMMENTS."<table width=\"300\" border=\"0\">";
$COMMENTS=$COMMENTS."<tr><td width=\"200\"><div align=\"right\">Tension d'entrée =</td> <td width=\"100\"><b>$input V</b></td> \n </tr>";
$COMMENTS=$COMMENTS."<tr><td><div align=\"right\">Tension de sortie =</td> <td><b>$output V</b></td> \n </tr>";
$COMMENTS=$COMMENTS."<tr><td><div align=\"right\">Fréquence =</td> <td><b>$freq Hz</b></td> \n </tr>";
$COMMENTS=$COMMENTS."<tr><td><div align=\"right\">Charge =</td> <td><b>$charge%</b></td> \n </tr>";
$COMMENTS=$COMMENTS."<tr><td><div align=\"right\">Niveau de batterie = </td> <td><b>$niv</b></td> \n </tr>";
$COMMENTS=$COMMENTS."<tr><td><div align=\"right\">Température = </td> <td><b>$temp°C</b></td> \n </tr>";
$COMMENTS=$COMMENTS."</table>";
$COMMENTS=$COMMENTS."</center>";
$LINE="$COLOR $DATE - Etat de l'onduleur INFOSEC - \n $COMMENTS";
#print"$LINE";
# send to BB
$BB="/usr/local/bigbrother/bbclient/bin/bb";
$BBDISP="192.168.0.1";
$MACHINE="sepultura,ompm";
$TEST="ups";
# BB command
$command="$BB $BBDISP \"status $MACHINE.$TEST $LINE\" ";
#print"$command";
system("$command");
________________________________
De: owner-bb@bb4.com de la part de Philip Clark
Date: lun. 16/08/2004 21:58
À: bb@bb4.com
Objet : Re: {bb} BB do not send email for a specific colums
On Mon, 2004-08-16 at 13:31, MOULIN Olivier wrote:
> Hi,
>
> I wrote a little perl script to watch my ups but when it turn to red no
> email are sent to warn me.
> Email notification a correctly set up because a receive email for other error.
> My email rules are very simple :
>
> *;;*;;*;*;postmaster@localhost
>
> any idea
It's possible that your script does not have all the information that it
needs to trigger the alert. If it's small, just post it here and
someone will check it.
Cheers, Phil.
--
There are two ways of constructing a software design: One way is to make
it so
simple that there are obviously no deficiencies, and the other way is to
make it
so complicated that there are no obvious deficiencies. (C. A. R. Hoare)
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=
To unsubscribe from this list, or to subscribe to the bb-digest list
send e-mail to mailto:majordomo@bb4.com with unsubscribe bb -and/or-
subscribe bb-digest in the BODY of the message.
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=
To unsubscribe from this list, or to subscribe to the bb-digest list
send e-mail to mailto:majordomo@bb4.com with unsubscribe bb -and/or-
subscribe bb-digest in the BODY of the message.
Home |
Main Index |
Thread Index