diff --git a/apps/backup/netbackup/local/mode/jobstatus.pm b/apps/backup/netbackup/local/mode/jobstatus.pm index 56371ad65..a09931b6c 100644 --- a/apps/backup/netbackup/local/mode/jobstatus.pm +++ b/apps/backup/netbackup/local/mode/jobstatus.pm @@ -118,7 +118,7 @@ sub set_counters { ]; $self->{maps_counters}->{global} = [ - { label => 'total', nlabel = 'jobs.total.count', set => { + { label => 'total', nlabel => 'jobs.total.count', set => { key_values => [ { name => 'total' } ], output_template => 'total jobs : %s', perfdatas => [ diff --git a/apps/virtualization/ovirt/custom/api.pm b/apps/virtualization/ovirt/custom/api.pm index 3b32a543d..4b5bdae6b 100644 --- a/apps/virtualization/ovirt/custom/api.pm +++ b/apps/virtualization/ovirt/custom/api.pm @@ -59,7 +59,7 @@ sub new { $self->{output} = $options{output}; $self->{http} = centreon::plugins::http->new(%options); $self->{cache} = centreon::plugins::statefile->new(%options); - + return $self; } @@ -231,7 +231,7 @@ sub get_host_statistics { sub cache_hosts { my ($self, %options) = @_; - $self->{cache_hosts} = centreon::plugins::statefile->new(%options); + $self->{cache_hosts} = centreon::plugins::statefile->new(output => $self->{output}); $self->{cache_hosts}->check_options(option_results => $self->{option_results}); my $has_cache_file = $self->{cache_hosts}->read(statefile => 'cache_ovirt_hosts_' . md5_hex($self->{hostname}) . '_' . md5_hex($self->{api_username})); my $timestamp_cache = $self->{cache_hosts}->get(name => 'last_timestamp'); diff --git a/centreon/common/powershell/exchange/outlookwebservices.pm b/centreon/common/powershell/exchange/outlookwebservices.pm index f34341c33..f28d11adb 100644 --- a/centreon/common/powershell/exchange/outlookwebservices.pm +++ b/centreon/common/powershell/exchange/outlookwebservices.pm @@ -82,7 +82,7 @@ sub check { $checked++; - my $status = 'ok' + my $status = 'ok'; if (defined($self->{option_results}->{critical}) && $self->{option_results}->{critical} ne '' && $self->{output}->test_eval(test => $self->{option_results}->{critical}, values => $self->{data})) { $status = 'critical'; diff --git a/cloud/cadvisor/restapi/mode/diskio.pm b/cloud/cadvisor/restapi/mode/diskio.pm index 1643b8527..7a24e9621 100644 --- a/cloud/cadvisor/restapi/mode/diskio.pm +++ b/cloud/cadvisor/restapi/mode/diskio.pm @@ -112,7 +112,7 @@ sub manage_selection { my $read_io = {}; my $write_io = {}; - if (keys $first_stat->{diskio}) { + if (defined($first_stat->{diskio})) { $self->{containers}->{$container_id} = { node_name => $result->{$container_id}->{NodeName}, display => defined($self->{option_results}->{use_name}) ? $name : $container_id, diff --git a/database/firebird/mode/users.pm b/database/firebird/mode/users.pm index 697c3f70e..565f38f23 100644 --- a/database/firebird/mode/users.pm +++ b/database/firebird/mode/users.pm @@ -24,18 +24,16 @@ use base qw(centreon::plugins::mode); use strict; use warnings; -use DBD::Firebird; sub new { my ($class, %options) = @_; my $self = $class->SUPER::new(package => __PACKAGE__, %options); bless $self, $class; - $options{options}->add_options(arguments => - { - "warning:s" => { name => 'warning', }, - "critical:s" => { name => 'critical', }, - }); + $options{options}->add_options(arguments => { + 'warning:s' => { name => 'warning' }, + 'critical:s' => { name => 'critical' } + }); return $self; } @@ -56,13 +54,10 @@ sub check_options { sub run { my ($self, %options) = @_; - # $options{sql} = sqlmode object - $self->{sql} = $options{sql}; - $self->{sql}->connect(); - - $self->{sql}->query(query => q{SELECT COUNT(MON$USER) FROM MON$ATTACHMENTS WHERE MON$ATTACHMENT_ID <> CURRENT_CONNECTION}); - my $result = $self->{sql}->fetchrow_array(); + $options{sql}->connect(); + $options{sql}->query(query => q{SELECT COUNT(MON$USER) FROM MON$ATTACHMENTS WHERE MON$ATTACHMENT_ID <> CURRENT_CONNECTION}); + my $result = $options{sql}->fetchrow_array(); if (!defined($result)) { $self->{output}->add_option_msg(short_msg => "Cannot get users."); @@ -72,13 +67,17 @@ sub run { my $exit_code = $self->{perfdata}->threshold_check(value => $result, threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]); my $msg = sprintf("%d user(s) connect to database", $result); - $self->{output}->output_add(severity => $exit_code, - short_msg => $msg); - $self->{output}->perfdata_add(label => 'users', value => $result, - nlabel => 'users.count', - warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'), - critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'), - min => 0); + $self->{output}->output_add( + severity => $exit_code, + short_msg => $msg + ); + $self->{output}->perfdata_add( + label => 'users', value => $result, + nlabel => 'users.count', + 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(); diff --git a/hardware/server/hp/oneview/restapi/custom/api.pm b/hardware/server/hp/oneview/restapi/custom/api.pm index 7a34d120c..6c4c4b20a 100644 --- a/hardware/server/hp/oneview/restapi/custom/api.pm +++ b/hardware/server/hp/oneview/restapi/custom/api.pm @@ -75,7 +75,7 @@ sub set_defaults {} sub check_options { my ($self, %options) = @_; - $self->{hostname} = (defined($self->{option_results}->{hostname})) ? $self->{option_results}->{hostname} : undef; + $self->{hostname} = (defined($self->{option_results}->{hostname})) ? $self->{option_results}->{hostname} : ''; $self->{port} = (defined($self->{option_results}->{port})) ? $self->{option_results}->{port} : 443; $self->{proto} = (defined($self->{option_results}->{proto})) ? $self->{option_results}->{proto} : 'https'; $self->{timeout} = (defined($self->{option_results}->{timeout})) ? $self->{option_results}->{timeout} : 30;