/usr/share/perl5/OAR/Monika/ConfNode.pm is in oar-web-status 2.5.7-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | ## this package handles a node description got from the configuration file
package OAR::Monika::ConfNode;
use strict;
use warnings;
use OAR::Monika::monikaCGI;
## class constructor
sub new {
my $proto = shift;
my $class = ref($proto) || $proto;
my $self = {};
$self->{NAME} = shift;
$self->{STATE} = shift;
bless ($self, $class);
return $self;
}
## return node number
sub name {
my $self = shift;
return $self->{NAME};
}
## extract the name to display on the page
sub displayHTMLname {
my $self = shift;
$self->name() =~ OAR::Monika::Conf::myself()->nodenameRegexDisplay();
my $shortname = $1 or die "Fail to extract node' shortname";
return $shortname;
}
## return node state as define in the configuration file.
sub state {
my $self = shift;
return $self->{STATE};
}
## print this node status HTML table
sub htmlTable {
my $self = shift;
my $cgi = shift;
my $output = "";
$output .= $cgi->start_table({-border => "1",
-cellspacing => "0",
-cellpadding => "0",
-width => "100%"
});
$output .= $cgi->start_Tr({-align => "center"});
$output .= $cgi->colorTd($self->state());
$output .= $cgi->end_Tr();
$output .= $cgi->end_table();
return $output;
}
sub htmlStatusTable {
my $self = shift;
my $cgi = shift;
my $output = "";
$output .= $cgi->start_table({-border=>"1",
-align => "center"
});
$output .= $cgi->start_Tr();
$output .= $cgi->th({-align => "left", bgcolor => "#c0c0c0"}, $cgi->i("Nodename"));
$output .= $cgi->th({-align => "left"}, $self->name());
$output .= $cgi->end_Tr();
$output .= $cgi->start_Tr();
$output .= $cgi->td({-align => "left", bgcolor => "#c0c0c0"}, $cgi->i("State"));
$output .= $cgi->td({-align => "left"}, $self->state());
$output .= $cgi->end_Tr();
$output .= $cgi->end_table();
return $output;
}
## that's all
return 1;
|