From 10d2d1cb1ff24a9473833e496834ccfdb69f1f56 Mon Sep 17 00:00:00 2001 From: Quentin Garnier Date: Wed, 15 Oct 2014 14:57:06 +0200 Subject: [PATCH] Refs #5884 Typo fix --- apps/apache/serverstatus/plugin.pm | 16 ++++++++-------- apps/selenium/mode/scenario.pm | 17 ++++------------- apps/selenium/plugin.pm | 18 +++++++++--------- 3 files changed, 21 insertions(+), 30 deletions(-) diff --git a/apps/apache/serverstatus/plugin.pm b/apps/apache/serverstatus/plugin.pm index 5b0c1a875..5da08e816 100644 --- a/apps/apache/serverstatus/plugin.pm +++ b/apps/apache/serverstatus/plugin.pm @@ -40,21 +40,21 @@ use warnings; use base qw(centreon::plugins::script_simple); sub new { - my ($class, %options) = @_; - my $self = $class->SUPER::new(package => __PACKAGE__, %options); - bless $self, $class; -# $options->{options} = options object + my ($class, %options) = @_; + my $self = $class->SUPER::new(package => __PACKAGE__, %options); + bless $self, $class; + # $options->{options} = options object - $self->{version} = '0.1'; - %{$self->{modes}} = ( + $self->{version} = '0.1'; + %{$self->{modes}} = ( 'cpuload' => 'apps::apache::serverstatus::mode::cpuload', 'responsetime' => 'apps::apache::serverstatus::mode::responsetime', 'requests' => 'apps::apache::serverstatus::mode::requests', 'slotstates' => 'apps::apache::serverstatus::mode::slotstates', 'workers' => 'apps::apache::serverstatus::mode::workers', - ); + ); - return $self; + return $self; } 1; diff --git a/apps/selenium/mode/scenario.pm b/apps/selenium/mode/scenario.pm index 511a1b7d7..762507d8b 100644 --- a/apps/selenium/mode/scenario.pm +++ b/apps/selenium/mode/scenario.pm @@ -55,8 +55,8 @@ sub new { $options{options}->add_options(arguments => { "selenium-hostname:s" => { name => 'selenium_hostname', default => 'localhost' }, - "selenium-port:s" => { name => 'selenium_port', default => '4444'}, - "browser:s" => { name => 'browser', default => '*firefox'}, + "selenium-port:s" => { name => 'selenium_port', default => '4444' }, + "browser:s" => { name => 'browser', default => '*firefox' }, "directory:s" => { name => 'directory', default => '/var/lib/centreon_waa' }, "scenario:s" => { name => 'scenario' }, "warning:s" => { name => 'warning' }, @@ -98,7 +98,6 @@ sub run { browser_url => $baseurl ); - $sel->start; my $timing0 = [gettimeofday]; @@ -106,7 +105,6 @@ sub run { my $step = $listActionNode->get_nodelist; my $stepOk = 0; my $exit1 = 'UNKNOWN'; - foreach my $actionNode ($listActionNode->get_nodelist) { ($action, $filter, $value) = $xp->find('./td', $actionNode)->get_nodelist; my $trim_action = centreon::plugins::misc::trim($action->string_value); @@ -138,30 +136,23 @@ sub run { } } my $timeelapsed = tv_interval ($timing0, [gettimeofday]); - my $availability = sprintf("%d", $stepOk * 100 / $step); - my $exit2 = $self->{perfdata}->threshold_check(value => $timeelapsed, threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]); - my $exit = $self->{output}->get_most_critical(status => [ $exit1, $exit2 ]); $self->{output}->output_add(severity => $exit, short_msg => sprintf("%d/%d steps (%.3fs)", $stepOk, $step, $timeelapsed)); - $self->{output}->perfdata_add(label => "time", + $self->{output}->perfdata_add(label => "time", unit => 's', value => sprintf('%.3f', $timeelapsed), - unit => 's', min => 0, warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'), critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical')); - $self->{output}->perfdata_add(label => "steps", value => sprintf('%d', $stepOk), min => 0, max => $step); - - $self->{output}->perfdata_add(label => "availability", - unit => '%', + $self->{output}->perfdata_add(label => "availability", unit => '%', value => sprintf('%d', $availability), min => 0, max => 100); diff --git a/apps/selenium/plugin.pm b/apps/selenium/plugin.pm index 24b1fe57d..70af31e9c 100644 --- a/apps/selenium/plugin.pm +++ b/apps/selenium/plugin.pm @@ -40,17 +40,17 @@ use warnings; use base qw(centreon::plugins::script_simple); sub new { - my ($class, %options) = @_; - my $self = $class->SUPER::new(package => __PACKAGE__, %options); - bless $self, $class; -# $options->{options} = options object + my ($class, %options) = @_; + my $self = $class->SUPER::new(package => __PACKAGE__, %options); + bless $self, $class; + # $options->{options} = options object - $self->{version} = '0.1'; - %{$self->{modes}} = ( - 'scenario' => 'apps::selenium::mode::scenario', - ); + $self->{version} = '0.1'; + %{$self->{modes}} = ( + 'scenario' => 'apps::selenium::mode::scenario', + ); - return $self; + return $self; } 1;