[Bigsister-devel] Status of new Check appears twice on webinterface
Brought to you by:
aeby
|
From: stefan s. <ste...@go...> - 2007-08-07 11:39:47
|
Hi,
i already posted this problem a few months ago. Thomas Aeby told me, to use
the keyword "pernode" in the report section. This was quite ok for the check
I was writing at this time, but now I have this problem once again. In
contrast to my first check, this check uses some values from uxmon-asroot to
help identify which task failed (The check monitors directorys which should
be created by backup). If i use "pernode" the values from uxmon-asroot are
not displayed in the webinterface. Leaving the report section as it is
(without pernode) results in correct display but status is displayed twice,
e.g.:
Rbackup for Customer (system) has failed
Rbackup for Customer (system) has failed
I tried to use the check for more than one customer. This leads to the
result, that the last result is used for backup, e.g. I the first backup is
ok, but the second has a fault, Big Sister assumes status red for all
backups. I think the reason for all those problems are the cfg file. I red
the Devel Document carefully, but this things are not really covered in it.
Another failure (Ok, this is more related to beauty) is, that no Status
Lights are displayed left to the status message.
I hope someone has the reason for this. My work lacks due to this since a
few weeks.
Best Regards
Stefan Steimann
===============================================================================
rbackup.cfg
test rbackup{
static set name "rbackup";
static set features unix local;
static set description "Check for possible error Files in Backup
Directorys";
pernode set report_item "rbu";
static set arguments
"dir:string:Directory where Backup is saved"
"customer:string:Name of customer to which the backup
belongs"
"machine:string:System which has been backed up"
"perf:int:report perf data every perf minutes"
"item:string:Item as which to report.";
init {
instance import dir;
instance import customer;
instance import machine;
instance import item report_item;
instance import perf perf_frequency;
}
pernode monitor {
get rbackup.hrBackupStat[0];
pernode set backupstat1 ${rbackup.hrBackupStat[0]};
}
report {
status red ${backupstat1} == 2 "&red" "Rbackup for "
${customer}"("${machine}")" " has failed";
status yellow ${backupstat1} == 3 "&yellow" "Rbackup for "
${customer}"("${machine}")"" has unknown failure";
status green 1 "&green" "Rbackup for "
${customer}"("${machine}")" " has completed Successfully";
}
perf {
export always single.hrBackupStat, ${backupstat1};
}
}
=================================================================================================
rbackup.pm:
package Requester::rbackup;
use lib "/usr/local/bigsister/uxmon";
use lib "/usr/local/bigsister/bin";
use strict;
use Requester::Requester;
@Requester::rbackup::ISA = qw(Requester::Requester);
my $rbackup = new Requester::rbackup();
sub new
{
my( $this, $args ) = @_;
my $class = ref($this) || $this;
my $self = {};
bless( $self, $class );
$self->register("rbackup");
return( $self );
}
sub getinfo
{
my( $self ) = @_;
my $info = {};
my $budir = $self->{"env"}->expand_value( "dir" );
my ($Sekunden, $Minuten, $Stunden, $Monatstag, $Monat,
$Jahr, $Wochentag, $Jahrestag, $Sommerzeit) = localtime(time);
$Monat+=1;
$Jahr+=1900;
my $zeit = "$Stunden$Minuten";
my $verzeichnis1;
my $verzeichnis2;
if ($Monatstag < 10)
{
$verzeichnis1 = "$Jahr-0$Monat-0$Monatstag";
$Monatstag-=1;
$verzeichnis2 = "$Jahr-0$Monat-0$Monatstag";
}
else
{
$verzeichnis1 = "$Jahr-0$Monat-$Monatstag";
$Monatstag-=1;
$verzeichnis2 = "$Jahr-0$Monat-$Monatstag";
}
my $status;
if ($zeit < "2359" && $zeit > "2000")
{
if (-e "$budir/$verzeichnis1/daten.err")
{
$status = 2;
}
else
{
if (-e "$budir/$verzeichnis1/daten.ok")
{
$status = 1;
}
else
{
$status = 3;
}
}
}
else
{
if (-e "$budir/$verzeichnis2/daten.err")
{
$status = 2;
}
else
{
if (-e "$budir/$verzeichnis2/daten.ok")
{
$status = 1;
}
else
{
$status = 3;
}
}
}
return {0 => { "hrBackupStat" => $status }};
}
1;
|