Changeset 250
- Timestamp:
- Jun 25, 2018, 12:49:54 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/nagios-velvice/velvice.cgi
r247 r250 10 10 # Possible command http://old.nagios.org/developerinfo/externalcommands/commandlist.php 11 11 # 12 # apt-get install libnagios-object-perl libhtml-parser-perl perl-modulesliburi-encode-perl libcolor-calc-perl libyaml-syck-perl12 # apt-get install perl-modules libnagios-object-perl libhtml-parser-perl liburi-encode-perl libcolor-calc-perl libyaml-syck-perl 13 13 14 14 use strict; 15 15 use warnings; 16 use version; our $VERSION = version->declare('0.5. 1');16 use version; our $VERSION = version->declare('0.5.4'); 17 17 18 18 use CGI; … … 44 44 45 45 my $check = uri_decode($query->param('check')); 46 my $script_name = $query->script_name(); 46 47 47 48 sub hostmapping { … … 126 127 <ul> 127 128 <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> 129 130 </ul> 130 131 </h1> … … 145 146 $htmlpage .= "<p>Alert to recheck - Level:\n"; 146 147 $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); 149 150 $htmlpage .= ".\n"; 150 151 $htmlpage .= " <br />\n"; 151 152 $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); 153 154 $htmlpage .= ".\n"; 154 155 $htmlpage .= "</p>\n"; … … 157 158 open $nagios_cmd, '>>', $config->{'nagios-cmd'} or die "Can't open file filename: $!"; 158 159 159 # my @oomkiller = (); 160 my %sshdown = (); 161 # my @aptuptodate = (); 162 my %cmdafter = (); 160 my %sshdown = (); 161 my %cmdafter = (); 163 162 my $after; 164 163 … … 212 211 } 213 212 214 # push @aptuptodate, $hostname if $service eq 'APT UPTODATE';215 # push @oomkiller, $hostname if $service eq 'OOM Killer' and $status ne 'PENDING';216 213 for my $srv_name (keys %{$config->{'service'}}) { 217 214 my $srv_regex = $config->{'service'}{$srv_name}{'regex'}; … … 253 250 } 254 251 255 # if (@oomkiller or @aptuptodate or $after) {256 252 if ($after) { 257 253 require Nagios::Object::Config; … … 277 273 } 278 274 } 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 # }314 275 } 315 276 }
Note: See TracChangeset
for help on using the changeset viewer.