/usr/lib/cgi-bin/monika.cgi is in oar-web-status 2.5.7-3.
This file is owned by root:root, with mode 0o755.
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 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | #!/usr/bin/perl
##############################################################################
## Monika is a small web interface to monitor OAR node reservations.
## It tries to display a very synthetic view of the cluster usage.
## Monika should work also with PBSPro or OpenPBS.
## Author: pierre.neyron@imag.fr
## Modified by: joseph.emeras@imag.fr
##############################################################################
use strict;
#use warnings;
use OAR::Monika::monikaCGI;
use OAR::Monika::Conf;
use OAR::Monika::OAR;
use Data::Dumper;
## begin CGI stuff
my ($basename) = $0 =~ /([^\/]+)\.cgi$/;
my $cgi = OAR::Monika::monikaCGI->new;
my $file = $cgi->param("conf");
## first get nodes description from the configuration file
my $Oardir = "/etc/oar";
my $conf = OAR::Monika::Conf->new;
if ( defined $file and -r $file) {
$conf->parse($file);
} elsif (-r "$Oardir/$basename.conf") {
$conf->parse("$Oardir/$basename.conf");
} elsif (-r "./$basename.conf") {
$conf->parse("./$basename.conf");
} elsif (-r "/etc/$basename.conf") {
$conf->parse("/etc/$basename.conf");
} else {
die "Neither $Oardir/$basename.conf nor /etc/$basename.conf nor ./$basename.conf are readable. I need a configuration file !";
}
## then get nodes description
my $oar = OAR::Monika::OAR->new;
$oar->oarnodes;
$oar->qstat($cgi);
## my global node container...
my %nodes;
## ... filled in with previousely got nodes:
## first with node descriptions from the configuration file
foreach my $key ( keys %{$conf->allnodes()}) {
$nodes{$key}=$conf->allnodes->{$key};
}
## then with node descriptions (which may overwrite descriptions
## from the configuration file, which is what we want for instance if the
## configuration file define a default state (say "missing") for nodes
## that may actually not be described)
foreach my $key ( keys %{$oar->allnodes()}) {
$nodes{$key}=$oar->allnodes->{$key};
}
## set color scheme up
my $colorHash = $conf->colorHash;
while (my ($state,$color) = each %{$colorHash}) {
$cgi->setColor($state,$color);
}
$cgi->setColorPool($conf->colorPool());
## begin html printing
print $cgi->page_head($conf->clustername." - Monika");
my $css_path = OAR::Monika::Conf::myself->css_path;
print "<link rel=\"stylesheet\" type=\"text/css\" href=\"$css_path\">";
print $cgi->h1({-align => "center"},
$conf->clustername()." "." nodes");
## if node param is present, show detailed view of the pointed node
if (defined $cgi->param('node') and defined $nodes{$cgi->param('node')}) {
my $node = $cgi->param('node');
print $cgi->h2({-align => "center"},
"Node ".$node." detailed status:");
print $nodes{$node}->htmlStatusTable($cgi);
print $cgi->h3({ -align => "center" },
$cgi->a({ -href => $cgi->url(-absolute=>1,-query=>0)},
"back to main page"
));
## if job param is present, show detailed view of the pointed job
}
elsif (defined $cgi->param('job')) { # and defined $oar->alljobs()->{$cgi->param('job')}
my $job = $cgi->param('job');
print $cgi->h2({-align => "center"},
"Job ".$job." detailed status:");
if(exists($oar->alljobs()->{$job})){
print $oar->alljobs()->{$job}->htmlStatusTable($cgi);
}
else{
my $jobInfos = $oar->getJobProperties($job, $cgi);
print $jobInfos->htmlStatusTable($cgi);
}
print $cgi->h3({ -align => "center" },
$cgi->a({ -href => $cgi->url(-absolute=>1,-query=>0)},
"back to main page"
));
## else show the main page
} else {
## print oar status summary
print $oar->htmlSummaryTable($cgi);
print $cgi->br();
## print nodes reservations table
print $cgi->h2({-align => "center"}, "Reservations:");
## print resources for each of the properties if asked in the CGI request, or all resources.
if (defined $cgi->param('props')) {
## print resources property, for the properties selected in the CGI request
print $oar->htmlNodeByProperty($cgi);
} else {
## print all resources
print $cgi->nodeReservationTable(\%nodes);
}
print $cgi->h5({-align => "center"}, "*: Running job but suspected resources.");
## print oar node property chooser
print $cgi->br();
print $oar->htmlPropertyChooser($cgi);
## print oar job status
print $cgi->br();
print $cgi->h2({-align => "center"},
"Job details:");
print $oar->htmlJobTable($cgi);
}
#open VERSION, "<./monika/VERSION";
#my $version="";
#while (<VERSION>) {
# $version.=$_;
#}
#close VERSION;
## print © stuff
print $cgi->h6({ -align => "center",
onmouseover => "popup('Link description here','yellow')",
onmouseout => "kill()"
},
"- ".
$cgi->a({ -href => 'http://oar.imag.fr'},
"Monika - OAR").
" -"
);
print $cgi->end_html();
|