| Current File : //usr/local/nagios/libexec/check_versions |
#!/usr/bin/perl
#
$cminor = 2;
$wrev = shift;
$crev = shift;
$status = 0;
$msg = "";
$apache1 = `httpd -V |grep \"Server version\"`;
chomp($apache1);
(undef,$apache) = split(/:/,$apache1);
$apache =~ s/ //g;
$apache =~ s/(Unix)//g;
$apache =~ s/\(//g;
$apache =~ s/\)//g;
$apache =~ s/Apache\///g;
($major,$minor,$rev) = split(/\./,$apache);
if ($minor < $cminor) {
$msg = "Warning: Apache Minor version less than 2: Apache $apache\n";
$status = 1;
}
if($rev <= $wrev and $rev > $crev) {
$msg = "Warning: Apache minor revision equal or below warning threshold ($wrev): Apache $apache\n";
$status = 1;
}
if ($wrev <= $rev) {
if($rev <= $crev ) {
$msg = "CRITICAL: Apache minor revision equal below critical threshold ($crev): Apache $apache\n";
$status = 2;
}
}
if ($status eq 0){
$msg = "OK - Apache version $apache\n";
}
print $msg;
exit($status);