WIP: factoring with status catalog function (storage part)
This commit is contained in:
parent
3393d1e58f
commit
faaed6e444
|
@ -27,7 +27,7 @@ use warnings;
|
|||
use Time::HiRes qw(gettimeofday);
|
||||
use XML::XPath;
|
||||
use WWW::Selenium;
|
||||
use centreon::plugins::templates::catalog_functions;
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
|
||||
|
||||
my %handlers = (ALRM => {} );
|
||||
|
||||
|
@ -161,7 +161,7 @@ sub set_counters {
|
|||
closure_custom_calc => $self->can('custom_state_calc'),
|
||||
closure_custom_output => $self->can('custom_state_output'),
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => \¢reon::plugins::templates::catalog_functions::catalog_status_threshold,
|
||||
closure_custom_threshold_check => \&catalog_status_threshold,
|
||||
}
|
||||
},
|
||||
{ label => 'time-step', set => {
|
||||
|
|
|
@ -24,32 +24,7 @@ use base qw(centreon::plugins::templates::counter);
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $instance_mode;
|
||||
|
||||
sub custom_status_threshold {
|
||||
my ($self, %options) = @_;
|
||||
my $status = 'ok';
|
||||
my $message;
|
||||
|
||||
eval {
|
||||
local $SIG{__WARN__} = sub { $message = $_[0]; };
|
||||
local $SIG{__DIE__} = sub { $message = $_[0]; };
|
||||
|
||||
if (defined($instance_mode->{option_results}->{critical_status}) && $instance_mode->{option_results}->{critical_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{critical_status}") {
|
||||
$status = 'critical';
|
||||
} elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{warning_status}") {
|
||||
$status = 'warning';
|
||||
}
|
||||
};
|
||||
if (defined($message)) {
|
||||
$self->{output}->output_add(long_msg => 'filter status issue: ' . $message);
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
|
||||
|
||||
sub custom_status_output {
|
||||
my ($self, %options) = @_;
|
||||
|
@ -78,7 +53,7 @@ sub set_counters {
|
|||
closure_custom_calc => $self->can('custom_status_calc'),
|
||||
closure_custom_output => $self->can('custom_status_output'),
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => $self->can('custom_status_threshold'),
|
||||
closure_custom_threshold_check => \&catalog_status_threshold,
|
||||
}
|
||||
},
|
||||
{ label => 'redistributing-count', set => {
|
||||
|
@ -107,22 +82,12 @@ sub new {
|
|||
return $self;
|
||||
}
|
||||
|
||||
sub change_macros {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
foreach (('warning_status', 'critical_status')) {
|
||||
if (defined($self->{option_results}->{$_})) {
|
||||
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
$instance_mode = $self;
|
||||
$self->change_macros();
|
||||
$self->change_macros('warning_status', 'critical_status');
|
||||
}
|
||||
|
||||
my %map_status = (
|
||||
|
|
|
@ -24,36 +24,7 @@ use base qw(centreon::plugins::templates::counter);
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
use storage::emc::DataDomain::lib::functions;
|
||||
|
||||
my $instance_mode;
|
||||
|
||||
sub custom_threshold_output {
|
||||
my ($self, %options) = @_;
|
||||
my $status = 'ok';
|
||||
my $message;
|
||||
|
||||
eval {
|
||||
local $SIG{__WARN__} = sub { $message = $_[0]; };
|
||||
local $SIG{__DIE__} = sub { $message = $_[0]; };
|
||||
|
||||
if (defined($instance_mode->{option_results}->{critical_status}) && $instance_mode->{option_results}->{critical_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{critical_status}") {
|
||||
$status = 'critical';
|
||||
} elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{warning_status}") {
|
||||
$status = 'warning';
|
||||
} elsif (defined($instance_mode->{option_results}->{unknown_status}) && $instance_mode->{option_results}->{unknown_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{unknown_status}") {
|
||||
$status = 'unknown';
|
||||
}
|
||||
};
|
||||
if (defined($message)) {
|
||||
$self->{output}->output_add(long_msg => 'filter status issue: ' . $message);
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
|
||||
|
||||
sub custom_status_calc {
|
||||
my ($self, %options) = @_;
|
||||
|
@ -76,7 +47,7 @@ sub set_counters {
|
|||
output_use => 'state',
|
||||
closure_custom_calc => $self->can('custom_status_calc'),
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => $self->can('custom_threshold_output'),
|
||||
closure_custom_threshold_check => \&catalog_status_threshold,
|
||||
}
|
||||
},
|
||||
{ label => 'offset', set => {
|
||||
|
@ -120,18 +91,7 @@ sub check_options {
|
|||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
$instance_mode = $self;
|
||||
$self->change_macros();
|
||||
}
|
||||
|
||||
sub change_macros {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
foreach (('warning_status', 'critical_status', 'unknown_status')) {
|
||||
if (defined($self->{option_results}->{$_})) {
|
||||
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
|
||||
}
|
||||
}
|
||||
$self->change_macros(macros => ['warning_status', 'critical_status', 'unknown_status']);
|
||||
}
|
||||
|
||||
my $oid_sysDescr = '.1.3.6.1.2.1.1.1'; # 'Data Domain OS 5.4.1.1-411752'
|
||||
|
|
|
@ -24,32 +24,7 @@ use base qw(centreon::plugins::templates::counter);
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $instance_mode;
|
||||
|
||||
sub custom_status_threshold {
|
||||
my ($self, %options) = @_;
|
||||
my $status = 'ok';
|
||||
my $message;
|
||||
|
||||
eval {
|
||||
local $SIG{__WARN__} = sub { $message = $_[0]; };
|
||||
local $SIG{__DIE__} = sub { $message = $_[0]; };
|
||||
|
||||
if (defined($instance_mode->{option_results}->{critical_status}) && $instance_mode->{option_results}->{critical_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{critical_status}") {
|
||||
$status = 'critical';
|
||||
} elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{warning_status}") {
|
||||
$status = 'warning';
|
||||
}
|
||||
};
|
||||
if (defined($message)) {
|
||||
$self->{output}->output_add(long_msg => 'filter status issue: ' . $message);
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
|
||||
|
||||
sub custom_status_output {
|
||||
my ($self, %options) = @_;
|
||||
|
@ -70,13 +45,13 @@ sub custom_usage_perfdata {
|
|||
|
||||
my $label = 'ifs_used';
|
||||
my $value_perf = $self->{result_values}->{used};
|
||||
if (defined($instance_mode->{option_results}->{free})) {
|
||||
if (defined($self->{instance_mode}->{option_results}->{free})) {
|
||||
$label = 'ifs_free';
|
||||
$value_perf = $self->{result_values}->{free};
|
||||
}
|
||||
|
||||
my %total_options = ();
|
||||
if ($instance_mode->{option_results}->{units} eq '%') {
|
||||
if ($self->{instance_mode}->{option_results}->{units} eq '%') {
|
||||
$total_options{total} = $self->{result_values}->{total};
|
||||
$total_options{cast_int} = 1;
|
||||
}
|
||||
|
@ -93,10 +68,10 @@ sub custom_usage_threshold {
|
|||
|
||||
my ($exit, $threshold_value);
|
||||
$threshold_value = $self->{result_values}->{used};
|
||||
$threshold_value = $self->{result_values}->{free} if (defined($instance_mode->{option_results}->{free}));
|
||||
if ($instance_mode->{option_results}->{units} eq '%') {
|
||||
$threshold_value = $self->{result_values}->{free} if (defined($self->{instance_mode}->{option_results}->{free}));
|
||||
if ($self->{instance_mode}->{option_results}->{units} eq '%') {
|
||||
$threshold_value = $self->{result_values}->{prct_used};
|
||||
$threshold_value = $self->{result_values}->{prct_free} if (defined($instance_mode->{option_results}->{free}));
|
||||
$threshold_value = $self->{result_values}->{prct_free} if (defined($self->{instance_mode}->{option_results}->{free}));
|
||||
}
|
||||
$exit = $self->{perfdata}->threshold_check(value => $threshold_value, threshold => [ { label => 'critical-' . $self->{label}, exit_litteral => 'critical' }, { label => 'warning-'. $self->{label}, exit_litteral => 'warning' } ]);
|
||||
return $exit;
|
||||
|
@ -140,7 +115,7 @@ sub set_counters {
|
|||
closure_custom_calc => $self->can('custom_status_calc'),
|
||||
closure_custom_output => $self->can('custom_status_output'),
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => $self->can('custom_status_threshold'),
|
||||
closure_custom_threshold_check => \&catalog_status_threshold,
|
||||
}
|
||||
},
|
||||
{ label => 'health', set => {
|
||||
|
@ -184,8 +159,7 @@ sub check_options {
|
|||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
$instance_mode = $self;
|
||||
$self->change_macros();
|
||||
$self->change_macros(macros => ['warning_status', 'critical_status']);
|
||||
}
|
||||
|
||||
sub prefix_cluster_output {
|
||||
|
@ -194,16 +168,6 @@ sub prefix_cluster_output {
|
|||
return "Cluster ";
|
||||
}
|
||||
|
||||
sub change_macros {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
foreach (('warning_status', 'critical_status')) {
|
||||
if (defined($self->{option_results}->{$_})) {
|
||||
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
my %mapping_health = (
|
||||
0 => 'ok',
|
||||
1 => 'attn',
|
||||
|
|
|
@ -24,32 +24,7 @@ use base qw(centreon::plugins::templates::counter);
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $instance_mode;
|
||||
|
||||
sub custom_status_threshold {
|
||||
my ($self, %options) = @_;
|
||||
my $status = 'ok';
|
||||
my $message;
|
||||
|
||||
eval {
|
||||
local $SIG{__WARN__} = sub { $message = $_[0]; };
|
||||
local $SIG{__DIE__} = sub { $message = $_[0]; };
|
||||
|
||||
if (defined($instance_mode->{option_results}->{critical_status}) && $instance_mode->{option_results}->{critical_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{critical_status}") {
|
||||
$status = 'critical';
|
||||
} elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{warning_status}") {
|
||||
$status = 'warning';
|
||||
}
|
||||
};
|
||||
if (defined($message)) {
|
||||
$self->{output}->output_add(long_msg => 'filter status issue: ' . $message);
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
|
||||
|
||||
sub custom_status_output {
|
||||
my ($self, %options) = @_;
|
||||
|
@ -126,7 +101,7 @@ sub set_counters {
|
|||
closure_custom_calc => $self->can('custom_status_calc'),
|
||||
closure_custom_output => $self->can('custom_status_output'),
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => $self->can('custom_status_threshold'),
|
||||
closure_custom_threshold_check => \&catalog_status_threshold,
|
||||
}
|
||||
},
|
||||
{ label => 'landing-usage', set => {
|
||||
|
@ -167,18 +142,7 @@ sub check_options {
|
|||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
$instance_mode = $self;
|
||||
$self->change_macros();
|
||||
}
|
||||
|
||||
sub change_macros {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
foreach (('warning_status', 'critical_status')) {
|
||||
if (defined($self->{option_results}->{$_})) {
|
||||
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
|
||||
}
|
||||
}
|
||||
$self->change_macros(macros => ['warning_status', 'critical_status']);
|
||||
}
|
||||
|
||||
my %map_status = (
|
||||
|
|
|
@ -25,32 +25,7 @@ use base qw(centreon::plugins::templates::counter);
|
|||
use strict;
|
||||
use warnings;
|
||||
use Digest::MD5 qw(md5_hex);
|
||||
|
||||
my $instance_mode;
|
||||
|
||||
sub custom_status_threshold {
|
||||
my ($self, %options) = @_;
|
||||
my $status = 'ok';
|
||||
my $message;
|
||||
|
||||
eval {
|
||||
local $SIG{__WARN__} = sub { $message = $_[0]; };
|
||||
local $SIG{__DIE__} = sub { $message = $_[0]; };
|
||||
|
||||
if (defined($instance_mode->{option_results}->{critical_replication_status}) && $instance_mode->{option_results}->{critical_replication_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{critical_replication_status}") {
|
||||
$status = 'critical';
|
||||
} elsif (defined($instance_mode->{option_results}->{warning_replication_status}) && $instance_mode->{option_results}->{warning_replication_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{warning_replication_status}") {
|
||||
$status = 'warning';
|
||||
}
|
||||
};
|
||||
if (defined($message)) {
|
||||
$self->{output}->output_add(long_msg => 'filter status issue: ' . $message);
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
|
||||
|
||||
sub custom_status_output {
|
||||
my ($self, %options) = @_;
|
||||
|
@ -72,14 +47,14 @@ sub custom_usage_perfdata {
|
|||
|
||||
my $label = 'used';
|
||||
my $value_perf = $self->{result_values}->{used};
|
||||
if (defined($instance_mode->{option_results}->{free})) {
|
||||
if (defined($self->{instance_mode}->{option_results}->{free})) {
|
||||
$label = 'free';
|
||||
$value_perf = $self->{result_values}->{free};
|
||||
}
|
||||
my $extra_label = '';
|
||||
$extra_label = '_' . $self->{result_values}->{display} if (!defined($options{extra_instance}) || $options{extra_instance} != 0);
|
||||
my %total_options = ();
|
||||
if ($instance_mode->{option_results}->{units} eq '%') {
|
||||
if ($self->{instance_mode}->{option_results}->{units} eq '%') {
|
||||
$total_options{total} = $self->{result_values}->{total};
|
||||
$total_options{cast_int} = 1;
|
||||
}
|
||||
|
@ -96,10 +71,10 @@ sub custom_usage_threshold {
|
|||
|
||||
my ($exit, $threshold_value);
|
||||
$threshold_value = $self->{result_values}->{used};
|
||||
$threshold_value = $self->{result_values}->{free} if (defined($instance_mode->{option_results}->{free}));
|
||||
if ($instance_mode->{option_results}->{units} eq '%') {
|
||||
$threshold_value = $self->{result_values}->{free} if (defined($self->{instance_mode}->{option_results}->{free}));
|
||||
if ($self->{instance_mode}->{option_results}->{units} eq '%') {
|
||||
$threshold_value = $self->{result_values}->{prct_used};
|
||||
$threshold_value = $self->{result_values}->{prct_free} if (defined($instance_mode->{option_results}->{free}));
|
||||
$threshold_value = $self->{result_values}->{prct_free} if (defined($self->{instance_mode}->{option_results}->{free}));
|
||||
}
|
||||
$exit = $self->{perfdata}->threshold_check(value => $threshold_value, threshold => [ { label => 'critical-' . $self->{label}, exit_litteral => 'critical' }, { label => 'warning-'. $self->{label}, exit_litteral => 'warning' } ]);
|
||||
return $exit;
|
||||
|
@ -210,7 +185,7 @@ sub set_counters {
|
|||
closure_custom_calc => $self->can('custom_status_calc'),
|
||||
closure_custom_output => $self->can('custom_status_output'),
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => $self->can('custom_status_threshold'),
|
||||
closure_custom_threshold_check => \&catalog_status_threshold,
|
||||
}
|
||||
},
|
||||
];
|
||||
|
@ -238,8 +213,7 @@ sub check_options {
|
|||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
$instance_mode = $self;
|
||||
$self->change_macros();
|
||||
$self->change_macros(macros => ['warning_replication_status', 'critical_replication_status']);
|
||||
}
|
||||
|
||||
sub prefix_volume_output {
|
||||
|
@ -248,16 +222,6 @@ sub prefix_volume_output {
|
|||
return "Volume '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
sub change_macros {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
foreach (('warning_replication_status', 'critical_replication_status')) {
|
||||
if (defined($self->{option_results}->{$_})) {
|
||||
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
my %map_replication_status = (1 => 'normal', 2 => 'faulty');
|
||||
my $mapping = {
|
||||
clusVolumeName => { oid => '.1.3.6.1.4.1.9804.3.1.1.2.12.97.1.2' },
|
||||
|
|
|
@ -24,32 +24,7 @@ use base qw(centreon::plugins::templates::counter);
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $instance_mode;
|
||||
|
||||
sub custom_status_threshold {
|
||||
my ($self, %options) = @_;
|
||||
my $status = 'ok';
|
||||
my $message;
|
||||
|
||||
eval {
|
||||
local $SIG{__WARN__} = sub { $message = $_[0]; };
|
||||
local $SIG{__DIE__} = sub { $message = $_[0]; };
|
||||
|
||||
if (defined($instance_mode->{option_results}->{critical_status}) && $instance_mode->{option_results}->{critical_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{critical_status}") {
|
||||
$status = 'critical';
|
||||
} elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{warning_status}") {
|
||||
$status = 'warning';
|
||||
}
|
||||
};
|
||||
if (defined($message)) {
|
||||
$self->{output}->output_add(long_msg => 'filter status issue: ' . $message);
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
|
||||
|
||||
sub custom_status_output {
|
||||
my ($self, %options) = @_;
|
||||
|
@ -71,14 +46,14 @@ sub custom_usage_perfdata {
|
|||
|
||||
my $label = 'used';
|
||||
my $value_perf = $self->{result_values}->{used};
|
||||
if (defined($instance_mode->{option_results}->{free})) {
|
||||
if (defined($self->{instance_mode}->{option_results}->{free})) {
|
||||
$label = 'free';
|
||||
$value_perf = $self->{result_values}->{free};
|
||||
}
|
||||
my $extra_label = '';
|
||||
$extra_label = '_' . $self->{result_values}->{display} if (!defined($options{extra_instance}) || $options{extra_instance} != 0);
|
||||
my %total_options = ();
|
||||
if ($instance_mode->{option_results}->{units} eq '%') {
|
||||
if ($self->{instance_mode}->{option_results}->{units} eq '%') {
|
||||
$total_options{total} = $self->{result_values}->{total};
|
||||
$total_options{cast_int} = 1;
|
||||
}
|
||||
|
@ -95,10 +70,10 @@ sub custom_usage_threshold {
|
|||
|
||||
my ($exit, $threshold_value);
|
||||
$threshold_value = $self->{result_values}->{used};
|
||||
$threshold_value = $self->{result_values}->{free} if (defined($instance_mode->{option_results}->{free}));
|
||||
if ($instance_mode->{option_results}->{units} eq '%') {
|
||||
$threshold_value = $self->{result_values}->{free} if (defined($self->{instance_mode}->{option_results}->{free}));
|
||||
if ($self->{instance_mode}->{option_results}->{units} eq '%') {
|
||||
$threshold_value = $self->{result_values}->{prct_used};
|
||||
$threshold_value = $self->{result_values}->{prct_free} if (defined($instance_mode->{option_results}->{free}));
|
||||
$threshold_value = $self->{result_values}->{prct_free} if (defined($self->{instance_mode}->{option_results}->{free}));
|
||||
}
|
||||
$exit = $self->{perfdata}->threshold_check(value => $threshold_value, threshold => [ { label => 'critical-' . $self->{label}, exit_litteral => 'critical' }, { label => 'warning-'. $self->{label}, exit_litteral => 'warning' } ]);
|
||||
return $exit;
|
||||
|
@ -143,7 +118,7 @@ sub set_counters {
|
|||
closure_custom_calc => $self->can('custom_status_calc'),
|
||||
closure_custom_output => $self->can('custom_status_output'),
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => $self->can('custom_status_threshold'),
|
||||
closure_custom_threshold_check => \&catalog_status_threshold
|
||||
}
|
||||
},
|
||||
{ label => 'usage', set => {
|
||||
|
@ -189,8 +164,7 @@ sub check_options {
|
|||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
$instance_mode = $self;
|
||||
$self->change_macros();
|
||||
$self->change_macros(macros => ['warning_status', 'critical_status']);
|
||||
}
|
||||
|
||||
sub prefix_cluster_output {
|
||||
|
@ -199,16 +173,6 @@ sub prefix_cluster_output {
|
|||
return "Cluster '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
sub change_macros {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
foreach (('warning_status', 'critical_status')) {
|
||||
if (defined($self->{option_results}->{$_})) {
|
||||
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
my %mapping_health_level = (
|
||||
0 => 'unknown',
|
||||
1 => 'ok',
|
||||
|
|
|
@ -24,32 +24,7 @@ use base qw(centreon::plugins::templates::counter);
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $instance_mode;
|
||||
|
||||
sub custom_status_threshold {
|
||||
my ($self, %options) = @_;
|
||||
my $status = 'ok';
|
||||
my $message;
|
||||
|
||||
eval {
|
||||
local $SIG{__WARN__} = sub { $message = $_[0]; };
|
||||
local $SIG{__DIE__} = sub { $message = $_[0]; };
|
||||
|
||||
if (defined($instance_mode->{option_results}->{critical_status}) && $instance_mode->{option_results}->{critical_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{critical_status}") {
|
||||
$status = 'critical';
|
||||
} elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{warning_status}") {
|
||||
$status = 'warning';
|
||||
}
|
||||
};
|
||||
if (defined($message)) {
|
||||
$self->{output}->output_add(long_msg => 'filter status issue: ' . $message);
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
|
||||
|
||||
sub custom_status_output {
|
||||
my ($self, %options) = @_;
|
||||
|
@ -80,7 +55,7 @@ sub set_counters {
|
|||
closure_custom_calc => $self->can('custom_status_calc'),
|
||||
closure_custom_output => $self->can('custom_status_output'),
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => $self->can('custom_status_threshold'),
|
||||
closure_custom_threshold_check => \&catalog_status_threshold,
|
||||
}
|
||||
},
|
||||
{ label => 'usage', set => {
|
||||
|
@ -134,8 +109,7 @@ sub check_options {
|
|||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
$instance_mode = $self;
|
||||
$self->change_macros();
|
||||
$self->change_macros(macros => ['warning_status', 'critical_status']);
|
||||
}
|
||||
|
||||
sub prefix_fcs_output {
|
||||
|
@ -147,7 +121,7 @@ sub prefix_fcs_output {
|
|||
sub change_macros {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
foreach (('warning_status', 'critical_status')) {
|
||||
foreach (()) {
|
||||
if (defined($self->{option_results}->{$_})) {
|
||||
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
|
||||
}
|
||||
|
|
|
@ -24,34 +24,7 @@ use base qw(centreon::plugins::templates::counter);
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $instance_mode;
|
||||
|
||||
sub custom_status_threshold {
|
||||
my ($self, %options) = @_;
|
||||
my $status = 'ok';
|
||||
my $message;
|
||||
|
||||
eval {
|
||||
local $SIG{__WARN__} = sub { $message = $_[0]; };
|
||||
local $SIG{__DIE__} = sub { $message = $_[0]; };
|
||||
|
||||
my $label = $self->{label};
|
||||
$label =~ s/-/_/g;
|
||||
if (defined($instance_mode->{option_results}->{'critical_' . $label}) && $instance_mode->{option_results}->{'critical_' . $label} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{'critical_' . $label}") {
|
||||
$status = 'critical';
|
||||
} elsif (defined($instance_mode->{option_results}->{'warning_' . $label}) && $instance_mode->{option_results}->{'warning_' . $label} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{'warning_' . $label}") {
|
||||
$status = 'warning';
|
||||
}
|
||||
};
|
||||
if (defined($message)) {
|
||||
$self->{output}->output_add(long_msg => 'filter status issue: ' . $message);
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
|
||||
|
||||
sub custom_nas_status_output {
|
||||
my ($self, %options) = @_;
|
||||
|
@ -99,7 +72,7 @@ sub set_counters {
|
|||
closure_custom_calc => $self->can('custom_nas_status_calc'),
|
||||
closure_custom_output => $self->can('custom_nas_status_output'),
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => $self->can('custom_status_threshold'),
|
||||
closure_custom_threshold_check => \&catalog_status_threshold,
|
||||
}
|
||||
},
|
||||
];
|
||||
|
@ -110,7 +83,7 @@ sub set_counters {
|
|||
closure_custom_calc => $self->can('custom_share_status_calc'),
|
||||
closure_custom_output => $self->can('custom_share_status_output'),
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => $self->can('custom_status_threshold'),
|
||||
closure_custom_threshold_check => \&catalog_status_threshold,
|
||||
}
|
||||
},
|
||||
];
|
||||
|
@ -138,8 +111,7 @@ sub check_options {
|
|||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
$instance_mode = $self;
|
||||
$self->change_macros();
|
||||
$self->change_macros(macros => ['warning_nas_status', 'critical_nas_status', 'warning_share_status', 'critical_share_status']);
|
||||
}
|
||||
|
||||
sub prefix_nas_output {
|
||||
|
@ -154,16 +126,6 @@ sub prefix_share_output {
|
|||
return "Share '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
sub change_macros {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
foreach (('warning_nas_status', 'critical_nas_status', 'warning_share_status', 'critical_share_status')) {
|
||||
if (defined($self->{option_results}->{$_})) {
|
||||
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
my %mapping_health_level = (
|
||||
0 => 'unknown',
|
||||
1 => 'ok',
|
||||
|
|
|
@ -24,32 +24,7 @@ use base qw(centreon::plugins::templates::counter);
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $instance_mode;
|
||||
|
||||
sub custom_status_threshold {
|
||||
my ($self, %options) = @_;
|
||||
my $status = 'ok';
|
||||
my $message;
|
||||
|
||||
eval {
|
||||
local $SIG{__WARN__} = sub { $message = $_[0]; };
|
||||
local $SIG{__DIE__} = sub { $message = $_[0]; };
|
||||
|
||||
if (defined($instance_mode->{option_results}->{critical_status}) && $instance_mode->{option_results}->{critical_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{critical_status}") {
|
||||
$status = 'critical';
|
||||
} elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{warning_status}") {
|
||||
$status = 'warning';
|
||||
}
|
||||
};
|
||||
if (defined($message)) {
|
||||
$self->{output}->output_add(long_msg => 'filter status issue: ' . $message);
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
|
||||
|
||||
sub custom_status_output {
|
||||
my ($self, %options) = @_;
|
||||
|
@ -74,14 +49,14 @@ sub custom_usage_perfdata {
|
|||
|
||||
my $label = 'used';
|
||||
my $value_perf = $self->{result_values}->{used};
|
||||
if (defined($instance_mode->{option_results}->{free})) {
|
||||
if (defined($self->{instance_mode}->{option_results}->{free})) {
|
||||
$label = 'free';
|
||||
$value_perf = $self->{result_values}->{free};
|
||||
}
|
||||
my $extra_label = '';
|
||||
$extra_label = '_' . $self->{result_values}->{display} if (!defined($options{extra_instance}) || $options{extra_instance} != 0);
|
||||
my %total_options = ();
|
||||
if ($instance_mode->{option_results}->{units} eq '%') {
|
||||
if ($self->{instance_mode}->{option_results}->{units} eq '%') {
|
||||
$total_options{total} = $self->{result_values}->{total};
|
||||
$total_options{cast_int} = 1;
|
||||
}
|
||||
|
@ -98,10 +73,10 @@ sub custom_usage_threshold {
|
|||
|
||||
my ($exit, $threshold_value);
|
||||
$threshold_value = $self->{result_values}->{used};
|
||||
$threshold_value = $self->{result_values}->{free} if (defined($instance_mode->{option_results}->{free}));
|
||||
if ($instance_mode->{option_results}->{units} eq '%') {
|
||||
$threshold_value = $self->{result_values}->{free} if (defined($self->{instance_mode}->{option_results}->{free}));
|
||||
if ($self->{instance_mode}->{option_results}->{units} eq '%') {
|
||||
$threshold_value = $self->{result_values}->{prct_used};
|
||||
$threshold_value = $self->{result_values}->{prct_free} if (defined($instance_mode->{option_results}->{free}));
|
||||
$threshold_value = $self->{result_values}->{prct_free} if (defined($self->{instance_mode}->{option_results}->{free}));
|
||||
}
|
||||
$exit = $self->{perfdata}->threshold_check(value => $threshold_value, threshold => [ { label => 'critical-' . $self->{label}, exit_litteral => 'critical' }, { label => 'warning-'. $self->{label}, exit_litteral => 'warning' } ]);
|
||||
return $exit;
|
||||
|
@ -146,7 +121,7 @@ sub set_counters {
|
|||
closure_custom_calc => $self->can('custom_status_calc'),
|
||||
closure_custom_output => $self->can('custom_status_output'),
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => $self->can('custom_status_threshold'),
|
||||
closure_custom_threshold_check => \&catalog_status_threshold,
|
||||
}
|
||||
},
|
||||
{ label => 'usage', set => {
|
||||
|
@ -193,7 +168,7 @@ sub check_options {
|
|||
$self->SUPER::check_options(%options);
|
||||
|
||||
$instance_mode = $self;
|
||||
$self->change_macros();
|
||||
$self->change_macros(macros => ['warning_status', 'critical_status']);
|
||||
}
|
||||
|
||||
sub prefix_scs_output {
|
||||
|
@ -202,16 +177,6 @@ sub prefix_scs_output {
|
|||
return "Service set '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
sub change_macros {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
foreach (('warning_status', 'critical_status')) {
|
||||
if (defined($self->{option_results}->{$_})) {
|
||||
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
my %mapping_health_level = (
|
||||
0 => 'unknown',
|
||||
1 => 'ok',
|
||||
|
|
|
@ -24,32 +24,7 @@ use base qw(centreon::plugins::templates::counter);
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $instance_mode;
|
||||
|
||||
sub custom_status_threshold {
|
||||
my ($self, %options) = @_;
|
||||
my $status = 'ok';
|
||||
my $message;
|
||||
|
||||
eval {
|
||||
local $SIG{__WARN__} = sub { $message = $_[0]; };
|
||||
local $SIG{__DIE__} = sub { $message = $_[0]; };
|
||||
|
||||
if (defined($instance_mode->{option_results}->{critical_status}) && $instance_mode->{option_results}->{critical_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{critical_status}") {
|
||||
$status = 'critical';
|
||||
} elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{warning_status}") {
|
||||
$status = 'warning';
|
||||
}
|
||||
};
|
||||
if (defined($message)) {
|
||||
$self->{output}->output_add(long_msg => 'filter status issue: ' . $message);
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
|
||||
|
||||
sub custom_status_output {
|
||||
my ($self, %options) = @_;
|
||||
|
@ -78,7 +53,7 @@ sub set_counters {
|
|||
closure_custom_calc => $self->can('custom_status_calc'),
|
||||
closure_custom_output => $self->can('custom_status_output'),
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => $self->can('custom_status_threshold'),
|
||||
closure_custom_threshold_check => \&catalog_status_threshold,
|
||||
}
|
||||
},
|
||||
{ label => 'vdisk-count', set => {
|
||||
|
@ -114,6 +89,13 @@ sub new {
|
|||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
$self->change_macros(macros => ['warning_status', 'critical_status']);
|
||||
}
|
||||
|
||||
my $mapping = {
|
||||
arrayId => { oid => '.1.3.6.1.4.1.2.6.255.1.1.1.52.1.2' },
|
||||
arrayStatus => { oid => '.1.3.6.1.4.1.2.6.255.1.1.1.52.1.3' },
|
||||
|
|
|
@ -24,32 +24,7 @@ use base qw(centreon::plugins::templates::counter);
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $instance_mode;
|
||||
|
||||
sub custom_status_threshold {
|
||||
my ($self, %options) = @_;
|
||||
my $status = 'ok';
|
||||
my $message;
|
||||
|
||||
eval {
|
||||
local $SIG{__WARN__} = sub { $message = $_[0]; };
|
||||
local $SIG{__DIE__} = sub { $message = $_[0]; };
|
||||
|
||||
if (defined($instance_mode->{option_results}->{critical_status}) && $instance_mode->{option_results}->{critical_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{critical_status}") {
|
||||
$status = 'critical';
|
||||
} elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{warning_status}") {
|
||||
$status = 'warning';
|
||||
}
|
||||
};
|
||||
if (defined($message)) {
|
||||
$self->{output}->output_add(long_msg => 'filter status issue: ' . $message);
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
|
||||
|
||||
sub custom_status_output {
|
||||
my ($self, %options) = @_;
|
||||
|
@ -71,14 +46,14 @@ sub custom_usage_perfdata {
|
|||
|
||||
my $label = 'used';
|
||||
my $value_perf = $self->{result_values}->{used};
|
||||
if (defined($instance_mode->{option_results}->{free})) {
|
||||
if (defined($self->{instance_mode}->{option_results}->{free})) {
|
||||
$label = 'free';
|
||||
$value_perf = $self->{result_values}->{free};
|
||||
}
|
||||
my $extra_label = '';
|
||||
$extra_label = '_' . $self->{result_values}->{display} if (!defined($options{extra_instance}) || $options{extra_instance} != 0);
|
||||
my %total_options = ();
|
||||
if ($instance_mode->{option_results}->{units} eq '%') {
|
||||
if ($self->{instance_mode}->{option_results}->{units} eq '%') {
|
||||
$total_options{total} = $self->{result_values}->{total};
|
||||
$total_options{cast_int} = 1;
|
||||
}
|
||||
|
@ -95,10 +70,10 @@ sub custom_usage_threshold {
|
|||
|
||||
my ($exit, $threshold_value);
|
||||
$threshold_value = $self->{result_values}->{used};
|
||||
$threshold_value = $self->{result_values}->{free} if (defined($instance_mode->{option_results}->{free}));
|
||||
if ($instance_mode->{option_results}->{units} eq '%') {
|
||||
$threshold_value = $self->{result_values}->{free} if (defined($self->{instance_mode}->{option_results}->{free}));
|
||||
if ($self->{instance_mode}->{option_results}->{units} eq '%') {
|
||||
$threshold_value = $self->{result_values}->{prct_used};
|
||||
$threshold_value = $self->{result_values}->{prct_free} if (defined($instance_mode->{option_results}->{free}));
|
||||
$threshold_value = $self->{result_values}->{prct_free} if (defined($self->{instance_mode}->{option_results}->{free}));
|
||||
}
|
||||
$exit = $self->{perfdata}->threshold_check(value => $threshold_value, threshold => [ { label => 'critical-' . $self->{label}, exit_litteral => 'critical' }, { label => 'warning-'. $self->{label}, exit_litteral => 'warning' } ]);
|
||||
return $exit;
|
||||
|
@ -143,7 +118,7 @@ sub set_counters {
|
|||
closure_custom_calc => $self->can('custom_status_calc'),
|
||||
closure_custom_output => $self->can('custom_status_output'),
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => $self->can('custom_status_threshold'),
|
||||
closure_custom_threshold_check => \&catalog_status_threshold,
|
||||
}
|
||||
},
|
||||
{ label => 'usage', set => {
|
||||
|
@ -192,7 +167,7 @@ sub check_options {
|
|||
$self->{option_results}->{remote} = 1;
|
||||
}
|
||||
$instance_mode = $self;
|
||||
$self->change_macros();
|
||||
$self->change_macros(macros => ['warning_status', 'critical_status']);
|
||||
}
|
||||
|
||||
sub prefix_pool_output {
|
||||
|
@ -201,16 +176,6 @@ sub prefix_pool_output {
|
|||
return "Pool '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
sub change_macros {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
foreach (('warning_status', 'critical_status')) {
|
||||
if (defined($self->{option_results}->{$_})) {
|
||||
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
|
|
|
@ -24,32 +24,7 @@ use base qw(centreon::plugins::templates::counter);
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $instance_mode;
|
||||
|
||||
sub custom_status_threshold {
|
||||
my ($self, %options) = @_;
|
||||
my $status = 'ok';
|
||||
my $message;
|
||||
|
||||
eval {
|
||||
local $SIG{__WARN__} = sub { $message = $_[0]; };
|
||||
local $SIG{__DIE__} = sub { $message = $_[0]; };
|
||||
|
||||
if (defined($instance_mode->{option_results}->{critical_status}) && $instance_mode->{option_results}->{critical_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{critical_status}") {
|
||||
$status = 'critical';
|
||||
} elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{warning_status}") {
|
||||
$status = 'warning';
|
||||
}
|
||||
};
|
||||
if (defined($message)) {
|
||||
$self->{output}->output_add(long_msg => 'filter status issue: ' . $message);
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
|
||||
|
||||
sub custom_status_output {
|
||||
my ($self, %options) = @_;
|
||||
|
@ -89,7 +64,7 @@ sub set_counters {
|
|||
closure_custom_calc => $self->can('custom_status_calc'),
|
||||
closure_custom_output => $self->can('custom_status_output'),
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => $self->can('custom_status_threshold'),
|
||||
closure_custom_threshold_check => \&catalog_status_threshold,
|
||||
}
|
||||
},
|
||||
];
|
||||
|
@ -113,22 +88,11 @@ sub new {
|
|||
return $self;
|
||||
}
|
||||
|
||||
sub change_macros {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
foreach ('warning_status', 'critical_status') {
|
||||
if (defined($self->{option_results}->{$_})) {
|
||||
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
$instance_mode = $self;
|
||||
$self->change_macros();
|
||||
$self->change_macros(macros => ['warning_status', 'critical_status']);
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
|
|
|
@ -24,32 +24,7 @@ use base qw(centreon::plugins::templates::counter);
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $instance_mode;
|
||||
|
||||
sub custom_status_threshold {
|
||||
my ($self, %options) = @_;
|
||||
my $status = 'ok';
|
||||
my $message;
|
||||
|
||||
eval {
|
||||
local $SIG{__WARN__} = sub { $message = $_[0]; };
|
||||
local $SIG{__DIE__} = sub { $message = $_[0]; };
|
||||
|
||||
if (defined($instance_mode->{option_results}->{critical_status}) && $instance_mode->{option_results}->{critical_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{critical_status}") {
|
||||
$status = 'critical';
|
||||
} elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{warning_status}") {
|
||||
$status = 'warning';
|
||||
}
|
||||
};
|
||||
if (defined($message)) {
|
||||
$self->{output}->output_add(long_msg => 'filter status issue: ' . $message);
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
|
||||
|
||||
sub custom_status_output {
|
||||
my ($self, %options) = @_;
|
||||
|
@ -88,7 +63,7 @@ sub set_counters {
|
|||
closure_custom_calc => $self->can('custom_status_calc'),
|
||||
closure_custom_output => $self->can('custom_status_output'),
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => $self->can('custom_status_threshold'),
|
||||
closure_custom_threshold_check => \&catalog_status_threshold,
|
||||
}
|
||||
},
|
||||
];
|
||||
|
@ -112,22 +87,11 @@ sub new {
|
|||
return $self;
|
||||
}
|
||||
|
||||
sub change_macros {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
foreach ('warning_status', 'critical_status') {
|
||||
if (defined($self->{option_results}->{$_})) {
|
||||
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
$instance_mode = $self;
|
||||
$self->change_macros();
|
||||
$self->change_macros(macros => ['warning_status', 'critical_status']);
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
|
|
|
@ -24,32 +24,7 @@ use base qw(centreon::plugins::templates::counter);
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $instance_mode;
|
||||
|
||||
sub custom_status_threshold {
|
||||
my ($self, %options) = @_;
|
||||
my $status = 'ok';
|
||||
my $message;
|
||||
|
||||
eval {
|
||||
local $SIG{__WARN__} = sub { $message = $_[0]; };
|
||||
local $SIG{__DIE__} = sub { $message = $_[0]; };
|
||||
|
||||
if (defined($instance_mode->{option_results}->{critical_status}) && $instance_mode->{option_results}->{critical_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{critical_status}") {
|
||||
$status = 'critical';
|
||||
} elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{warning_status}") {
|
||||
$status = 'warning';
|
||||
}
|
||||
};
|
||||
if (defined($message)) {
|
||||
$self->{output}->output_add(long_msg => 'filter status issue: ' . $message);
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
|
||||
|
||||
sub custom_status_output {
|
||||
my ($self, %options) = @_;
|
||||
|
@ -91,7 +66,7 @@ sub set_counters {
|
|||
closure_custom_calc => $self->can('custom_status_calc'),
|
||||
closure_custom_output => $self->can('custom_status_output'),
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => $self->can('custom_status_threshold'),
|
||||
closure_custom_threshold_check => \&catalog_status_threshold,
|
||||
}
|
||||
},
|
||||
];
|
||||
|
@ -113,22 +88,11 @@ sub new {
|
|||
return $self;
|
||||
}
|
||||
|
||||
sub change_macros {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
foreach ('warning_status', 'critical_status') {
|
||||
if (defined($self->{option_results}->{$_})) {
|
||||
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
$instance_mode = $self;
|
||||
$self->change_macros();
|
||||
$self->change_macros(macros => ['warning_status', 'critical_status']);
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
|
|
|
@ -24,32 +24,7 @@ use base qw(centreon::plugins::templates::counter);
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $instance_mode;
|
||||
|
||||
sub custom_status_threshold {
|
||||
my ($self, %options) = @_;
|
||||
my $status = 'ok';
|
||||
my $message;
|
||||
|
||||
eval {
|
||||
local $SIG{__WARN__} = sub { $message = $_[0]; };
|
||||
local $SIG{__DIE__} = sub { $message = $_[0]; };
|
||||
|
||||
if (defined($instance_mode->{option_results}->{critical_status}) && $instance_mode->{option_results}->{critical_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{critical_status}") {
|
||||
$status = 'critical';
|
||||
} elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{warning_status}") {
|
||||
$status = 'warning';
|
||||
}
|
||||
};
|
||||
if (defined($message)) {
|
||||
$self->{output}->output_add(long_msg => 'filter status issue: ' . $message);
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
|
||||
|
||||
sub custom_status_output {
|
||||
my ($self, %options) = @_;
|
||||
|
@ -93,7 +68,7 @@ sub set_counters {
|
|||
closure_custom_calc => $self->can('custom_status_calc'),
|
||||
closure_custom_output => $self->can('custom_status_output'),
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => $self->can('custom_status_threshold'),
|
||||
closure_custom_threshold_check => \&catalog_status_threshold,
|
||||
}
|
||||
},
|
||||
];
|
||||
|
@ -115,22 +90,11 @@ sub new {
|
|||
return $self;
|
||||
}
|
||||
|
||||
sub change_macros {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
foreach ('warning_status', 'critical_status') {
|
||||
if (defined($self->{option_results}->{$_})) {
|
||||
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
$instance_mode = $self;
|
||||
$self->change_macros();
|
||||
$self->change_macros(macros => ['warning_status', 'critical_status']);
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
|
|
|
@ -24,32 +24,7 @@ use base qw(centreon::plugins::templates::counter);
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $instance_mode;
|
||||
|
||||
sub custom_status_threshold {
|
||||
my ($self, %options) = @_;
|
||||
my $status = 'ok';
|
||||
my $message;
|
||||
|
||||
eval {
|
||||
local $SIG{__WARN__} = sub { $message = $_[0]; };
|
||||
local $SIG{__DIE__} = sub { $message = $_[0]; };
|
||||
|
||||
if (defined($instance_mode->{option_results}->{critical_status}) && $instance_mode->{option_results}->{critical_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{critical_status}") {
|
||||
$status = 'critical';
|
||||
} elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{warning_status}") {
|
||||
$status = 'warning';
|
||||
}
|
||||
};
|
||||
if (defined($message)) {
|
||||
$self->{output}->output_add(long_msg => 'filter status issue: ' . $message);
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
|
||||
|
||||
sub custom_status_output {
|
||||
my ($self, %options) = @_;
|
||||
|
@ -94,7 +69,7 @@ sub set_counters {
|
|||
closure_custom_calc => $self->can('custom_status_calc'),
|
||||
closure_custom_output => $self->can('custom_status_output'),
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => $self->can('custom_status_threshold'),
|
||||
closure_custom_threshold_check => \&catalog_status_threshold,
|
||||
}
|
||||
},
|
||||
];
|
||||
|
@ -117,22 +92,11 @@ sub new {
|
|||
return $self;
|
||||
}
|
||||
|
||||
sub change_macros {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
foreach ('warning_status', 'critical_status') {
|
||||
if (defined($self->{option_results}->{$_})) {
|
||||
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
$instance_mode = $self;
|
||||
$self->change_macros();
|
||||
$self->change_macros(macros => ['warning_status', 'critical_status']);
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
|
|
|
@ -24,32 +24,7 @@ use base qw(centreon::plugins::templates::counter);
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $instance_mode;
|
||||
|
||||
sub custom_status_threshold {
|
||||
my ($self, %options) = @_;
|
||||
my $status = 'ok';
|
||||
my $message;
|
||||
|
||||
eval {
|
||||
local $SIG{__WARN__} = sub { $message = $_[0]; };
|
||||
local $SIG{__DIE__} = sub { $message = $_[0]; };
|
||||
|
||||
if (defined($instance_mode->{option_results}->{critical_status}) && $instance_mode->{option_results}->{critical_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{critical_status}") {
|
||||
$status = 'critical';
|
||||
} elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{warning_status}") {
|
||||
$status = 'warning';
|
||||
}
|
||||
};
|
||||
if (defined($message)) {
|
||||
$self->{output}->output_add(long_msg => 'filter status issue: ' . $message);
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
|
||||
|
||||
sub custom_status_output {
|
||||
my ($self, %options) = @_;
|
||||
|
@ -92,7 +67,7 @@ sub set_counters {
|
|||
closure_custom_calc => $self->can('custom_status_calc'),
|
||||
closure_custom_output => $self->can('custom_status_output'),
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => $self->can('custom_status_threshold'),
|
||||
closure_custom_threshold_check => \&catalog_status_threshold,
|
||||
}
|
||||
},
|
||||
{ label => 'failed-fans', set => {
|
||||
|
@ -134,22 +109,11 @@ sub new {
|
|||
return $self;
|
||||
}
|
||||
|
||||
sub change_macros {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
foreach ('warning_status', 'critical_status') {
|
||||
if (defined($self->{option_results}->{$_})) {
|
||||
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
$instance_mode = $self;
|
||||
$self->change_macros();
|
||||
$self->change_macros(macros => ['warning_status', 'critical_status']);
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
|
|
|
@ -24,32 +24,7 @@ use base qw(centreon::plugins::templates::counter);
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $instance_mode;
|
||||
|
||||
sub custom_status_threshold {
|
||||
my ($self, %options) = @_;
|
||||
my $status = 'ok';
|
||||
my $message;
|
||||
|
||||
eval {
|
||||
local $SIG{__WARN__} = sub { $message = $_[0]; };
|
||||
local $SIG{__DIE__} = sub { $message = $_[0]; };
|
||||
|
||||
if (defined($instance_mode->{option_results}->{critical_status}) && $instance_mode->{option_results}->{critical_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{critical_status}") {
|
||||
$status = 'critical';
|
||||
} elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{warning_status}") {
|
||||
$status = 'warning';
|
||||
}
|
||||
};
|
||||
if (defined($message)) {
|
||||
$self->{output}->output_add(long_msg => 'filter status issue: ' . $message);
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
|
||||
|
||||
sub custom_status_output {
|
||||
my ($self, %options) = @_;
|
||||
|
@ -91,7 +66,7 @@ sub set_counters {
|
|||
closure_custom_calc => $self->can('custom_status_calc'),
|
||||
closure_custom_output => $self->can('custom_status_output'),
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => $self->can('custom_status_threshold'),
|
||||
closure_custom_threshold_check => \&catalog_status_threshold,
|
||||
}
|
||||
},
|
||||
];
|
||||
|
@ -114,22 +89,11 @@ sub new {
|
|||
return $self;
|
||||
}
|
||||
|
||||
sub change_macros {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
foreach ('warning_status', 'critical_status') {
|
||||
if (defined($self->{option_results}->{$_})) {
|
||||
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
$instance_mode = $self;
|
||||
$self->change_macros();
|
||||
$self->change_macros(macros => ['warning_status', 'critical_status']);
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
|
|
|
@ -24,32 +24,7 @@ use base qw(centreon::plugins::templates::counter);
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $instance_mode;
|
||||
|
||||
sub custom_status_threshold {
|
||||
my ($self, %options) = @_;
|
||||
my $status = 'ok';
|
||||
my $message;
|
||||
|
||||
eval {
|
||||
local $SIG{__WARN__} = sub { $message = $_[0]; };
|
||||
local $SIG{__DIE__} = sub { $message = $_[0]; };
|
||||
|
||||
if (defined($instance_mode->{option_results}->{critical_status}) && $instance_mode->{option_results}->{critical_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{critical_status}") {
|
||||
$status = 'critical';
|
||||
} elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{warning_status}") {
|
||||
$status = 'warning';
|
||||
}
|
||||
};
|
||||
if (defined($message)) {
|
||||
$self->{output}->output_add(long_msg => 'filter status issue: ' . $message);
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
|
||||
|
||||
sub custom_status_output {
|
||||
my ($self, %options) = @_;
|
||||
|
@ -87,7 +62,7 @@ sub set_counters {
|
|||
closure_custom_calc => $self->can('custom_status_calc'),
|
||||
closure_custom_output => $self->can('custom_status_output'),
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => $self->can('custom_status_threshold'),
|
||||
closure_custom_threshold_check => \&catalog_status_threshold,
|
||||
}
|
||||
},
|
||||
];
|
||||
|
@ -109,22 +84,11 @@ sub new {
|
|||
return $self;
|
||||
}
|
||||
|
||||
sub change_macros {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
foreach ('warning_status', 'critical_status') {
|
||||
if (defined($self->{option_results}->{$_})) {
|
||||
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
$instance_mode = $self;
|
||||
$self->change_macros();
|
||||
$self->change_macros(macros => ['warning_status', 'critical_status']);
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
|
|
|
@ -24,32 +24,7 @@ use base qw(centreon::plugins::templates::counter);
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $instance_mode;
|
||||
|
||||
sub custom_status_threshold {
|
||||
my ($self, %options) = @_;
|
||||
my $status = 'ok';
|
||||
my $message;
|
||||
|
||||
eval {
|
||||
local $SIG{__WARN__} = sub { $message = $_[0]; };
|
||||
local $SIG{__DIE__} = sub { $message = $_[0]; };
|
||||
|
||||
if (defined($instance_mode->{option_results}->{critical_status}) && $instance_mode->{option_results}->{critical_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{critical_status}") {
|
||||
$status = 'critical';
|
||||
} elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{warning_status}") {
|
||||
$status = 'warning';
|
||||
}
|
||||
};
|
||||
if (defined($message)) {
|
||||
$self->{output}->output_add(long_msg => 'filter status issue: ' . $message);
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
|
||||
|
||||
sub custom_status_output {
|
||||
my ($self, %options) = @_;
|
||||
|
@ -87,7 +62,7 @@ sub set_counters {
|
|||
closure_custom_calc => $self->can('custom_status_calc'),
|
||||
closure_custom_output => $self->can('custom_status_output'),
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => $self->can('custom_status_threshold'),
|
||||
closure_custom_threshold_check => \&catalog_status_threshold,
|
||||
}
|
||||
},
|
||||
];
|
||||
|
@ -109,22 +84,11 @@ sub new {
|
|||
return $self;
|
||||
}
|
||||
|
||||
sub change_macros {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
foreach ('warning_status', 'critical_status') {
|
||||
if (defined($self->{option_results}->{$_})) {
|
||||
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
$instance_mode = $self;
|
||||
$self->change_macros();
|
||||
$self->change_macros(macros => ['warning_status', 'critical_status']);
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
|
|
|
@ -26,32 +26,7 @@ use strict;
|
|||
use warnings;
|
||||
use centreon::plugins::misc;
|
||||
use centreon::plugins::statefile;
|
||||
|
||||
my $instance_mode;
|
||||
|
||||
sub custom_status_threshold {
|
||||
my ($self, %options) = @_;
|
||||
my $status = 'ok';
|
||||
my $message;
|
||||
|
||||
eval {
|
||||
local $SIG{__WARN__} = sub { $message = $_[0]; };
|
||||
local $SIG{__DIE__} = sub { $message = $_[0]; };
|
||||
|
||||
if (defined($instance_mode->{option_results}->{critical_status}) && $instance_mode->{option_results}->{critical_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{critical_status}") {
|
||||
$status = 'critical';
|
||||
} elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{warning_status}") {
|
||||
$status = 'warning';
|
||||
}
|
||||
};
|
||||
if (defined($message)) {
|
||||
$self->{output}->output_add(long_msg => 'filter status issue: ' . $message);
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
|
||||
|
||||
sub custom_status_output {
|
||||
my ($self, %options) = @_;
|
||||
|
@ -90,7 +65,7 @@ sub set_counters {
|
|||
closure_custom_calc => $self->can('custom_status_calc'),
|
||||
closure_custom_output => $self->can('custom_status_output'),
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => $self->can('custom_status_threshold'),
|
||||
closure_custom_threshold_check => \&catalog_status_threshold,
|
||||
}
|
||||
},
|
||||
];
|
||||
|
@ -120,24 +95,13 @@ sub check_options {
|
|||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
$instance_mode = $self;
|
||||
$self->change_macros();
|
||||
$self->change_macros(macros => ['warning_status', 'critical_status']);
|
||||
|
||||
if (defined($self->{option_results}->{memory})) {
|
||||
$self->{statefile_cache}->check_options(%options);
|
||||
}
|
||||
}
|
||||
|
||||
sub change_macros {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
foreach (('warning_status', 'critical_status')) {
|
||||
if (defined($self->{option_results}->{$_})) {
|
||||
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
|
|
|
@ -24,32 +24,7 @@ use base qw(centreon::plugins::templates::counter);
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $instance_mode;
|
||||
|
||||
sub custom_status_threshold {
|
||||
my ($self, %options) = @_;
|
||||
my $status = 'ok';
|
||||
my $message;
|
||||
|
||||
eval {
|
||||
local $SIG{__WARN__} = sub { $message = $_[0]; };
|
||||
local $SIG{__DIE__} = sub { $message = $_[0]; };
|
||||
|
||||
if (defined($instance_mode->{option_results}->{critical_status}) && $instance_mode->{option_results}->{critical_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{critical_status}") {
|
||||
$status = 'critical';
|
||||
} elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{warning_status}") {
|
||||
$status = 'warning';
|
||||
}
|
||||
};
|
||||
if (defined($message)) {
|
||||
$self->{output}->output_add(long_msg => 'filter status issue: ' . $message);
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
|
||||
|
||||
sub custom_status_output {
|
||||
my ($self, %options) = @_;
|
||||
|
@ -94,7 +69,7 @@ sub custom_volume_output {
|
|||
sub custom_volume_calc {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{result_values}->{volume} = $instance_mode->convert_to_bytes(raw_value => $options{new_datas}->{$self->{instance} . '_' . $options{extra_options}->{label_ref}});
|
||||
$self->{result_values}->{volume} = $self->{instance_mode}->convert_to_bytes(raw_value => $options{new_datas}->{$self->{instance} . '_' . $options{extra_options}->{label_ref}});
|
||||
$self->{result_values}->{display} = $options{extra_options}->{display_ref};
|
||||
$self->{result_values}->{label} = $options{extra_options}->{label_ref};
|
||||
|
||||
|
@ -131,7 +106,7 @@ sub set_counters {
|
|||
closure_custom_calc => $self->can('custom_status_calc'),
|
||||
closure_custom_output => $self->can('custom_status_output'),
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => $self->can('custom_status_threshold'),
|
||||
closure_custom_threshold_check => \&catalog_status_threshold,
|
||||
}
|
||||
},
|
||||
{ label => 'status-progress', set => {
|
||||
|
@ -196,18 +171,7 @@ sub check_options {
|
|||
$self->{option_results}->{remote} = 1;
|
||||
}
|
||||
|
||||
$instance_mode = $self;
|
||||
$self->change_macros();
|
||||
}
|
||||
|
||||
sub change_macros {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
foreach (('warning_status', 'critical_status')) {
|
||||
if (defined($self->{option_results}->{$_})) {
|
||||
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
|
||||
}
|
||||
}
|
||||
$self->change_macros(macros => ['warning_status', 'critical_status']);
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
|
|
|
@ -25,32 +25,7 @@ use base qw(centreon::plugins::templates::counter);
|
|||
use strict;
|
||||
use warnings;
|
||||
use DateTime;
|
||||
|
||||
my $instance_mode;
|
||||
|
||||
sub custom_status_threshold {
|
||||
my ($self, %options) = @_;
|
||||
my $status = 'ok';
|
||||
my $message;
|
||||
|
||||
eval {
|
||||
local $SIG{__WARN__} = sub { $message = $_[0]; };
|
||||
local $SIG{__DIE__} = sub { $message = $_[0]; };
|
||||
|
||||
if (defined($instance_mode->{option_results}->{critical_status}) && $instance_mode->{option_results}->{critical_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{critical_status}") {
|
||||
$status = 'critical';
|
||||
} elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{warning_status}") {
|
||||
$status = 'warning';
|
||||
}
|
||||
};
|
||||
if (defined($message)) {
|
||||
$self->{output}->output_add(long_msg => 'filter status issue: ' . $message);
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
|
||||
|
||||
sub custom_status_output {
|
||||
my ($self, %options) = @_;
|
||||
|
@ -107,7 +82,7 @@ sub set_counters {
|
|||
closure_custom_calc => $self->can('custom_status_calc'),
|
||||
closure_custom_output => $self->can('custom_status_output'),
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => $self->can('custom_status_threshold'),
|
||||
closure_custom_threshold_check => \&catalog_status_threshold,
|
||||
}
|
||||
},
|
||||
{ label => 'original-data-size', set => {
|
||||
|
@ -165,18 +140,7 @@ sub check_options {
|
|||
$self->{option_results}->{remote} = 1;
|
||||
}
|
||||
|
||||
$instance_mode = $self;
|
||||
$self->change_macros();
|
||||
}
|
||||
|
||||
sub change_macros {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
foreach (('warning_status', 'critical_status')) {
|
||||
if (defined($self->{option_results}->{$_})) {
|
||||
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
|
||||
}
|
||||
}
|
||||
$self->change_macros(macros => ['warning_status', 'critical_status']);
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
|
|
|
@ -24,32 +24,7 @@ use base qw(centreon::plugins::templates::counter);
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $instance_mode;
|
||||
|
||||
sub custom_status_threshold {
|
||||
my ($self, %options) = @_;
|
||||
my $status = 'ok';
|
||||
my $message;
|
||||
|
||||
eval {
|
||||
local $SIG{__WARN__} = sub { $message = $_[0]; };
|
||||
local $SIG{__DIE__} = sub { $message = $_[0]; };
|
||||
|
||||
if (defined($instance_mode->{option_results}->{critical_status}) && $instance_mode->{option_results}->{critical_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{critical_status}") {
|
||||
$status = 'critical';
|
||||
} elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{warning_status}") {
|
||||
$status = 'warning';
|
||||
}
|
||||
};
|
||||
if (defined($message)) {
|
||||
$self->{output}->output_add(long_msg => 'filter status issue: ' . $message);
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
|
||||
|
||||
sub custom_status_output {
|
||||
my ($self, %options) = @_;
|
||||
|
@ -86,7 +61,7 @@ sub set_counters {
|
|||
closure_custom_calc => $self->can('custom_status_calc'),
|
||||
closure_custom_output => $self->can('custom_status_output'),
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => $self->can('custom_status_threshold'),
|
||||
closure_custom_threshold_check => \&catalog_status_threshold,
|
||||
}
|
||||
},
|
||||
];
|
||||
|
@ -116,16 +91,6 @@ sub new {
|
|||
return $self;
|
||||
}
|
||||
|
||||
sub change_macros {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
foreach (('warning_status', 'critical_status')) {
|
||||
if (defined($self->{option_results}->{$_})) {
|
||||
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
@ -134,8 +99,7 @@ sub check_options {
|
|||
$self->{option_results}->{remote} = 1;
|
||||
}
|
||||
|
||||
$instance_mode = $self;
|
||||
$self->change_macros();
|
||||
$self->change_macros(macros => ['warning_status', 'critical_status']);
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
|
|
|
@ -24,32 +24,7 @@ use base qw(centreon::plugins::templates::counter);
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $instance_mode;
|
||||
|
||||
sub custom_status_threshold {
|
||||
my ($self, %options) = @_;
|
||||
my $status = 'ok';
|
||||
my $message;
|
||||
|
||||
eval {
|
||||
local $SIG{__WARN__} = sub { $message = $_[0]; };
|
||||
local $SIG{__DIE__} = sub { $message = $_[0]; };
|
||||
|
||||
if (defined($instance_mode->{option_results}->{critical_status}) && $instance_mode->{option_results}->{critical_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{critical_status}") {
|
||||
$status = 'critical';
|
||||
} elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{warning_status}") {
|
||||
$status = 'warning';
|
||||
}
|
||||
};
|
||||
if (defined($message)) {
|
||||
$self->{output}->output_add(long_msg => 'filter status issue: ' . $message);
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
|
||||
|
||||
sub custom_status_output {
|
||||
my ($self, %options) = @_;
|
||||
|
@ -85,7 +60,7 @@ sub set_counters {
|
|||
closure_custom_calc => $self->can('custom_status_calc'),
|
||||
closure_custom_output => $self->can('custom_status_output'),
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => $self->can('custom_status_threshold'),
|
||||
closure_custom_threshold_check => \&catalog_status_threshold,
|
||||
}
|
||||
},
|
||||
];
|
||||
|
@ -115,16 +90,6 @@ sub new {
|
|||
return $self;
|
||||
}
|
||||
|
||||
sub change_macros {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
foreach ('warning_status', 'critical_status') {
|
||||
if (defined($self->{option_results}->{$_})) {
|
||||
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
@ -133,8 +98,7 @@ sub check_options {
|
|||
$self->{option_results}->{remote} = 1;
|
||||
}
|
||||
|
||||
$instance_mode = $self;
|
||||
$self->change_macros();
|
||||
$self->change_macros(macros => ['warning_status', 'critical_status']);
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
|
|
|
@ -24,32 +24,7 @@ use base qw(centreon::plugins::templates::counter);
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $instance_mode;
|
||||
|
||||
sub custom_status_threshold {
|
||||
my ($self, %options) = @_;
|
||||
my $status = 'ok';
|
||||
my $message;
|
||||
|
||||
eval {
|
||||
local $SIG{__WARN__} = sub { $message = $_[0]; };
|
||||
local $SIG{__DIE__} = sub { $message = $_[0]; };
|
||||
|
||||
if (defined($instance_mode->{option_results}->{critical_status}) && $instance_mode->{option_results}->{critical_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{critical_status}") {
|
||||
$status = 'critical';
|
||||
} elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{warning_status}") {
|
||||
$status = 'warning';
|
||||
}
|
||||
};
|
||||
if (defined($message)) {
|
||||
$self->{output}->output_add(long_msg => 'filter status issue: ' . $message);
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
|
||||
|
||||
sub custom_status_output {
|
||||
my ($self, %options) = @_;
|
||||
|
@ -86,7 +61,7 @@ sub set_counters {
|
|||
closure_custom_calc => $self->can('custom_status_calc'),
|
||||
closure_custom_output => $self->can('custom_status_output'),
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => $self->can('custom_status_threshold'),
|
||||
closure_custom_threshold_check => \&catalog_status_threshold,
|
||||
}
|
||||
},
|
||||
];
|
||||
|
@ -116,16 +91,6 @@ sub new {
|
|||
return $self;
|
||||
}
|
||||
|
||||
sub change_macros {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
foreach (('warning_status', 'critical_status')) {
|
||||
if (defined($self->{option_results}->{$_})) {
|
||||
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
@ -134,8 +99,7 @@ sub check_options {
|
|||
$self->{option_results}->{remote} = 1;
|
||||
}
|
||||
|
||||
$instance_mode = $self;
|
||||
$self->change_macros();
|
||||
$self->change_macros(macros => ['warning_status', 'critical_status']);
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
|
|
|
@ -24,32 +24,7 @@ use base qw(centreon::plugins::templates::counter);
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $instance_mode;
|
||||
|
||||
sub custom_status_threshold {
|
||||
my ($self, %options) = @_;
|
||||
my $status = 'ok';
|
||||
my $message;
|
||||
|
||||
eval {
|
||||
local $SIG{__WARN__} = sub { $message = $_[0]; };
|
||||
local $SIG{__DIE__} = sub { $message = $_[0]; };
|
||||
|
||||
if (defined($instance_mode->{option_results}->{critical_status}) && $instance_mode->{option_results}->{critical_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{critical_status}") {
|
||||
$status = 'critical';
|
||||
} elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{warning_status}") {
|
||||
$status = 'warning';
|
||||
}
|
||||
};
|
||||
if (defined($message)) {
|
||||
$self->{output}->output_add(long_msg => 'filter status issue: ' . $message);
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
|
||||
|
||||
sub custom_status_output {
|
||||
my ($self, %options) = @_;
|
||||
|
@ -94,7 +69,7 @@ sub custom_volume_output {
|
|||
sub custom_volume_calc {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{result_values}->{volume} = $instance_mode->convert_to_bytes(raw_value => $options{new_datas}->{$self->{instance} . '_' . $options{extra_options}->{label_ref}});
|
||||
$self->{result_values}->{volume} = $self->{instance_mode}->convert_to_bytes(raw_value => $options{new_datas}->{$self->{instance} . '_' . $options{extra_options}->{label_ref}});
|
||||
$self->{result_values}->{display} = $options{extra_options}->{display_ref};
|
||||
$self->{result_values}->{label} = $options{extra_options}->{label_ref};
|
||||
|
||||
|
@ -131,7 +106,7 @@ sub set_counters {
|
|||
closure_custom_calc => $self->can('custom_status_calc'),
|
||||
closure_custom_output => $self->can('custom_status_output'),
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => $self->can('custom_status_threshold'),
|
||||
closure_custom_threshold_check => \&catalog_status_threshold,
|
||||
}
|
||||
},
|
||||
{ label => 'stage-status-progress', set => {
|
||||
|
@ -205,18 +180,7 @@ sub check_options {
|
|||
$self->{option_results}->{remote} = 1;
|
||||
}
|
||||
|
||||
$instance_mode = $self;
|
||||
$self->change_macros();
|
||||
}
|
||||
|
||||
sub change_macros {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
foreach (('warning_status', 'critical_status')) {
|
||||
if (defined($self->{option_results}->{$_})) {
|
||||
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
|
||||
}
|
||||
}
|
||||
$self->change_macros(macros => ['warning_status', 'critical_status']);
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
|
|
|
@ -24,32 +24,7 @@ use base qw(centreon::plugins::templates::counter);
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $instance_mode;
|
||||
|
||||
sub custom_status_threshold {
|
||||
my ($self, %options) = @_;
|
||||
my $status = 'ok';
|
||||
my $message;
|
||||
|
||||
eval {
|
||||
local $SIG{__WARN__} = sub { $message = $_[0]; };
|
||||
local $SIG{__DIE__} = sub { $message = $_[0]; };
|
||||
|
||||
if (defined($instance_mode->{option_results}->{critical_status}) && $instance_mode->{option_results}->{critical_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{critical_status}") {
|
||||
$status = 'critical';
|
||||
} elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{warning_status}") {
|
||||
$status = 'warning';
|
||||
}
|
||||
};
|
||||
if (defined($message)) {
|
||||
$self->{output}->output_add(long_msg => 'filter status issue: ' . $message);
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
|
||||
|
||||
sub custom_status_output {
|
||||
my ($self, %options) = @_;
|
||||
|
@ -85,7 +60,7 @@ sub set_counters {
|
|||
closure_custom_calc => $self->can('custom_status_calc'),
|
||||
closure_custom_output => $self->can('custom_status_output'),
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => $self->can('custom_status_threshold'),
|
||||
closure_custom_threshold_check => \&catalog_status_threshold,
|
||||
}
|
||||
},
|
||||
];
|
||||
|
@ -115,16 +90,6 @@ sub new {
|
|||
return $self;
|
||||
}
|
||||
|
||||
sub change_macros {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
foreach (('warning_status', 'critical_status')) {
|
||||
if (defined($self->{option_results}->{$_})) {
|
||||
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
@ -133,8 +98,7 @@ sub check_options {
|
|||
$self->{option_results}->{remote} = 1;
|
||||
}
|
||||
|
||||
$instance_mode = $self;
|
||||
$self->change_macros();
|
||||
$self->change_macros(macros => ['warning_status', 'critical_status']);
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
|
|
|
@ -24,32 +24,7 @@ use base qw(centreon::plugins::templates::counter);
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $instance_mode;
|
||||
|
||||
sub custom_status_threshold {
|
||||
my ($self, %options) = @_;
|
||||
my $status = 'ok';
|
||||
my $message;
|
||||
|
||||
eval {
|
||||
local $SIG{__WARN__} = sub { $message = $_[0]; };
|
||||
local $SIG{__DIE__} = sub { $message = $_[0]; };
|
||||
|
||||
if (defined($instance_mode->{option_results}->{critical_status}) && $instance_mode->{option_results}->{critical_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{critical_status}") {
|
||||
$status = 'critical';
|
||||
} elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{warning_status}") {
|
||||
$status = 'warning';
|
||||
}
|
||||
};
|
||||
if (defined($message)) {
|
||||
$self->{output}->output_add(long_msg => 'filter status issue: ' . $message);
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
|
||||
|
||||
sub custom_status_output {
|
||||
my ($self, %options) = @_;
|
||||
|
@ -87,7 +62,7 @@ sub set_counters {
|
|||
closure_custom_calc => $self->can('custom_status_calc'),
|
||||
closure_custom_output => $self->can('custom_status_output'),
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => $self->can('custom_status_threshold'),
|
||||
closure_custom_threshold_check => \&catalog_status_threshold,
|
||||
}
|
||||
},
|
||||
];
|
||||
|
@ -117,16 +92,6 @@ sub new {
|
|||
return $self;
|
||||
}
|
||||
|
||||
sub change_macros {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
foreach (('warning_status', 'critical_status')) {
|
||||
if (defined($self->{option_results}->{$_})) {
|
||||
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
@ -135,8 +100,7 @@ sub check_options {
|
|||
$self->{option_results}->{remote} = 1;
|
||||
}
|
||||
|
||||
$instance_mode = $self;
|
||||
$self->change_macros();
|
||||
$self->change_macros(macros => ['warning_status', 'critical_status']);
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
|
|
Loading…
Reference in New Issue