Changeset 250


Ignore:
Timestamp:
Jun 25, 2018, 12:49:54 PM (6 years ago)
Author:
g7moreau
Message:
  • Parameter script name and remove old comment
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/nagios-velvice/velvice.cgi

    r247 r250  
    1010# Possible command http://old.nagios.org/developerinfo/externalcommands/commandlist.php
    1111#
    12 # apt-get install libnagios-object-perl libhtml-parser-perl perl-modules liburi-encode-perl libcolor-calc-perl libyaml-syck-perl
     12# apt-get install perl-modules libnagios-object-perl libhtml-parser-perl liburi-encode-perl libcolor-calc-perl libyaml-syck-perl
    1313
    1414use strict;
    1515use warnings;
    16 use version; our $VERSION = version->declare('0.5.1');
     16use version; our $VERSION = version->declare('0.5.4');
    1717
    1818use CGI;
     
    4444
    4545my $check = uri_decode($query->param('check'));
     46my $script_name = $query->script_name();
    4647
    4748sub hostmapping {
     
    126127 <ul>
    127128   <li>Nagios Velvice Alert Panel : <a href="$config->{'portal-url'}">Core Server</a></li>
    128    <li><small>(<a href='velvice.cgi'>UPDATE</a> - $date)</small></li>
     129   <li><small>(<a href="$script_name">UPDATE</a> - $date)</small></li>
    129130 </ul>
    130131</h1>
     
    145146   $htmlpage .= "<p>Alert to recheck - Level:\n";
    146147   $htmlpage .= join ",\n",
    147       ' <a href="velvice.cgi?check=all">ALL</a><small>(' . scalar(@serviceproblems) . ')</small>',
    148       map(" <a href='velvice.cgi?check=" . lc(uri_encode($_)) . "'>$_</a>($service_level{$_})", sort keys %service_level);
     148      " <a href='$script_name?check=all'>ALL</a><small>(" . scalar(@serviceproblems) . ')</small>',
     149      map(" <a href='$script_name?check=" . lc(uri_encode($_)) . "'>$_</a>($service_level{$_})", sort keys %service_level);
    149150   $htmlpage .= ".\n";
    150151   $htmlpage .= " <br />\n";
    151152   $htmlpage .= " Service:\n";
    152    $htmlpage .= join ",\n", map(" <a href='velvice.cgi?check=" . lc(uri_encode($_)) . "'>$_</a><small>($service_name{$_})</small>", sort keys %service_name);
     153   $htmlpage .= join ",\n", map(" <a href='$script_name?check=" . lc(uri_encode($_)) . "'>$_</a><small>($service_name{$_})</small>", sort keys %service_name);
    153154   $htmlpage .= ".\n";
    154155   $htmlpage .= "</p>\n";
     
    157158   open $nagios_cmd, '>>', $config->{'nagios-cmd'} or die "Can't open file filename: $!";
    158159
    159 #   my @oomkiller     = ();
    160    my %sshdown       = ();
    161 #   my @aptuptodate   = ();
    162    my %cmdafter      = ();
     160   my %sshdown    = ();
     161   my %cmdafter   = ();
    163162   my $after;
    164163
     
    212211         }
    213212
    214 #      push @aptuptodate, $hostname if $service eq 'APT UPTODATE';
    215 #      push @oomkiller,   $hostname if $service eq 'OOM Killer' and $status ne 'PENDING';
    216213      for my $srv_name (keys %{$config->{'service'}}) {
    217214         my $srv_regex  = $config->{'service'}{$srv_name}{'regex'};
     
    253250      }
    254251
    255 #   if (@oomkiller or @aptuptodate or $after) {
    256252   if ($after) {
    257253      require Nagios::Object::Config;
     
    277273            }
    278274         }
    279 
    280 #      @oomkiller = grep !exists $sshdown{$_}, @oomkiller;
    281 #      if (@oomkiller) {
    282 #         $htmlpage .= "<h2>OOM Killer</h2>\n";
    283 #         $htmlpage .= "<pre>\n";
    284 #         if (@oomkiller == 1) {
    285 #            $htmlpage .= " ssh";
    286 #            }
    287 #         else {
    288 #            $htmlpage .= " tssh -c 'sudo rm /var/lib/nagios3/nagios_oom_killer.log'";
    289 #            }
    290 #         for my $host (@oomkiller) {
    291 #            my $object = $parser->find_object("$host", "Nagios::Host");
    292 #            $htmlpage .= ' ' . hostmapping($object->address =~ s/\..*$//r);
    293 #            }
    294 #         $htmlpage .= " 'sudo rm /var/lib/nagios3/nagios_oom_killer.log'" if (@oomkiller == 1);
    295 #         $htmlpage .= "</pre>\n";
    296 #         }
    297 #
    298 #      @aptuptodate = grep !exists $sshdown{$_}, @aptuptodate;
    299 #      if (@aptuptodate) {
    300 #         $htmlpage .= "<h2>APT UPTODATE</h2>\n";
    301 #         $htmlpage .= "<pre>\n";
    302 #         if (@aptuptodate == 1) {
    303 #            $htmlpage .= " ssh";
    304 #            }
    305 #         else {
    306 #            $htmlpage .= " tssh";
    307 #            }
    308 #         for my $host (@aptuptodate) {
    309 #            my $object = $parser->find_object("$host", "Nagios::Host");
    310 #            $htmlpage .= ' ' . hostmapping($object->address =~ s/\..*$//r);
    311 #            }
    312 #         $htmlpage .= "</pre>\n";
    313 #         }
    314275      }
    315276   }
Note: See TracChangeset for help on using the changeset viewer.