From ca2d93cf33ecb8cacd4ae9e10f08d46bcfa72130 Mon Sep 17 00:00:00 2001 From: Quentin Garnier Date: Thu, 17 Apr 2014 11:16:45 +0200 Subject: [PATCH] Fix #5474 --- apps/apache/serverstatus/mode/cpuload.pm | 180 ++++++++++++++++++ apps/apache/serverstatus/mode/requests.pm | 131 ++++++++----- apps/apache/serverstatus/mode/responsetime.pm | 55 ++---- apps/apache/serverstatus/mode/slotstates.pm | 41 ++-- apps/apache/serverstatus/plugin.pm | 5 +- .../plugins/httplib.pm | 7 +- network/bluecoat/mode/clientrequests.pm | 1 + network/bluecoat/mode/clienttraffic.pm | 1 + 8 files changed, 299 insertions(+), 122 deletions(-) create mode 100644 apps/apache/serverstatus/mode/cpuload.pm rename apps/apache/serverstatus/mode/libconnect.pm => centreon/plugins/httplib.pm (92%) diff --git a/apps/apache/serverstatus/mode/cpuload.pm b/apps/apache/serverstatus/mode/cpuload.pm new file mode 100644 index 000000000..32e46e0c6 --- /dev/null +++ b/apps/apache/serverstatus/mode/cpuload.pm @@ -0,0 +1,180 @@ +############################################################################### +# Copyright 2005-2013 MERETHIS +# Centreon is developped by : Julien Mathis and Romain Le Merlus under +# GPL Licence 2.0. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation ; either version 2 of the License. +# +# This program is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, see . +# +# Linking this program statically or dynamically with other modules is making a +# combined work based on this program. Thus, the terms and conditions of the GNU +# General Public License cover the whole combination. +# +# As a special exception, the copyright holders of this program give MERETHIS +# permission to link this program with independent modules to produce an timeelapsedutable, +# regardless of the license terms of these independent modules, and to copy and +# distribute the resulting timeelapsedutable under terms of MERETHIS choice, provided that +# MERETHIS also meet, for each linked independent module, the terms and conditions +# of the license of that module. An independent module is a module which is not +# derived from this program. If you modify this program, you may extend this +# exception to your version of the program, but you are not obliged to do so. If you +# do not wish to do so, delete this exception statement from your version. +# +# For more information : contact@centreon.com +# Author : Simon BOMM +# +# Based on De Bodt Lieven plugin +#################################################################################### + +package apps::apache::serverstatus::mode::cpuload; + +use base qw(centreon::plugins::mode); + +use strict; +use warnings; +use centreon::plugins::httplib; + +sub new { + my ($class, %options) = @_; + my $self = $class->SUPER::new(package => __PACKAGE__, %options); + bless $self, $class; + + $self->{version} = '1.0'; + $options{options}->add_options(arguments => + { + "hostname:s" => { name => 'hostname' }, + "port:s" => { name => 'port', default => '80' }, + "proto:s" => { name => 'proto', default => "http" }, + "urlpath:s" => { name => 'url_path', default => "/server-status/?auto" }, + "credentials" => { name => 'credentials' }, + "username:s" => { name => 'username' }, + "password:s" => { name => 'password' }, + "proxyurl:s" => { name => 'proxyurl' }, + "warning:s" => { name => 'warning' }, + "critical:s" => { name => 'critical' }, + "timeout:s" => { name => 'timeout', default => '3' }, + }); + return $self; +} + +sub check_options { + my ($self, %options) = @_; + $self->SUPER::init(%options); + + if (($self->{perfdata}->threshold_validate(label => 'warning', value => $self->{option_results}->{warning})) == 0) { + $self->{output}->add_option_msg(short_msg => "Wrong warning threshold '" . $self->{option_results}->{warning} . "'."); + $self->{output}->option_exit(); + } + if (($self->{perfdata}->threshold_validate(label => 'critical', value => $self->{option_results}->{critical})) == 0) { + $self->{output}->add_option_msg(short_msg => "Wrong critical threshold '" . $self->{option_results}->{critical} . "'."); + $self->{output}->option_exit(); + } + if (!defined($self->{option_results}->{hostname})) { + $self->{output}->add_option_msg(short_msg => "Please set the hostname option"); + $self->{output}->option_exit(); + } + if ((defined($self->{option_results}->{credentials})) && (!defined($self->{option_results}->{username}) || !defined($self->{option_results}->{password}))) { + $self->{output}->add_option_msg(short_msg => "You need to set --username= and --password= options when --credentials is used"); + $self->{output}->option_exit(); + } +} + +sub run { + my ($self, %options) = @_; + + my $webcontent = centreon::plugins::httplib::connect($self); + # If not present: cpuload is 0 + my ($cpuload) = 0; + + if ($webcontent !~ /^ReqPerSec:\s+([^\s]+)/mi) { + $self->{output}->add_option_msg(short_msg => "Apache 'ExtendedStatus' option is off."); + $self->{output}->option_exit(); + } + if ($webcontent =~ /^CPULoad:\s+([^\s]+)/mi) { + $cpuload = $1; + $cpuload = '0' . $cpuload if ($cpuload =~ /^\./); + } + + my $exit = $self->{perfdata}->threshold_check(value => $cpuload, threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]); + + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("CPU Load: %.2f %%", $cpuload)); + $self->{output}->perfdata_add(label => "cpuload", unit => '%', + value => sprintf("%.2f", $cpuload), + warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'), + critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'), + min => 0 + ); + + $self->{output}->display(); + $self->{output}->exit(); + +} + +1; + +__END__ + +=head1 MODE + +Check Apache WebServer CpuLoad + +=over 8 + +=item B<--hostname> + +IP Addr/FQDN of the webserver host + +=item B<--port> + +Port used by Apache + +=item B<--proxyurl> + +Proxy URL if any + +=item B<--proto> + +Specify https if needed + +=item B<--url-path> + +Set path to get server-status page in auto mode (Default: '/server-status/?auto') + +=item B<--credentials> + +Specify this option if you access server-status page over basic authentification + +=item B<--username> + +Specify username for basic authentification (Mandatory if --credentials is specidied) + +=item B<--password> + +Specify password for basic authentification (Mandatory if --credentials is specidied) + +=item B<--password> + +=item B<--timeout> + +Threshold for HTTP timeout + +=item B<--warning> + +Warning Threshold for CpuLoad + +=item B<--critical> + +Critical Threshold for CpuLoad + +=back + +=cut diff --git a/apps/apache/serverstatus/mode/requests.pm b/apps/apache/serverstatus/mode/requests.pm index 21256d7f3..672de67ae 100644 --- a/apps/apache/serverstatus/mode/requests.pm +++ b/apps/apache/serverstatus/mode/requests.pm @@ -40,7 +40,8 @@ use base qw(centreon::plugins::mode); use strict; use warnings; -use apps::apache::serverstatus::mode::libconnect; +use centreon::plugins::httplib; +use centreon::plugins::statefile; sub new { my ($class, %options) = @_; @@ -53,6 +54,7 @@ sub new { "hostname:s" => { name => 'hostname' }, "port:s" => { name => 'port', default => '80' }, "proto:s" => { name => 'proto', default => "http" }, + "urlpath:s" => { name => 'url_path', default => "/server-status/?auto" }, "credentials" => { name => 'credentials' }, "username:s" => { name => 'username' }, "password:s" => { name => 'password' }, @@ -61,13 +63,15 @@ sub new { "critical:s" => { name => 'critical' }, "warning-bytes:s" => { name => 'warning_bytes' }, "critical-bytes:s" => { name => 'critical_bytes' }, + "warning-access:s" => { name => 'warning_access' }, + "critical-access:s" => { name => 'critical_access' }, "timeout:s" => { name => 'timeout', default => '3' }, }); + $self->{statefile_value} = centreon::plugins::statefile->new(%options); return $self; } sub check_options { - my ($self, %options) = @_; $self->SUPER::init(%options); @@ -87,6 +91,14 @@ sub check_options { $self->{output}->add_option_msg(short_msg => "Wrong critical-bytes threshold '" . $self->{option_results}->{critical_bytes} . "'."); $self->{output}->option_exit(); } + if (($self->{perfdata}->threshold_validate(label => 'warning-access', value => $self->{option_results}->{warning_access})) == 0) { + $self->{output}->add_option_msg(short_msg => "Wrong warning-access threshold '" . $self->{option_results}->{warning_access} . "'."); + $self->{output}->option_exit(); + } + if (($self->{perfdata}->threshold_validate(label => 'critical-access', value => $self->{option_results}->{critical_access})) == 0) { + $self->{output}->add_option_msg(short_msg => "Wrong critical-access threshold '" . $self->{option_results}->{critical_access} . "'."); + $self->{output}->option_exit(); + } if (!defined($self->{option_results}->{hostname})) { $self->{output}->add_option_msg(short_msg => "Please set the hostname option"); $self->{output}->option_exit(); @@ -95,76 +107,87 @@ sub check_options { $self->{output}->add_option_msg(short_msg => "You need to set --username= and --password= options when --credentials is used"); $self->{output}->option_exit(); } - + + $self->{statefile_value}->check_options(%options); } sub run { - my ($self, %options) = @_; - - my $webcontent = apps::apache::serverstatus::mode::libconnect::connect($self); + + my $webcontent = centreon::plugins::httplib::connect($self); + my ($rPerSec, $bPerReq, $total_access, $total_bytes); + + $total_access = $1 if ($webcontent =~ /^Total Accesses:\s+([^\s]+)/mi); + $total_bytes = $1 * 1024 if ($webcontent =~ /^Total kBytes:\s+([^\s]+)/mi); - my @webcontentarr = split("\n", $webcontent); - my $i = 0; - my ($rPerSec, $rPerSecSfx, $bPerSec, $bPerSecSfx, $bPerReq, $bPerReqSfx); + $rPerSec = $1 if ($webcontent =~ /^ReqPerSec:\s+([^\s]+)/mi); + $bPerReq = $1 if ($webcontent =~ /^BytesPerReq:\s+([^\s]+)/mi); - while (($i < @webcontentarr) && ((!defined($rPerSec)) || (!defined($bPerSec)) || (!defined($bPerReq)))) { - if ($webcontentarr[$i] =~ /([0-9]*\.?[0-9]+)\s([A-Za-z]+)\/sec\s-\s([0-9]*\.?[0-9]+)\s([A-Za-z]+)\/second\s-\s([0-9]*\.?[0-9]+)\s([A-Za-z]+)\/request/) { - ($rPerSec, $rPerSecSfx, $bPerSec, $bPerSecSfx, $bPerReq, $bPerReqSfx) = ($webcontentarr[$i] =~ /([0-9]*\.?[0-9]+)\s([A-Za-z]+)\/sec\s-\s([0-9]*\.?[0-9]+)\s([A-Za-z]+)\/second\s-\s([0-9]*\.?[0-9]+)\s([A-Za-z]+)\/request/); - } - $i++; - } - - if (!defined($rPerSec)) { + if (!defined($bPerReq)) { $self->{output}->add_option_msg(short_msg => "Apache 'ExtendedStatus' option is off."); $self->{output}->option_exit(); } - if ($rPerSec =~ /^\./) { - $rPerSec = '0' . $rPerSec; - } + $rPerSec = '0' . $rPerSec if ($rPerSec =~ /^\./); - if ($bPerReqSfx eq 'kB') { - $bPerReq = $bPerReq * 1024; - } elsif ($bPerReqSfx eq 'mB') { - $bPerReq = $bPerReq * 1024 * 1024; - } elsif ($bPerReqSfx eq 'gB') { - $bPerReq = $bPerReq * 1024 * 1024 * 1024; - } + $self->{statefile_value}->read(statefile => 'apache_' . $self->{option_results}->{hostname} . '_' . $self->{option_results}->{port} . '_' . $self->{mode}); + my $old_timestamp = $self->{statefile_value}->get(name => 'last_timestamp'); + my $old_total_access = $self->{statefile_value}->get(name => 'total_access'); + my $old_total_bytes = $self->{statefile_value}->get(name => 'total_bytes'); - if ($bPerSecSfx eq 'kB') { - $bPerSec = $bPerSec * 1024; - } elsif ($bPerSecSfx eq 'mB') { - $bPerSec = $bPerSec * 1024 * 1024; - } elsif ($bPerSecSfx eq 'gB') { - $bPerSec = $bPerSec * 1024 * 1024 * 1024; + my $new_datas = {}; + $new_datas->{last_timestamp} = time(); + $new_datas->{total_bytes} = $total_bytes; + $new_datas->{total_access} = $total_access; + + $self->{statefile_value}->write(data => $new_datas); + if (!defined($old_timestamp) || !defined($old_total_access)) { + $self->{output}->output_add(severity => 'OK', + short_msg => "Buffer creation..."); + $self->{output}->display(); + $self->{output}->exit(); } - + $old_total_access = 0 if ($old_total_access > $new_datas->{total_access}); + $old_total_bytes = 0 if ($old_total_bytes > $new_datas->{total_bytes}); + my $delta_time = $new_datas->{last_timestamp} - $old_timestamp; + $delta_time = 1 if ($delta_time == 0); # One seconds ;) + + my $bPerSec = ($new_datas->{total_bytes} - $old_total_bytes) / $delta_time; + my $aPerSec = ($new_datas->{total_access} - $old_total_access) / $delta_time; + my $exit1 = $self->{perfdata}->threshold_check(value => $rPerSec, threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]); - my $exit2 = $self->{perfdata}->threshold_check(value => $bPerReq, threshold => [ { label => 'critical-bytes', 'exit_litteral' => 'critical' }, { label => 'warning-bytes', exit_litteral => 'warning' } ]); - - my $exit = $self->{output}->get_most_critical(status => [ $exit1, $exit2 ]); + my $exit2 = $self->{perfdata}->threshold_check(value => $bPerSec, threshold => [ { label => 'critical-bytes', 'exit_litteral' => 'critical' }, { label => 'warning-bytes', exit_litteral => 'warning' } ]); + my $exit3 = $self->{perfdata}->threshold_check(value => $aPerSec, threshold => [ { label => 'critical-access', 'exit_litteral' => 'critical' }, { label => 'warning-access', exit_litteral => 'warning' } ]); + + my $exit = $self->{output}->get_most_critical(status => [ $exit1, $exit2, $exit3 ]); my ($bPerSec_value, $bPerSec_unit) = $self->{perfdata}->change_bytes(value => $bPerSec); my ($bPerReq_value, $bPerReq_unit) = $self->{perfdata}->change_bytes(value => $bPerReq); $self->{output}->output_add(severity => $exit, - short_msg => sprintf("RequestPerSec: %s BytesPerSecond: %s BytesPerRequest: %s", $rPerSec, + short_msg => sprintf("RequestPerSec: %s BytesPerSec: %s BytesPerRequest: %s AccessPerSec: %.2f", $rPerSec, $bPerSec_value . ' ' . $bPerSec_unit, - $bPerReq_value . ' ' . $bPerReq_unit)); + $bPerReq_value . ' ' . $bPerReq_unit, + $aPerSec)); $self->{output}->perfdata_add(label => "requestPerSec", value => $rPerSec, - unit => $rPerSecSfx, warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'), - critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical') + critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'), + min => 0 ); - $self->{output}->perfdata_add(label => "bytesPerSec", - value => $bPerSec, - unit => 'B'); - $self->{output}->perfdata_add(label => "bytesPerRequest", unit => 'B', - value => $bPerReq, + $self->{output}->perfdata_add(label => "bytesPerSec", unit => 'B', + value => sprintf("%.2f", $bPerSec), warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-bytes'), critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-bytes'), + min => 0); + $self->{output}->perfdata_add(label => "bytesPerRequest", unit => 'B', + value => $bPerReq, + min => 0 ); + $self->{output}->perfdata_add(label => "accessPerSec", + value => sprintf("%.2f", $aPerSec), + warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-access'), + critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-access'), + min => 0); $self->{output}->display(); $self->{output}->exit(); @@ -197,6 +220,10 @@ Proxy URL if any Specify https if needed +=item B<--url-path> + +Set path to get server-status page in auto mode (Default: '/server-status/?auto') + =item B<--credentials> Specify this option if you access server-status page over basic authentification @@ -225,11 +252,19 @@ Critical Threshold for Request per seconds =item B<--warning-bytes> -Warning Threshold for Bytes Per Request +Warning Threshold for Bytes per seconds =item B<--critical-bytes> -Critical Threshold for Bytes Per Request +Critical Threshold for Bytes per seconds + +=item B<--warning-access> + +Warning Threshold for Access per seconds + +=item B<--critical-access> + +Critical Threshold for Access per seconds =back diff --git a/apps/apache/serverstatus/mode/responsetime.pm b/apps/apache/serverstatus/mode/responsetime.pm index 7f7a5827f..121142b4c 100644 --- a/apps/apache/serverstatus/mode/responsetime.pm +++ b/apps/apache/serverstatus/mode/responsetime.pm @@ -41,7 +41,7 @@ use base qw(centreon::plugins::mode); use strict; use warnings; use Time::HiRes qw(gettimeofday tv_interval); -use apps::apache::serverstatus::mode::libconnect; +use centreon::plugins::httplib; sub new { my ($class, %options) = @_; @@ -54,6 +54,7 @@ sub new { "hostname:s" => { name => 'hostname' }, "port:s" => { name => 'port', default => '80' }, "proto:s" => { name => 'proto', default => "http" }, + "urlpath:s" => { name => 'url_path', default => "/server-status/?auto" }, "credentials" => { name => 'credentials' }, "username:s" => { name => 'username' }, "password:s" => { name => 'password' }, @@ -98,47 +99,21 @@ sub run { my $timing0 = [gettimeofday]; - my $webcontent = apps::apache::serverstatus::mode::libconnect::connect($self, connection_exit => 'critical'); + my $webcontent = centreon::plugins::httplib::connect($self, connection_exit => 'critical'); my $timeelapsed = tv_interval ($timing0, [gettimeofday]); - if (defined $webcontent) { - my @webcontentarr = split("\n", $webcontent); - my $i = 0; - my $ScoreBoard = ""; - my $PosPreBegin = undef; - my $PosPreEnd = undef; - while (($i < @webcontentarr) && ((!defined($PosPreBegin)) || (!defined($PosPreEnd)))) { - if (!defined($PosPreBegin)) { - if ($webcontentarr[$i] =~ m/
/i) {
-                    $PosPreBegin = $i;
-                }
-            }
-            if (defined($PosPreBegin)) {
-                if ($webcontentarr[$i] =~ m/<\/pre>/i) {
-                    $PosPreEnd = $i;
-                }
-            }
-            $i++;
-        }
-        for ($i = $PosPreBegin; $i <= $PosPreEnd; $i++) {
-           $ScoreBoard = $ScoreBoard . $webcontentarr[$i];
-        }
-        $ScoreBoard =~ s/^.*<[Pp][Rr][Ee]>//;
-        $ScoreBoard =~ s/<\/[Pp][Rr][Ee].*>//;
-        my $CountOpenSlots = ($ScoreBoard =~ tr/\.//);
-        my $exit = $self->{perfdata}->threshold_check(value => $timeelapsed,
-                                                      threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
-        $self->{output}->output_add(severity => $exit,
-                                    short_msg => sprintf("Response time %fs ", $timeelapsed));
-        $self->{output}->perfdata_add(label => "time",
-                                      value => $timeelapsed,
-                                      warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
-                                      critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'));
-     }
+    my $exit = $self->{perfdata}->threshold_check(value => $timeelapsed,
+                                                  threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
+    $self->{output}->output_add(severity => $exit,
+                                short_msg => sprintf("Response time %fs ", $timeelapsed));
+    $self->{output}->perfdata_add(label => "time",
+                                  value => $timeelapsed,
+                                  warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
+                                  critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'));
 
-       $self->{output}->display();
-       $self->{output}->exit();
+    $self->{output}->display();
+    $self->{output}->exit();
 }
 
 1;
@@ -163,6 +138,10 @@ Port used by Apache
 
 Specify https if needed
 
+=item B<--url-path>
+
+Set path to get server-status page in auto mode (Default: '/server-status/?auto')
+
 =item B<--credentials>
 
 Specify this option if you access server-status page over basic authentification
diff --git a/apps/apache/serverstatus/mode/slotstates.pm b/apps/apache/serverstatus/mode/slotstates.pm
index 1bb81396b..1f62d0fe0 100644
--- a/apps/apache/serverstatus/mode/slotstates.pm
+++ b/apps/apache/serverstatus/mode/slotstates.pm
@@ -40,7 +40,7 @@ use base qw(centreon::plugins::mode);
 
 use strict;
 use warnings;
-use apps::apache::serverstatus::mode::libconnect;
+use centreon::plugins::httplib;
 
 sub new {
     my ($class, %options) = @_;
@@ -53,6 +53,7 @@ sub new {
             "hostname:s"    => { name => 'hostname' },
             "port:s"        => { name => 'port', default => '80' },
             "proto:s"       => { name => 'proto', default => "http" },
+            "urlpath:s"     => { name => 'url_path', default => "/server-status/?auto" },
             "credentials"   => { name => 'credentials' },
             "username:s"    => { name => 'username' },
             "password:s"    => { name => 'password' },
@@ -65,7 +66,6 @@ sub new {
 }
 
 sub check_options {
-
     my ($self, %options) = @_;
     $self->SUPER::init(%options);
 
@@ -96,40 +96,17 @@ sub check_options {
 sub run {
     my ($self, %options) = @_;
     
-    my $webcontent = apps::apache::serverstatus::mode::libconnect::connect($self);
-    my @webcontentarr = split("\n", $webcontent);
-    my $i = 0;
+    my $webcontent = centreon::plugins::httplib::connect($self);
     my $ScoreBoard = "";
-    my $PosPreBegin = undef;
-    my $PosPreEnd = undef;
-    
-    while (($i < @webcontentarr) && ((!defined($PosPreBegin)) || (!defined($PosPreEnd)))) {
-        if (!defined($PosPreBegin)) {
-            if ( $webcontentarr[$i] =~ m/
/i ) {
-                $PosPreBegin = $i;
-            }
-        }
-        if (defined($PosPreBegin)) {
-            if ( $webcontentarr[$i] =~ m/<\/pre>/i ) {
-                $PosPreEnd = $i;
-            }
-        }
-        $i++;
+    if ($webcontent =~ /^Scoreboard:\s+([^\s]+)/mi) {
+        $ScoreBoard = $1;
     }
-
-    for ($i = $PosPreBegin; $i <= $PosPreEnd; $i++) {
-        $ScoreBoard = $ScoreBoard . $webcontentarr[$i];
-    }
-  
-    $ScoreBoard =~ s/^.*<[Pp][Rr][Ee]>//;
-    $ScoreBoard =~ s/<\/[Pp][Rr][Ee].*>//;
-    
+   
     my $srvLimit = length($ScoreBoard);
-
     my $CountOpenSlots = ($ScoreBoard =~ tr/\.//);
 
     my $exit = $self->{perfdata}->threshold_check(value => $CountOpenSlots,
-                                                 threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
+                                                  threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
 
     $self->{output}->output_add(severity => $exit,
                                 short_msg => sprintf("Free slots: %d", $CountOpenSlots));
@@ -190,6 +167,10 @@ Proxy URL if any
 
 Protocol used http or https
 
+=item B<--url-path>
+
+Set path to get server-status page in auto mode (Default: '/server-status/?auto')
+
 =item B<--credentials>
 
 Specify this option if you access server-status page over basic authentification
diff --git a/apps/apache/serverstatus/plugin.pm b/apps/apache/serverstatus/plugin.pm
index ae1288ff8..205a82e1e 100644
--- a/apps/apache/serverstatus/plugin.pm
+++ b/apps/apache/serverstatus/plugin.pm
@@ -47,8 +47,9 @@ sub new {
 
 	$self->{version} = '0.1';
 	%{$self->{modes}} = (
-			'responsetime'	=> 'apps::apache::serverstatus::mode::responsetime',
-			'requests'	=> 'apps::apache::serverstatus::mode::requests',
+            'cpuload'       => 'apps::apache::serverstatus::mode::cpuload',
+			'responsetime'  => 'apps::apache::serverstatus::mode::responsetime',
+			'requests'      => 'apps::apache::serverstatus::mode::requests',
 			'slotstates'	=> 'apps::apache::serverstatus::mode::slotstates',
 			);
 
diff --git a/apps/apache/serverstatus/mode/libconnect.pm b/centreon/plugins/httplib.pm
similarity index 92%
rename from apps/apache/serverstatus/mode/libconnect.pm
rename to centreon/plugins/httplib.pm
index e912956fa..3c812f793 100644
--- a/apps/apache/serverstatus/mode/libconnect.pm
+++ b/centreon/plugins/httplib.pm
@@ -34,7 +34,7 @@
 # Based on De Bodt Lieven plugin
 ####################################################################################
 
-package apps::apache::serverstatus::mode::libconnect;
+package centreon::plugins::httplib;
 
 use strict;
 use warnings;
@@ -47,14 +47,14 @@ sub connect {
     
     my ($response, $content);
 
-    my $req = HTTP::Request->new( GET => $self->{option_results}->{proto}."://" .$self->{option_results}->{hostname}.':'.$self->{option_results}->{port}.'/server-status');
+    my $req = HTTP::Request->new( GET => $self->{option_results}->{proto}. "://" . $self->{option_results}->{hostname}.':'. $self->{option_results}->{port} . $self->{option_results}->{url_path});
     
     if (defined($self->{option_results}->{credentials})) {
         $req->authorization_basic($self->{option_results}->{username}, $self->{option_results}->{password});
     }
     
     if (defined($self->{option_results}->{proxyurl})) {
-         $ua->proxy(['http', 'https'], $self->{option_results}->{proxyurl});
+        $ua->proxy(['http', 'https'], $self->{option_results}->{proxyurl});
     }
     
     $response = $ua->request($req);
@@ -71,4 +71,3 @@ sub connect {
 }
 
 1;
-
diff --git a/network/bluecoat/mode/clientrequests.pm b/network/bluecoat/mode/clientrequests.pm
index 061038749..beafd3d6d 100644
--- a/network/bluecoat/mode/clientrequests.pm
+++ b/network/bluecoat/mode/clientrequests.pm
@@ -122,6 +122,7 @@ sub run {
     if (!defined($old_timestamp) || !defined($old_client_http_misses)) {
         $self->{output}->output_add(severity => 'OK',
                                     short_msg => "Buffer creation...");
+        $self->{output}->display();
         $self->{output}->exit();
     }
         
diff --git a/network/bluecoat/mode/clienttraffic.pm b/network/bluecoat/mode/clienttraffic.pm
index 78823d48c..13d68e52f 100644
--- a/network/bluecoat/mode/clienttraffic.pm
+++ b/network/bluecoat/mode/clienttraffic.pm
@@ -114,6 +114,7 @@ sub run {
     if (!defined($old_timestamp) || !defined($old_client_in_bytes)) {
         $self->{output}->output_add(severity => 'OK',
                                     short_msg => "Buffer creation...");
+        $self->{output}->display();
         $self->{output}->exit();
     }