Merge pull request #14 from centreon/master

Merge from master
This commit is contained in:
Sims24 2016-05-04 17:45:25 +02:00
commit 7bc01a7582
38 changed files with 1540 additions and 93 deletions

View File

@ -173,7 +173,9 @@ sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'job', type => 1, cb_prefix_output => 'prefix_job_output', message_multiple => 'All jobs are ok', skipped_code => { -11 => 1 } }
{ name => 'policy', type => 2, cb_prefix_output => 'prefix_policy_output', cb_long_output => 'policy_long_output', message_multiple => 'All policies are ok',
group => [ { name => 'job', cb_prefix_output => 'prefix_job_output', skipped_code => { -11 => 1 } } ]
}
];
$self->{maps_counters}->{job} = [
@ -244,10 +246,22 @@ sub check_options {
$self->change_macros();
}
sub policy_long_output {
my ($self, %options) = @_;
return "checking policy '" . $options{instance_value}->{display} . "'";
}
sub prefix_policy_output {
my ($self, %options) = @_;
return "policy '" . $options{instance_value}->{display} . "' ";
}
sub prefix_job_output {
my ($self, %options) = @_;
return "Job '" . $options{instance_value}->{display} . "' ";
return "job '" . $options{instance_value}->{display} . "' ";
}
sub change_macros {
@ -291,32 +305,34 @@ sub manage_selection {
command => $self->{option_results}->{command},
command_path => $self->{option_results}->{command_path},
command_options => $self->{option_results}->{command_options});
$self->{job} = {};
$self->{policy} = {};
my $current_time = time();
foreach my $line (split /\n/, $stdout) {
my @values = split /,/, $line;
my ($job_id, $job_type, $job_state, $job_status, $job_pname, $job_start_time, $job_end_time, $job_kb) =
($values[0], $values[1], $values[2], $values[3], $values[4], $values[8], $values[10], $values[14]);
my $display = (defined($job_pname) ? $job_pname : '-') . '/' . $job_id;
$job_pname = defined($job_pname) && $job_pname ne '' ? $job_pname : 'unknown';
$job_status = defined($job_status) && $job_status =~ /[0-9]/ ? $job_status : undef;
if (defined($self->{option_results}->{filter_policy_name}) && $self->{option_results}->{filter_policy_name} ne '' &&
$job_pname !~ /$self->{option_results}->{filter_policy_name}/) {
$self->{output}->output_add(long_msg => "skipping '" . $display . "': no matching filter.", debug => 1);
$self->{output}->output_add(long_msg => "skipping job '" . $job_pname . "/" . $job_id . "': no matching filter.", debug => 1);
next;
}
if (defined($self->{option_results}->{filter_end_time}) && $self->{option_results}->{filter_end_time} =~ /[0-9]+/ &&
defined($job_end_time) && $job_end_time =~ /[0-9]+/ && $job_end_time < $current_time - $self->{option_results}->{filter_end_time}) {
$self->{output}->output_add(long_msg => "skipping '" . $display . "': too old.", debug => 1);
$self->{output}->output_add(long_msg => "skipping job '" . $job_pname . "/" . $job_id . "': too old.", debug => 1);
next;
}
$self->{policy}->{$job_pname} = { job => {}, display => $job_pname } if (!defined($self->{policy}->{$job_pname}));
my $elapsed_time = $current_time - $job_start_time;
$self->{job}->{$display} = { display => $display, elapsed => $elapsed_time,
status => $job_status, state => $job_state{$job_state}, type => $job_type{$job_type},
kb => defined($job_kb) && $job_kb =~ /[0-9]+/ ? $job_kb : undef };
$self->{policy}->{$job_pname}->{job}->{$job_id} = { display => $job_id, elapsed => $elapsed_time,
status => $job_status, state => $job_state{$job_state}, type => $job_type{$job_type},
kb => defined($job_kb) && $job_kb =~ /[0-9]+/ ? $job_kb : undef };
}
if (scalar(keys %{$self->{job}}) <= 0) {
if (scalar(keys %{$self->{policy}}) <= 0) {
$self->{output}->add_option_msg(short_msg => "No job found.");
$self->{output}->option_exit();
}

View File

@ -0,0 +1,256 @@
#
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
package apps::backup::netbackup::local::mode::tapeusage;
use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
use centreon::plugins::misc;
my $instance_mode;
sub custom_usage_perfdata {
my ($self, %options) = @_;
my $label = 'used';
my $value_perf = $self->{result_values}->{used};
if (defined($instance_mode->{option_results}->{free})) {
$label = 'free';
$value_perf = $self->{result_values}->{free};
}
my %total_options = ();
if ($instance_mode->{option_results}->{units} eq '%') {
$total_options{total} = $self->{result_values}->{total};
$total_options{cast_int} = 1;
}
$self->{output}->perfdata_add(label => $label,
value => $value_perf,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{label}, %total_options),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{label}, %total_options),
min => 0, max => $self->{result_values}->{total});
}
sub custom_usage_threshold {
my ($self, %options) = @_;
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}->{prct_used};
$threshold_value = $self->{result_values}->{prct_free} if (defined($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;
}
sub custom_usage_output {
my ($self, %options) = @_;
my $msg = sprintf("Total: %s Used: %s (%.2f%%) Free: %s (%.2f%%)",
$self->{result_values}->{total},
$self->{result_values}->{used}, $self->{result_values}->{prct_used},
$self->{result_values}->{free}, $self->{result_values}->{prct_free});
return $msg;
}
sub custom_usage_calc {
my ($self, %options) = @_;
$self->{result_values}->{total} = $options{new_datas}->{$self->{instance} . '_total'};
$self->{result_values}->{used} = $options{new_datas}->{$self->{instance} . '_used'};
$self->{result_values}->{prct_used} = $self->{result_values}->{used} * 100 / $self->{result_values}->{total};
$self->{result_values}->{free} = $self->{result_values}->{total} - $self->{result_values}->{used};
$self->{result_values}->{prct_free} = 100 - $self->{result_values}->{prct_used};
return 0;
}
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'global', type => 0 }
];
$self->{maps_counters}->{global} = [
{ label => 'usage', set => {
key_values => [ { name => 'total' }, { name => 'used' } ],
closure_custom_calc => \&custom_usage_calc,
closure_custom_output => \&custom_usage_output,
closure_custom_perfdata => \&custom_usage_perfdata,
closure_custom_threshold_check => \&custom_usage_threshold,
}
},
];
}
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' },
"remote" => { name => 'remote' },
"ssh-option:s@" => { name => 'ssh_option' },
"ssh-path:s" => { name => 'ssh_path' },
"ssh-command:s" => { name => 'ssh_command', default => 'ssh' },
"timeout:s" => { name => 'timeout', default => 30 },
"sudo" => { name => 'sudo' },
"command:s" => { name => 'command', default => 'vmquery' },
"command-path:s" => { name => 'command_path' },
"command-options:s" => { name => 'command_options', default => '-a -w' },
"filter-scratch:s" => { name => 'filter_scratch', default => 'scratch' },
"units:s" => { name => 'units', default => '%' },
"free" => { name => 'free' },
});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::check_options(%options);
$instance_mode = $self;
}
sub manage_selection {
my ($self, %options) = @_;
my ($stdout) = centreon::plugins::misc::execute(output => $self->{output},
options => $self->{option_results},
sudo => $self->{option_results}->{sudo},
command => $self->{option_results}->{command},
command_path => $self->{option_results}->{command_path},
command_options => $self->{option_results}->{command_options});
$self->{global} = { total => 0, used => 0 };
#media optical media barcode robot robot robot robot side/ volume prev # of max # of create assigned first mount last mount expiration off sent off return off off
#ID partner type barcode partner host type # slot face group pool pool # pool mounts mounts cleanings datetime datetime datetime datetime datetime status offsite location datetime datetime slot ses id version description
#--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#000001 - HCART2 000001L5 - - NONE - - - --- VP-05WEEKS-EXT 9 VP-SCRATCH 1250 0 - 30/11/2012 15:30 29/02/2016 20:43 27/01/2013 17:57 02/03/2016 01:36 00/00/0000 00:00 0 - 00/00/0000 00:00 00/00/0000 00:00 - - 50 ---
#000002 - HCART2 000002L5 - XXX-NBU-XXX TLD 0 8 - 000_00000_TLD VP-SCRATCH 4 VP-05WEEKS-EXT
# Remove header
$stdout =~ s/\x00//msg;
$stdout =~ s/^.*?----.*?\n//ms;
foreach my $line (split /\n/, $stdout) {
$line =~ /^\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+(\S+)\s+\S+\s+\S+\s+(\S+)\s+\S+\s+\S+\s+(\S+)/;
my ($robot_host, $robot_slot, $pool) = ($1, $2, $3);
next if ($robot_slot !~ /[0-9]/);
$self->{global}->{total}++;
if (defined($self->{option_results}->{filter_scratch}) && $self->{option_results}->{filter_scratch} ne '' &&
$pool !~ /$self->{option_results}->{filter_scratch}/i) {
$self->{global}->{used}++;
}
}
if ($self->{global}->{total} == 0) {
$self->{output}->add_option_msg(short_msg => "No tape found.");
$self->{output}->option_exit();
}
}
1;
__END__
=head1 MODE
Check tapes available in library.
=over 8
=item B<--remote>
Execute command remotely in 'ssh'.
=item B<--hostname>
Hostname to query (need --remote).
=item B<--ssh-option>
Specify multiple options like the user (example: --ssh-option='-l=centreon-engine' --ssh-option='-p=52').
=item B<--ssh-path>
Specify ssh command path (default: none)
=item B<--ssh-command>
Specify ssh command (default: 'ssh'). Useful to use 'plink'.
=item B<--timeout>
Timeout in seconds for the command (Default: 30).
=item B<--sudo>
Use 'sudo' to execute the command.
=item B<--command>
Command to get information (Default: 'vmquery').
Can be changed if you have output in a file.
=item B<--command-path>
Command path (Default: none).
=item B<--command-options>
Command options (Default: '-a -w').
=item B<--filter-scratch>
Filter tape scratch (Default: 'scratch').
=item B<--units>
Units of thresholds (Default: '%') ('%', 'absolute').
=item B<--free>
Thresholds are on free tape left.
=item B<--warning-*>
Threshold warning.
Can be: 'usage'.
=item B<--critical-*>
Threshold critical.
Can be: 'usage'.
=back
=cut

View File

@ -28,7 +28,6 @@ sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
# $options->{options} = options object
$self->{version} = '0.1';
%{$self->{modes}} = (
@ -37,6 +36,7 @@ sub new {
'drive-status' => 'apps::backup::netbackup::local::mode::drivestatus',
'job-status' => 'apps::backup::netbackup::local::mode::jobstatus',
'list-policies' => 'apps::backup::netbackup::local::mode::listpolicies',
'tape-usage' => 'apps::backup::netbackup::local::mode::tapeusage',
);
return $self;

View File

@ -79,7 +79,9 @@ sub manage_selection {
foreach my $obj (in $resultset) {
my $name = $obj->{Name};
my $state = $map_state{$obj->{State}};
my $class = $map_class{$obj->{ResourceClass}};
my $class = defined($obj->{ResourceClass}) ? $map_class{$obj->{ResourceClass}} : '-';
my $id = defined($obj->{Id}) ? $obj->{Id} : $name;
my $owner_node = defined($obj->{OwnerNode}) ? $obj->{OwnerNode} : '-';
if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
$name !~ /$self->{option_results}->{filter_name}/) {
@ -87,8 +89,8 @@ sub manage_selection {
next;
}
$self->{resources}->{$obj->{Id}} = { name => $name, state => $state, owner_node => $obj->{OwnerNode},
class => $class };
$self->{resources}->{$id} = { name => $name, state => $state, owner_node => $owner_node,
class => $class };
}
}

View File

@ -154,6 +154,7 @@ sub manage_selection {
foreach my $obj (in $resultset) {
my $name = $obj->{Name};
my $state = $map_state{$obj->{State}};
my $id = defined($obj->{ID}) ? $obj->{ID} : $name;
if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
$name !~ /$self->{option_results}->{filter_name}/) {
@ -161,7 +162,7 @@ sub manage_selection {
next;
}
$self->{network}->{$obj->{ID}} = { display => $name, state => $state };
$self->{network}->{$id} = { display => $name, state => $state };
}
}

View File

@ -196,15 +196,17 @@ sub manage_selection {
foreach my $obj (in $resultset) {
my $name = $obj->{Name};
my $state = $map_state{$obj->{State}};
my $id = defined($obj->{Id}) ? $obj->{Id} : $name;
my $owner_node = defined($obj->{OwnerNode}) ? $obj->{OwnerNode} : '-';
if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
$name !~ /$self->{option_results}->{filter_name}/) {
$self->{output}->output_add(long_msg => "Skipping '" . $name . "': no matching filter.", debug => 1);
$self->{output}->output_add(long_msg => "skipping '" . $name . "': no matching filter.", debug => 1);
next;
}
$self->{rg}->{$obj->{Id}} = { display => $name, state => $state, owner_node => $obj->{OwnerNode},
preferred_owners => defined($preferred_nodes->{$name}) ? $preferred_nodes->{$name} : [] };
$self->{rg}->{$id} = { display => $name, state => $state, owner_node => $owner_node,
preferred_owners => defined($preferred_nodes->{$name}) ? $preferred_nodes->{$name} : [] };
}
}

View File

@ -159,14 +159,16 @@ sub manage_selection {
foreach my $obj (in $resultset) {
my $name = $obj->{Name};
my $state = $map_state{$obj->{State}};
my $id = defined($obj->{Id}) ? $obj->{Id} : $name;
my $owner_node = defined($obj->{OwnerNode}) ? $obj->{OwnerNode} : '-';
if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
$name !~ /$self->{option_results}->{filter_name}/) {
$self->{output}->output_add(long_msg => "Skipping '" . $name . "': no matching filter.", debug => 1);
$self->{output}->output_add(long_msg => "skipping '" . $name . "': no matching filter.", debug => 1);
next;
}
$self->{resource}->{$obj->{Id}} = { display => $name, state => $state, owner_node => $obj->{OwnerNode} };
$self->{resource}->{$id} = { display => $name, state => $state, owner_node => $owner_node };
}
}

View File

@ -74,7 +74,7 @@ sub check_options {
$self->{output}->option_exit();
}
$self->{option_results}->{url_path} = "/search/issues?q=state:open+repo:" . $self->{option_results}->{owner} . "/" . $self->{option_results}->{repository};
$self->{option_results}->{url_path} = "/search/issues?q=state:open+is:issue+repo:" . $self->{option_results}->{owner} . "/" . $self->{option_results}->{repository};
if (defined($self->{option_results}->{label}) && $self->{option_results}->{label} ne '') {
$self->{option_results}->{url_path} .= "+label:" . $self->{option_results}->{label};
}

View File

@ -77,7 +77,7 @@ sub run {
}
my $localtime = time();
my $offset = ($ntp{'Receive Timestamp'} - $ntp{'Originate Timestamp'}) + ($ntp{'Transmit Timestamp'} - $localtime) / 2);
my $offset = (($ntp{'Receive Timestamp'} - $ntp{'Originate Timestamp'}) + ($ntp{'Transmit Timestamp'} - $localtime)) / 2;
my $exit = $self->{perfdata}->threshold_check(value => $offset,
threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);

View File

@ -113,7 +113,7 @@ Check send a message to a SMTP Server.
=item B<--hostname>
IP Addr/FQDN of the ftp host
IP Addr/FQDN of the smtp host
=item B<--port>

View File

@ -65,7 +65,7 @@ sub manage_selection {
my $webcontent = $self->{http}->request();
while ($webcontent =~ m/(.*):(.*):(.*):(.*)/g) {
while ($webcontent =~ /^(.*?):(.*?):(.*?):(.*)/mg) {
my ($context, $state, $sessions, $contextpath) = ($1, $2, $3, $4);
next if (defined($self->{option_results}->{filter_path}) && $self->{option_results}->{filter_path} ne '' &&

View File

@ -66,7 +66,6 @@ sub run {
my ($self, %options) = @_;
$self->{connector} = $options{custom};
$self->{connector}->set_discovery();
$self->{connector}->add_params(params => $self->{option_results},
command => 'timehost');
$self->{connector}->run();

View File

@ -149,7 +149,7 @@ sub check_options {
sub skip_global {
my ($self, %options) = @_;
scalar(keys %{$self->{ap}}) > 1 ? return(0) : return(1);
scalar(keys %{$self->{ap}}) == 1 ? return(1) : return(0);
}
sub prefix_ap_output {
@ -208,7 +208,7 @@ sub manage_selection {
my $result3 = $options{snmp}->map_instance(mapping => $mapping3, results => $self->{results}->{ $mapping3->{bsnAPAdminStatus}->{oid} }, instance => $instance);
if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
$result->{bsnAPName} !~ /$self->{option_results}->{filter_name}/) {
$self->{output}->output_add(long_msg => "Skipping '" . $result->{bsnAPName} . "': no matching filter.", debug => 1);
$self->{output}->output_add(long_msg => "skipping '" . $result->{bsnAPName} . "': no matching filter.", debug => 1);
next;
}
@ -220,8 +220,7 @@ sub manage_selection {
}
if (scalar(keys %{$self->{ap}}) <= 0) {
$self->{output}->output_add(severity => 'OK',
short_msg => 'No AP associated (can be: slave wireless controller or your filter)');
$self->{output}->output_add(long_msg => 'no AP associated (can be: slave wireless controller or your filter)');
}
}

View File

@ -214,11 +214,13 @@ sub unix_execute {
sub mymodule_load {
my (%options) = @_;
my $file;
($file = $options{module} . ".pm") =~ s{::}{/}g;
($file = ($options{module} =~ /\.pm$/ ? $options{module} : $options{module} . ".pm")) =~ s{::}{/}g;
eval {
local $SIG{__DIE__} = 'IGNORE';
require $file;
$file =~ s{/}{::}g;
$file =~ s/\.pm$//;
};
if ($@) {
return 1 if (defined($options{no_quit}) && $options{no_quit} == 1);
@ -226,7 +228,7 @@ sub mymodule_load {
$options{output}->add_option_msg(short_msg => $options{error_msg});
$options{output}->option_exit();
}
return 0;
return wantarray ? (0, $file) : 0;
}
sub backtick {
@ -372,8 +374,10 @@ sub change_seconds {
{ unit => 'm', value => 60 },
{ unit => 's', value => 1 },
];
my %values = ('y' => 1, 'M' => 2, 'w' => 3, 'd' => 4, 'h' => 5, 'm' => 6, 's' => 7);
foreach (@$periods) {
next if (defined($options{start}) && $values{$_->{unit}} < $values{$options{start}});
my $count = int($options{value} / $_->{value});
next if ($count == 0);

View File

@ -273,8 +273,9 @@ sub run {
$self->check_relaunch();
centreon::plugins::misc::mymodule_load(output => $self->{output}, module => $self->{plugin},
error_msg => "Cannot load module --plugin.");
(undef, $self->{plugin}) =
centreon::plugins::misc::mymodule_load(output => $self->{output}, module => $self->{plugin},
error_msg => "Cannot load module --plugin.");
my $plugin = $self->{plugin}->new(options => $self->{options}, output => $self->{output});
$plugin->init(help => $self->{help},
version => $self->{version});

View File

@ -115,8 +115,8 @@ sub init {
error_msg => "Cannot load module --mode.");
$self->{mode} = $self->{modes}{$self->{mode_name}}->new(options => $self->{options}, output => $self->{output}, mode => $self->{mode_name});
} elsif (defined($self->{dynmode_name}) && $self->{dynmode_name} ne '') {
centreon::plugins::misc::mymodule_load(output => $self->{output}, module => $self->{dynmode_name},
error_msg => "Cannot load module --dyn-mode.");
(undef, $self->{dynmode_name}) = centreon::plugins::misc::mymodule_load(output => $self->{output}, module => $self->{dynmode_name},
error_msg => "Cannot load module --dyn-mode.");
$self->{mode} = $self->{dynmode_name}->new(options => $self->{options}, output => $self->{output}, mode => $self->{dynmode_name});
} else {
$self->{output}->add_option_msg(short_msg => "Need to specify '--mode' or '--dyn-mode' option.");

View File

@ -86,8 +86,8 @@ sub init {
error_msg => "Cannot load module --mode.");
$self->{mode} = $self->{modes}{$self->{mode_name}}->new(options => $self->{options}, output => $self->{output}, mode => $self->{mode_name});
} elsif (defined($self->{dynmode_name}) && $self->{dynmode_name} ne '') {
centreon::plugins::misc::mymodule_load(output => $self->{output}, module => $self->{dynmode_name},
error_msg => "Cannot load module --dyn-mode.");
(undef, $self->{dynmode_name}) = centreon::plugins::misc::mymodule_load(output => $self->{output}, module => $self->{dynmode_name},
error_msg => "Cannot load module --dyn-mode.");
$self->{mode} = $self->{dynmode_name}->new(options => $self->{options}, output => $self->{output}, mode => $self->{dynmode_name});
} else {
$self->{output}->add_option_msg(short_msg => "Need to specify '--mode' or '--dyn-mode' option.");

View File

@ -91,8 +91,8 @@ sub init {
error_msg => "Cannot load module --mode.");
$self->{mode} = $self->{modes}{$self->{mode_name}}->new(options => $self->{options}, output => $self->{output}, mode => $self->{mode_name});
} elsif (defined($self->{dynmode_name}) && $self->{dynmode_name} ne '') {
centreon::plugins::misc::mymodule_load(output => $self->{output}, module => $self->{dynmode_name},
error_msg => "Cannot load module --dyn-mode.");
(undef, $self->{dynmode_name}) = centreon::plugins::misc::mymodule_load(output => $self->{output}, module => $self->{dynmode_name},
error_msg => "Cannot load module --dyn-mode.");
$self->{mode} = $self->{dynmode_name}->new(options => $self->{options}, output => $self->{output}, mode => $self->{dynmode_name});
} else {
$self->{output}->add_option_msg(short_msg => "Need to specify '--mode' or '--dyn-mode' option.");

View File

@ -107,8 +107,8 @@ sub init {
error_msg => "Cannot load module --mode.");
$self->{mode} = $self->{modes}{$self->{mode_name}}->new(options => $self->{options}, output => $self->{output}, mode => $self->{mode_name});
} elsif (defined($self->{dynmode_name}) && $self->{dynmode_name} ne '') {
centreon::plugins::misc::mymodule_load(output => $self->{output}, module => $self->{dynmode_name},
error_msg => "Cannot load module --dyn-mode.");
(undef, $self->{dynmode_name}) = centreon::plugins::misc::mymodule_load(output => $self->{output}, module => $self->{dynmode_name},
error_msg => "Cannot load module --dyn-mode.");
$self->{mode} = $self->{dynmode_name}->new(options => $self->{options}, output => $self->{output}, mode => $self->{dynmode_name});
} else {
$self->{output}->add_option_msg(short_msg => "Need to specify '--mode' or '--dyn-mode' option.");

View File

@ -91,8 +91,8 @@ sub init {
error_msg => "Cannot load module --mode.");
$self->{mode} = $self->{modes}{$self->{mode_name}}->new(options => $self->{options}, output => $self->{output}, mode => $self->{mode_name});
} elsif (defined($self->{dynmode_name}) && $self->{dynmode_name} ne '') {
centreon::plugins::misc::mymodule_load(output => $self->{output}, module => $self->{dynmode_name},
error_msg => "Cannot load module --dyn-mode.");
(undef, $self->{dynmode_name}) = centreon::plugins::misc::mymodule_load(output => $self->{output}, module => $self->{dynmode_name},
error_msg => "Cannot load module --dyn-mode.");
$self->{mode} = $self->{dynmode_name}->new(options => $self->{options}, output => $self->{output}, mode => $self->{dynmode_name});
} else {
$self->{output}->add_option_msg(short_msg => "Need to specify '--mode' or '--dyn-mode' option.");

View File

@ -190,13 +190,16 @@ sub run_instances {
my ($self, %options) = @_;
return undef if (defined($options{config}->{cb_init}) && $self->call_object_callback(method_name => $options{config}->{cb_init}) == 1);
my $display_status_lo = defined($options{display_status_long_output}) && $options{display_status_long_output} == 1 ? 1 : 0;
my $resume = defined($options{resume}) && $options{resume} == 1 ? 1 : 0;
$self->{lproblems} = 0;
$self->{multiple} = 1;
if (scalar(keys %{$self->{$options{config}->{name}}}) == 1) {
$self->{multiple} = 0;
}
if ($self->{multiple} == 1) {
if ($self->{multiple} == 1 && $resume == 0) {
$self->{output}->output_add(severity => 'OK',
short_msg => $options{config}->{message_multiple});
}
@ -230,6 +233,7 @@ sub run_instances {
$long_msg_append = $message_separator;
if (!$self->{output}->is_status(litteral => 1, value => $exit2, compare => 'ok')) {
$self->{lproblems}++;
$short_msg .= $short_msg_append . $output;
$short_msg_append = $message_separator;
}
@ -246,8 +250,13 @@ sub run_instances {
if (defined($options{config}->{cb_suffix_output}));
$suffix_output = '' if (!defined($suffix_output));
$self->{output}->output_add(long_msg => "${prefix_output}${long_msg}${suffix_output}");
my $exit = $self->{output}->get_most_critical(status => [ @exits ]);
$self->{output}->output_add(long_msg => ($display_status_lo == 1 ? lc($exit) . ': ' : '') . "${prefix_output}${long_msg}${suffix_output}");
if ($resume == 1) {
$self->{most_critical_instance} = $self->{output}->get_most_critical(status => [ $self->{most_critical_instance}, $exit ]);
next;
}
if (!$self->{output}->is_status(litteral => 1, value => $exit, compare => 'ok')) {
$self->{output}->output_add(severity => $exit,
short_msg => "${prefix_output}${short_msg}${suffix_output}"
@ -260,6 +269,57 @@ sub run_instances {
}
}
sub run_group {
my ($self, %options) = @_;
my $multiple = 1;
if (scalar(keys %{$self->{$options{config}->{name}}}) == 1) {
$multiple = 0;
}
if ($multiple == 1) {
$self->{output}->output_add(severity => 'OK',
short_msg => $options{config}->{message_multiple});
}
my ($global_exit, $total_problems) = ([], 0);
foreach my $id (sort keys %{$self->{$options{config}->{name}}}) {
$self->{most_critical_instance} = 'ok';
if (defined($options{config}->{cb_long_output})) {
$self->{output}->output_add(long_msg => $self->call_object_callback(method_name => $options{config}->{cb_long_output},
instance_value => $self->{$options{config}->{name}}->{$id}));
}
foreach my $group (@{$options{config}->{group}}) {
$self->{$group->{name}} = $self->{$options{config}->{name}}->{$id}->{$group->{name}};
# we resume datas
$self->run_instances(config => $group, display_status_long_output => 1, resume => 1);
push @{$global_exit}, $self->{most_critical_instance};
$total_problems += $self->{lproblems};
my $prefix_output;
$prefix_output = $self->call_object_callback(method_name => $options{config}->{cb_prefix_output}, instance_value => $self->{$options{config}->{name}}->{$id})
if (defined($options{config}->{cb_prefix_output}));
$prefix_output = '' if (!defined($prefix_output));
if ($multiple == 0) {
$self->{output}->output_add(severity => $self->{most_critical_instance},
short_msg => "${prefix_output}$self->{lproblems} problem(s) detected");
}
}
}
if ($multiple == 1) {
my $exit = $self->{output}->get_most_critical(status => [ @{$global_exit} ]);
if (!$self->{output}->is_status(litteral => 1, value => $exit, compare => 'ok')) {
$self->{output}->output_add(severity => $exit,
short_msg => "$total_problems problem(s) detected");
}
}
}
sub run {
my ($self, %options) = @_;
@ -277,6 +337,8 @@ sub run {
$self->run_global(config => $entry);
} elsif ($entry->{type} == 1) {
$self->run_instances(config => $entry);
} elsif ($entry->{type} == 2) {
$self->run_group(config => $entry);
}
}

View File

@ -39,6 +39,7 @@ sub set_system {
#$self->{cb_hook1} = 'callbackname'; # before the loads
#$self->{cb_hook2} = 'callbackname'; # between loads and requests
#$self->{cb_hook3} = 'callbackname'; # after requests
#$self->{cb_hook4} = 'callbackname'; # after output
# Example for threshold:
#$self->{thresholds} = {
@ -283,6 +284,8 @@ sub run {
short_msg => 'No components are checked.');
}
$self->call_object_callback(method_name => $self->{cb_hook4}, %options);
$self->{output}->display();
$self->{output}->exit();
}

View File

@ -45,18 +45,17 @@ sub check_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();
$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();
$self->{output}->add_option_msg(short_msg => "Wrong critical threshold '" . $self->{option_results}->{critical} . "'.");
$self->{output}->option_exit();
}
}
sub run {
my ($self, %options) = @_;
# $options{sql} = sqlmode object
if (ref($options{sql}) ne 'ARRAY') {
$self->{output}->add_option_msg(short_msg => "Need to use --multiple options.");
@ -232,7 +231,7 @@ sub run {
my $slave_position = $result2->{Read_Master_Log_Pos}; # 'Read_Master_Log_Pos'
my $num_sec_lates = $result2->{Seconds_Behind_Master};
my $exit_code_sec = $self->{perfdata}->threshold_check(value => $num_sec_lates, threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
my $exit_code_sec = $self->{perfdata}->threshold_check(value => $num_sec_lates, threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
if (!$self->{output}->is_status(value => $exit_code_sec, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit_code_sec,
short_msg => sprintf("Slave has %d seconds latency behind master", $num_sec_lates));
@ -262,51 +261,63 @@ sub run {
$position_status_error .= " Slave replication has connection issue with the master.";
} elsif (($master_file ne $slave_file || $master_position != $slave_position) && $slave_sql_thread_warning == 0) {
$position_status = -1;
$position_status_error .= " Slave replication is late but it's progressing..";
$position_status_error .= " Slave replication is late but it's progressing.";
} elsif (($master_file ne $slave_file || $master_position != $slave_position) && $slave_sql_thread_ok == 0) {
$position_status = -1;
$position_status_error .= " Slave replication is late but it's progressing..";
$position_status_error .= " Slave replication is late but it's progressing.";
} else {
$master_file =~ /(\d+)$/;
my $master_bin_num = $1;
$slave_file =~ /(\d+)$/;
my $slave_bin_num = $1;
my $diff_binlog = abs($master_bin_num - $slave_bin_num);
# surely of missconfiguration of the plugin
if ($diff_binlog > 1 && $num_sec_lates < 10) {
$position_status = -3;
$position_status_error .= " Surely a configuration problem of the plugin (not good master and slave server used)";
}
}
}
}
$self->replication_add($slave_status, "Slave Thread Status", $slave_status_error);
$self->replication_add($position_status, "Position Status", $position_status_error);
$self->replication_add($position_status, "Position Status", $position_status_error);
$self->{output}->display();
$self->{output}->exit();
}
sub replication_add {
my ($self, $lstate, $str_display, $lerr) = @_;
my $status;
my ($self, $lstate, $str_display, $lerr) = @_;
my $status;
my $status_msg;
if ($lstate == 0) {
$status = 'OK';
} elsif ($lstate == -1) {
$status = 'WARNING';
} elsif ($lstate == -2) {
$status = 'CRITICAL';
if ($lstate == 0) {
$status = 'OK';
} elsif ($lstate == -1) {
$status = 'WARNING';
} elsif ($lstate == -2) {
$status = 'CRITICAL';
$status_msg = 'SKIP';
} else {
$status = 'CRITICAL';
}
} elsif ($lstate == -3) {
$status = 'UNKNOWN';
} else {
$status = 'CRITICAL';
}
my $output;
if (defined($lerr) && $lerr ne "") {
$output = $str_display . " [" . (defined($status_msg) ? $status_msg : $status) . "] [" . $lerr . "]";
} else {
$output = $str_display . " [" . (defined($status_msg) ? $status_msg : $status) . "]";
}
if (defined($lerr) && $lerr ne "") {
$output = $str_display . " [" . (defined($status_msg) ? $status_msg : $status) . "] [" . $lerr . "]";
} else {
$output = $str_display . " [" . (defined($status_msg) ? $status_msg : $status) . "]";
}
if (!$self->{output}->is_status(value => $status, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $status,
short_msg => $output);
}
$self->{output}->output_add(long_msg => $output);
$self->{output}->output_add(long_msg => $output);
}
1;

View File

@ -0,0 +1,218 @@
#
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
package database::oracle::mode::datafilesstatus;
use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'df', type => 1, cb_prefix_output => 'prefix_df_output', message_multiple => 'All data files are ok' },
];
$self->{maps_counters}->{df} = [
{ label => 'status', threshold => 0, set => {
key_values => [ { name => 'status' }, { name => 'display' } ],
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_threshold_output'),
}
},
{ label => 'online-status', threshold => 0, set => {
key_values => [ { name => 'online_status' }, { name => 'display' } ],
closure_custom_calc => $self->can('custom_online_status_calc'),
closure_custom_output => $self->can('custom_status_output'),
closure_custom_perfdata => sub { return 0; },
closure_custom_threshold_check => $self->can('custom_threshold_output'),
}
},
];
}
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_' . $self->{result_values}->{label_th}}) && $instance_mode->{option_results}->{'critical_' . $self->{result_values}->{label_th}} ne '' &&
eval "$instance_mode->{option_results}->{'critical_' . $self->{result_values}->{label_th}}") {
$status = 'critical';
} elsif (defined($instance_mode->{option_results}->{'warning_' . $self->{result_values}->{label_th}}) && $instance_mode->{option_results}->{'warning_' . $self->{result_values}->{label_th}} ne '' &&
eval "$instance_mode->{option_results}->{'warning_' . $self->{result_values}->{label_th}}") {
$status = 'warning';
}
};
if (defined($message)) {
$self->{output}->output_add(long_msg => 'filter status issue: ' . $message);
}
return $status;
}
sub custom_status_output {
my ($self, %options) = @_;
my $msg = $self->{result_values}->{label_display} . ' : ' . $self->{result_values}->{$self->{result_values}->{label_th}};
return $msg;
}
sub custom_status_calc {
my ($self, %options) = @_;
$self->{result_values}->{label_display} = 'Status';
$self->{result_values}->{label_th} = 'status';
$self->{result_values}->{status} = $options{new_datas}->{$self->{instance} . '_status'};
$self->{result_values}->{display} = $options{new_datas}->{$self->{instance} . '_display'};
return 0;
}
sub custom_online_status_calc {
my ($self, %options) = @_;
$self->{result_values}->{label_display} = 'Online Status';
$self->{result_values}->{label_th} = 'online_status';
$self->{result_values}->{online_status} = $options{new_datas}->{$self->{instance} . '_online_status'};
$self->{result_values}->{display} = $options{new_datas}->{$self->{instance} . '_display'};
return 0;
}
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 =>
{
"filter-tablespace:s" => { name => 'filter_tablespace' },
"filter-data-file:s" => { name => 'filter_data_file' },
"warning-status:s" => { name => 'warning_status', default => '' },
"critical-status:s" => { name => 'critical_status', default => '' },
"warning-online-status:s" => { name => 'warning_online_status', default => '%{online_status} =~ /sysoff/i' },
"critical-online-status:s" => { name => 'critical_online_status', default => '%{online_status} =~ /offline|recover/i' },
});
return $self;
}
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', 'warning_online_status', 'critical_online_status')) {
if (defined($self->{option_results}->{$_})) {
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
}
}
}
sub prefix_df_output {
my ($self, %options) = @_;
return "Data file '" . $options{instance_value}->{display} . "' ";
}
sub manage_selection {
my ($self, %options) = @_;
$options{sql}->connect();
$options{sql}->query(query => "SELECT file_name, tablespace_name, status, online_status
FROM dba_data_files");
my $result = $options{sql}->fetchall_arrayref();
$self->{df} = {};
foreach my $row (@$result) {
if (defined($self->{option_results}->{filter_data_file}) && $self->{option_results}->{filter_data_file} ne '' &&
$$row[0] !~ /$self->{option_results}->{filter_data_file}/) {
$self->{output}->output_add(long_msg => "skipping '" . $$row[0] . "': no matching filter.", debug => 1);
next;
}
if (defined($self->{option_results}->{filter_tablespace}) && $self->{option_results}->{filter_tablespace} ne '' &&
$$row[1] !~ /$self->{option_results}->{filter_tablespace}/) {
$self->{output}->output_add(long_msg => "skipping '" . $$row[1] . "': no matching filter.", debug => 1);
next
}
$self->{df}->{$$row[1] . '/' . $$row[0]} = { status => $$row[2], online_status => $$row[3], display => $$row[1] . '/' . $$row[0] };
}
}
1;
__END__
=head1 MODE
Check data files status.
=over 8
=item B<--filter-counters>
Only display some counters (regexp can be used).
=item B<--filter-tablespace>
Filter tablespace name (can be a regexp).
=item B<--filter-data-file>
Filter data file name (can be a regexp).
=item B<--warning-status>
Set warning threshold for status (Default: none).
Can used special variables like: %{display}, %{status}
=item B<--critical-status>
Set critical threshold for status (Default: none).
Can used special variables like: %{display}, %{status}
=item B<--warning-online-status>
Set warning threshold for online status (Default: '%{online_status} =~ /sysoff/i').
Can used special variables like: %{display}, %{online_status}
=item B<--critical-online-status>
Set critical threshold for online status (Default: '%{online_status} =~ /offline|recover/i').
Can used special variables like: %{display}, %{online_status}
=back
=cut

View File

@ -29,7 +29,6 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
# $options->{options} = options object
$self->{version} = '0.1';
%{$self->{modes}} = (
@ -37,6 +36,7 @@ sub new {
'connection-time' => 'centreon::common::protocols::sql::mode::connectiontime',
'connected-users' => 'database::oracle::mode::connectedusers',
'corrupted-blocks' => 'database::oracle::mode::corruptedblocks',
'data-files-status' => 'database::oracle::mode::datafilesstatus',
'datacache-hitratio' => 'database::oracle::mode::datacachehitratio',
'process-usage' => 'database::oracle::mode::processusage',
'rman-backup-problems' => 'database::oracle::mode::rmanbackupproblems',

View File

@ -74,7 +74,7 @@ SELECT extract(epoch FROM now()) AS epok
}
my $diff = $result - $ltime;
my $exit_code = $self->{perfdata}->threshold_check(value => $result, threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
my $exit_code = $self->{perfdata}->threshold_check(value => $diff, threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
$self->{output}->output_add(severity => $exit_code,
short_msg => sprintf("%.3fs time diff between servers", $diff));

View File

@ -99,7 +99,7 @@ sub run {
}
my %ntp;
# Need to set following patch: https://rt.cpan.org/Public/Bug/Display.html?id=59607
eval {
%ntp = Net::NTP::get_ntp_response($ntp_hostname, $self->{option_results}->{ntp_port});
};

View File

@ -25,6 +25,7 @@ use base qw(centreon::plugins::mode);
use strict;
use warnings;
use POSIX;
use centreon::plugins::misc;
sub new {
my ($class, %options) = @_;
@ -36,7 +37,6 @@ sub new {
{
"warning:s" => { name => 'warning', },
"critical:s" => { name => 'critical', },
"seconds" => { name => 'seconds', },
"force-oid:s" => { name => 'force_oid', },
});
@ -59,7 +59,6 @@ sub check_options {
sub run {
my ($self, %options) = @_;
# $options{snmp} = snmp object
$self->{snmp} = $options{snmp};
# To be used first for OS
@ -89,8 +88,8 @@ sub run {
min => 0);
$self->{output}->output_add(severity => $exit_code,
short_msg => sprintf("System uptime is: %s",
defined($self->{option_results}->{seconds}) ? floor($value / 100) . " seconds" : floor($value / 86400 / 100) . " days" ));
short_msg => sprintf("System uptime is: %s",
centreon::plugins::misc::change_seconds(value => floor($value / 100), start => 'd')));
$self->{output}->display();
$self->{output}->exit();
@ -114,10 +113,6 @@ Threshold warning in seconds.
Threshold critical in seconds.
=item B<--seconds>
Display uptime in seconds.
=item B<--force-oid>
Can choose your oid (numeric format only).

View File

@ -37,10 +37,10 @@ sub set_counters {
$self->{maps_counters}->{sc} = [
{ label => 'sc-total', set => {
key_values => [ { name => 'display' }, { name => 'used' }, { name => 'total' }, { name => 'type' } ],
closure_custom_calc => \&custom_usage_calc,
closure_custom_output => \&custom_usage_output,
closure_custom_perfdata => \&custom_usage_perfdata,
closure_custom_threshold_check => \&custom_usage_threshold,
closure_custom_calc => $self->can('custom_usage_calc'),
closure_custom_output => $self->can('custom_usage_output'),
closure_custom_perfdata => $self->can('custom_usage_perfdata'),
closure_custom_threshold_check => $self->can('custom_usage_threshold'),
}
},
];
@ -48,10 +48,10 @@ sub set_counters {
$self->{maps_counters}->{volume} = [
{ label => 'volume-usage', set => {
key_values => [ { name => 'display' }, { name => 'used' }, { name => 'total' }, { name => 'type' } ],
closure_custom_calc => \&custom_usage_calc,
closure_custom_output => \&custom_usage_output,
closure_custom_perfdata => \&custom_usage_perfdata,
closure_custom_threshold_check => \&custom_usage_threshold,
closure_custom_calc => $self->can('custom_usage_calc'),
closure_custom_output => $self->can('custom_usage_output'),
closure_custom_perfdata => $self->can('custom_usage_perfdata'),
closure_custom_threshold_check => $self->can('custom_usage_threshold'),
}
},
{ label => 'volume-overhead', set => {

View File

@ -0,0 +1,56 @@
#
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
package storage::emc::symmetrix::dmx34::local::mode::components::config;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
# ---------[ Configuration Information ]---------
#
#...
sub check {
my ($self) = @_;
$self->{output}->output_add(long_msg => "Checking config");
$self->{components}->{config} = {name => 'config', total => 0, skip => 0};
return if ($self->check_filter(section => 'config'));
if ($self->{content_file_health} !~ /----\[ Configuration Information(.*?)----\[/msi) {
$self->{output}->output_add(long_msg => 'skipping: cannot find config');
return ;
}
my $content = $1;
$self->{components}->{config}->{total}++;
# Error if not present:
# CODE OK!
if ($content !~ /CODE OK!/msi) {
$self->{output}->output_add(severity => 'CRITICAL',
short_msg => sprintf("problem of configuration"));
} else {
$self->{output}->output_add(long_msg => sprintf("no configuration problem detected"));
}
}
1;

View File

@ -0,0 +1,92 @@
#
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
package storage::emc::symmetrix::dmx34::local::mode::components::director;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
# ---------------[ Director Status ]-------------
#
# 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16
#
# D ON .. .. .. .. .. .. ON ON .. .. .. .. .. .. ON
# C ON .. .. .. .. .. .. ON ON .. .. .. .. .. .. ON
# B ON .. .. .. .. .. .. DD ON .. .. .. .. .. .. ON
# A ON .. .. .. .. .. .. ON ON .. .. .. .. .. .. ON
#
# Key:
# ON - Director is online
# OF - Director is offline
# OF - DA is offline
# DD - Director is in DD state
# PR - Director is in Probe mode
# NC - Director is not comunicating
# ** - Director status is unknown
my %mapping = (
DD => 'DD state',
PR => 'Probe mode',
NC => 'not comunicating',
'**' => 'unknown',,
OF => 'offline',
ON => 'online',,
'..' => 'not configured',
);
sub check {
my ($self) = @_;
$self->{output}->output_add(long_msg => "Checking directors");
$self->{components}->{director} = {name => 'directors', total => 0, skip => 0};
return if ($self->check_filter(section => 'director'));
if ($self->{content_file_health} !~ /---------------\[ Director Status(.*?)----\[/msi) {
$self->{output}->output_add(long_msg => 'skipping: cannot find directors');
return ;
}
my $content = $1;
while ($content =~ /\s([A-Z]\s+.*?)\n/msig) {
my ($director, @nums) = split /\s+/, $1;
my $i = 0;
foreach (@nums) {
$i++;
my $state = defined($mapping{$_}) ? $mapping{$_} : 'unknown';
my $instance = $director . '.' . $i;
next if ($self->check_filter(section => 'director', instance => $instance));
$self->{components}->{director}->{total}++;
$self->{output}->output_add(long_msg => sprintf("director '%s' state is '%s'",
$instance, $state));
my $exit = $self->get_severity(section => 'director', value => $state);
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Director '%s' state is '%s'",
$instance, $state));
}
}
}
}
1;

View File

@ -0,0 +1,116 @@
#
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
package storage::emc::symmetrix::dmx34::local::mode::components::disk;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
# ------------[ Device Information ]-------------
#
# RAID6 Configured: NO
# RAID5 Configured: NO
# RDF Configured: NO_RDF
# Verify Volume Status
# There are 16 local devices are not ready (device(DA)):- à 0 si pas de problème
# 10000(01a) 10072(01a) 20086(01a) 1009A(01a) 200AE(01a) 100C2(01a) 100EA(01a)
# 10112(01a) 20075(01d) 10089(01d) 2009D(01d) 100B1(01d) 100C9(01d) 100F1(01d)
# 10119(01d) 20061(01d)
#
# No local devices have invalid tracks
#
# Deferred disk service is NOT enabled
#
# 8 hot spares are configured, 1 are invoked, none are not ready à none si pas de problème
#
# HotSpare 16d:D5 is invoked against 1d:D4 Time: MAR/24/16 04:48:49 à récupérer si pb
#
# No DAs have any volumes with Not Ready bit set
#
# All DAs have Write Optimize enabled
#
# No devices have TimeFinder Lock
#
# No Devices Found in Transient State
sub check {
my ($self) = @_;
$self->{output}->output_add(long_msg => "Checking disks");
$self->{components}->{disk} = {name => 'disks (1 means all)', total => 0, skip => 0};
return if ($self->check_filter(section => 'disk'));
if ($self->{content_file_health} !~ /----\[ Device Information(.*?)----\[/msi) {
$self->{output}->output_add(long_msg => 'skipping: cannot find devices');
return ;
}
my $content = $1;
$self->{components}->{disk}->{total}++;
# Error if not present:
# No local devices have invalid tracks
if ($content !~ /No local devices have invalid tracks/msi) {
$self->{output}->output_add(severity => 'CRITICAL',
short_msg => sprintf("problem of invalid tracks on disks"));
} else {
$self->{output}->output_add(long_msg => sprintf("no invalid tracks on disks"));
}
# Error if not present:
# All local devices are ready
if ($content !~ /All local devices are ready/msi) {
$content =~ /There are\s+(\S+)\s+local devices are not ready.*?\n(.*?)\n\s*\n/msi;
my ($num, $disks) = ($1, $2);
$disks =~ s/\n/ /msg;
$disks =~ s/\s+/ /msg;
$disks =~ s/^\s+//;
$self->{output}->output_add(long_msg => sprintf("problem on following disks '%s'", $disks));
$self->{output}->output_add(severity => 'CRITICAL',
short_msg => sprintf("problem on '%s' disks", $num));
} else {
$self->{output}->output_add(long_msg => sprintf("all devices are ready"));
}
return if ($content !~ /(\S+) hot spares are configured, (\S+) are invoked/msi);
my ($total, $used) = ($1, $2);
$used = 0 if ($used =~ /none/i);
my ($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'disk', instance => '1', value => $total - $used);
$self->{output}->output_add(long_msg => sprintf("'%s' spare disk availables on '%s'",
$total - $used, $total));
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("'%s' spare disk availables on '%s'",
$total - $used, $total));
}
$self->{output}->perfdata_add(label => "disk_spare_available",
value => $total - $used,
warning => $warn,
critical => $crit, min => 0, max => $total);
}
1;

View File

@ -0,0 +1,56 @@
#
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
package storage::emc::symmetrix::dmx34::local::mode::components::environment;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
# -------------[ Power Information ]-------------
#
# No Environmental Problems found
sub check {
my ($self) = @_;
$self->{output}->output_add(long_msg => "Checking environment");
$self->{components}->{environment} = {name => 'environment', total => 0, skip => 0};
return if ($self->check_filter(section => 'environment'));
if ($self->{content_file_health} !~ /----\[ Power Information(.*?)----\[/msi) {
$self->{output}->output_add(long_msg => 'skipping: cannot find environment');
return ;
}
my $content = $1;
$self->{components}->{environment}->{total}++;
# Error if not present:
# No Environmental Problems found
if ($content !~ /No Environmental Problems found/msi) {
$self->{output}->output_add(severity => 'CRITICAL',
short_msg => sprintf("environment problem detected"));
} else {
$self->{output}->output_add(long_msg => sprintf("no environment problem detected"));
}
}
1;

View File

@ -0,0 +1,92 @@
#
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
package storage::emc::symmetrix::dmx34::local::mode::components::memory;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
#------------[ Memory Information ]-------------
#
# Memory Size: 80 GB
# Cache start Addr: 00088000 (Hex)
# Cache start Bank: 00000022 (Hex)
# Cache last Addr: 01400000 (Hex)
# Cache last Bank: 000004FF (Hex)
#
# Board Number M0 M1 M2 M3 M4 M5 M6 M7
# Slot Number 10 11 12 13 14 15 16 17
# ----------------------------------------------------------
# Size (GB) 16 16 16 16 8 8 .. ..
# Mode OPER OPER OPER OPER OPER OPER .. ..
# Status OK OK OK OK OK OK .. ..
#
# Status Key
# OK - Board is operating normally
sub check {
my ($self) = @_;
$self->{output}->output_add(long_msg => "Checking memory");
$self->{components}->{memory} = {name => 'memory', total => 0, skip => 0};
return if ($self->check_filter(section => 'memory'));
if ($self->{content_file_health} !~ /----\[ Memory Information(.*?)----\[/msi) {
$self->{output}->output_add(long_msg => 'skipping: cannot find memory');
return ;
}
my $content = $1;
$content =~ /Board Number\s+(.*?)\n/msi;
my @board_numbers = split /\s+/, $1;
$content =~ /Slot Number\s+(.*?)\n/msi;
my @slot_numbers = split /\s+/, $1;
$content =~ /Mode\s+(.*?)\n/msi;
my @modes = split /\s+/, $1;
$content =~ /Status\s+(.*?)\n/msi;
my @status = split /\s+/, $1;
my $i = -1;
foreach my $name (@board_numbers) {
$i++;
my $instance = $name . '#' . $slot_numbers[$i];
my $state = $modes[$i] . '/' . $status[$i];
next if ($self->check_filter(section => 'memory', instance => $instance));
$self->{components}->{memory}->{total}++;
$self->{output}->output_add(long_msg => sprintf("memory '%s' state is '%s'",
$instance, $state));
my $exit = $self->get_severity(section => 'memory', value => $state);
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Memory '%s' state is '%s'",
$instance, $state));
}
}
}
1;

View File

@ -0,0 +1,60 @@
#
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
package storage::emc::symmetrix::dmx34::local::mode::components::test;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
#--------------[ Director Tests ]---------------
#
# No offline pending DAs are present
# 1C test: All Directors Passed
# F2,SAME,,,EE test: All Directors Passed
# EE test: All Directors Passed
sub check {
my ($self) = @_;
$self->{output}->output_add(long_msg => "Checking test");
$self->{components}->{test} = {name => 'test', total => 0, skip => 0};
return if ($self->check_filter(section => 'test'));
if ($self->{content_file_health} !~ /----\[ Director Tests(.*?)----\[/msi) {
$self->{output}->output_add(long_msg => 'skipping: cannot find tests');
return ;
}
my $content = $1;
$self->{components}->{test}->{total}++;
foreach (('No offline pending DAs are present', '1C test: All Directors Passed',
'F2,SAME,,,EE test: All Directors Passed', 'EE test: All Directors Passed')) {
if ($content !~ /$_/msi) {
$self->{output}->output_add(severity => 'CRITICAL',
short_msg => sprintf("test problem detected"));
} else {
$self->{output}->output_add(long_msg => sprintf("%s", $_));
}
}
}
1;

View File

@ -0,0 +1,75 @@
#
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
package storage::emc::symmetrix::dmx34::local::mode::components::xcm;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
# --------------[ XCM Information ]--------------
#
#XCM/ECM/CCM status
# XCM0 XCM1
# EMUL EMUL
#
#Message Bus status
sub check {
my ($self) = @_;
$self->{output}->output_add(long_msg => "Checking xcm");
$self->{components}->{xcm} = {name => 'xcm', total => 0, skip => 0};
return if ($self->check_filter(section => 'xcm'));
if ($self->{content_file_health} !~ /----\[ XCM Information(.*?)----\[/msi) {
$self->{output}->output_add(long_msg => 'skipping: cannot find xcm');
return ;
}
my $content = $1;
if ($content =~ /XCM\/ECM\/CCM status\s*\n\s*(.*?)\n\s*(.*?)\n\s*\n/msig) {
my @names = split /\s+/, $1;
my @status = split /\s+/, $2;
my $i = -1;
foreach my $name (@names) {
$i++;
my $instance = $name;
my $state = $status[$i];
next if ($self->check_filter(section => 'xcm', instance => $instance));
$self->{components}->{xcm}->{total}++;
$self->{output}->output_add(long_msg => sprintf("xcm '%s' state is '%s'",
$instance, $state));
my $exit = $self->get_severity(section => 'xcm', value => $state);
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("XCM '%s' state is '%s'",
$instance, $state));
}
}
}
}
1;

View File

@ -0,0 +1,281 @@
#
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
package storage::emc::symmetrix::dmx34::local::mode::hardware;
use base qw(centreon::plugins::templates::hardware);
use strict;
use warnings;
use centreon::plugins::misc;
use centreon::plugins::statefile;
sub set_system {
my ($self, %options) = @_;
$self->{regexp_threshold_numeric_check_section_option} = '^(disk)$';
$self->{cb_hook1} = 'read_files';
$self->{cb_hook4} = 'send_email';
$self->{thresholds} = {
director => [
['DD state', 'CRITICAL'],
['Probe mode', 'CRITICAL'],
['not comunicating', 'CRITICAL'],
['unknown', 'CRITICAL'],
['offline', 'OK'],
['online', 'OK'],
['not configured', 'OK'],
],
xcm => [
['emul', 'OK'],
['.*', 'CRITICAL'],
],
memory => [
['OPER/OK', 'OK'],
['\.\./.*', 'OK'],
['.*', 'CRITICAL'],
],
};
$self->{components_path} = 'storage::emc::symmetrix::dmx34::local::mode::components';
$self->{components_module} = ['director', 'xcm', 'disk', 'memory', 'config', 'environment', 'test'];
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::check_options(%options);
$self->{statefile_cache}->check_options(%options);
}
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options, no_absent => 1);
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
"file-health:s" => { name => 'file_health' },
"file-health-env:s" => { name => 'file_health_env' },
# Email
"email-warning:s" => { name => 'email_warning' },
"email-critical:s" => { name => 'email_critical' },
"email-smtp-host:s" => { name => 'email_smtp_host' },
"email-smtp-username:s" => { name => 'email_smtp_username' },
"email-smtp-password:s" => { name => 'email_smtp_password' },
"email-smtp-from:s" => { name => 'email_smtp_from' },
"email-smtp-options:s@" => { name => 'email_smtp_options' },
"email-memory" => { name => 'email_memory' },
});
$self->{statefile_cache} = centreon::plugins::statefile->new(%options);
$self->{components_exec_load} = 0;
return $self;
}
sub read_files {
my ($self, %options) = @_;
if (!defined($self->{option_results}->{file_health}) || !defined($self->{option_results}->{file_health_env})) {
$self->{output}->add_option_msg(short_msg => "Please set option --file-health and --file-health-env.");
$self->{output}->option_exit();
}
$self->{content_file_health} = do {
local $/ = undef;
if (!open my $fh, "<", $self->{option_results}->{file_health}) {
$self->{output}->add_option_msg(short_msg => "Could not open file $self->{option_results}->{file_health} : $!");
$self->{output}->option_exit();
}
<$fh>;
};
# We remove color syntax
$self->{content_file_health} =~ s/\x{1b}\[.*?m|\r//msg;
# *****************************************************************
#* Health Check Run From Scheduler Version 2.0 *
#* *
#* Serial: 000290103984 Run Time: 03/24/2016 12:27:07 *
#* Run Type: FULL Code Level: 5773-184-130 *
#*****************************************************************
my ($serial, $site) = ('unknown', 'unknown');
$serial = $1 if ($self->{content_file_health} =~ /Serial:\s*(\S+)/msi);
$self->{output}->output_add(long_msg => sprintf('serial number: %s, site name: %s', $serial, $site));
}
#
# maybe we should add it in core (with cleaner code ;)
#
sub send_email {
my ($self, %options) = @_;
#######
# Check SMTP options
return if (!((defined($self->{option_results}->{email_warning}) && $self->{option_results}->{email_warning} ne '')
|| (defined($self->{option_results}->{email_critical}) && $self->{option_results}->{email_critical} ne '')));
if (!defined($self->{option_results}->{email_smtp_host})) {
$self->{output}->add_option_msg(short_msg => "Please set the --email-smtp-host option");
$self->{output}->option_exit();
}
if (!defined($self->{option_results}->{email_smtp_from})) {
$self->{output}->add_option_msg(short_msg => "Please set --email-smtp-from option");
$self->{output}->option_exit();
}
my %smtp_options = ('-auth' => 'none');
if (defined($self->{option_results}->{email_smtp_username}) && $self->{option_results}->{email_smtp_username} ne '') {
$smtp_options{-login} = $self->{option_results}->{email_smtp_username};
delete $smtp_options{-auth};
}
if (defined($self->{option_results}->{email_smtp_username}) && defined($self->{option_results}->{email_smtp_password})) {
$smtp_options{-pass} = $self->{option_results}->{email_smtp_password};
}
foreach my $option (@{$self->{option_results}->{email_smtp_options}}) {
next if ($option !~ /^(.+?)=(.+)$/);
$smtp_options{-$1} = $2;
}
#######
# Get current data
my $stdout;
{
local *STDOUT;
open STDOUT, '>', \$stdout;
$self->{output}->display(force_long_output => 1);
}
$stdout =~ /^(.*?)(\||\n)/msi;
my $subject = $1;
my $status = lc($self->{output}->get_litteral_status());
my $send_email = 0;
$send_email = 1 if ($status ne 'ok');
#######
# Check memory file
if (defined($self->{option_results}->{email_memory})) {
$self->{new_datas} = { status => $status, output => $subject };
$self->{statefile_cache}->read(statefile => "cache_emc_symmetrix_dmx34_email");
my $prev_status = $self->{statefile_cache}->get(name => 'status');
my $prev_output = $self->{statefile_cache}->get(name => 'output');
# non-ok output is the same
$send_email = 0 if ($status ne 'ok' && defined($prev_output) && $prev_output eq $subject);
# recovery email
$send_email = 1 if ($status eq 'ok' && defined($prev_status) && $prev_status ne 'ok');
}
my $smtp_to = '';
$smtp_to = $self->{option_results}->{email_warning} if ($status eq 'warning' && defined($self->{option_results}->{email_warning} && $self->{option_results}->{email_warning}) ne '');
$smtp_to = $self->{option_results}->{email_critical} if ($status eq 'critical' && defined($self->{option_results}->{email_critical} && $self->{option_results}->{email_critical}) ne '');
if ($send_email == 1 && $status eq 'ok') {
my $append = '';
foreach (('email_warning', 'email_critical')) {
if (defined($self->{option_results}->{$_}) && $self->{option_results}->{$_} ne '') {
$smtp_to .= $append . $self->{option_results}->{$_};
$append .= ',';
}
}
}
if ($send_email == 0) {
$self->{output}->add_option_msg(severity => 'OK', short_msg => "No email to send");
return ;
}
centreon::plugins::misc::mymodule_load(output => $self->{output}, module => 'Email::Send::SMTP::Gmail',
error_msg => "Cannot load module 'Email::Send::SMTP::Gmail'.");
my ($mail, $error) = Email::Send::SMTP::Gmail->new(-smtp => $self->{option_results}->{email_smtp_host},
%smtp_options);
if ($mail == -1) {
$self->{output}->add_option_msg(short_msg => "session error: " . $error);
$self->{output}->option_exit();
}
my $result = $mail->send(-to => $smtp_to,
-from => $self->{option_results}->{email_smtp_from},
-subject => $subject,
-body => $stdout,
-attachments => $self->{option_results}->{file_health_env});
$mail->bye();
if ($result == -1) {
$self->{output}->add_option_msg(severity => 'UNKNOWN', short_msg => "problem to send the email");
} else {
$self->{output}->add_option_msg(severity => 'OK', short_msg => "email sent");
}
}
1;
__END__
=head1 MODE
Check hardware.
=over 8
=item B<--component>
Which component to check (Default: '.*').
Can be: 'director', 'xcm', 'disk', 'memory', 'config', 'environment', 'test'
=item B<--filter>
Exclude some parts (comma seperated list) (Example: --filter=director --filter=xcm)
Can also exclude specific instance: --filter=director,1
=item B<--no-component>
Return an error if no compenents are checked.
If total (with skipped) is 0. (Default: 'critical' returns).
=item B<--threshold-overload>
Set to overload default threshold values (syntax: section,[instance,]status,regexp)
It used before default thresholds (order stays).
Example: --threshold-overload='director,CRITICAL,^(?!(online)$)'
=item B<--warning>
Set warning threshold for disk (syntax: type,regexp,threshold)
Example: --warning='disk,.*,5:'
=item B<--critical>
Set critical threshold for disk (syntax: type,regexp,threshold)
Example: --critical='disk,.*,3:'
=item B<--file-health>
The location of the global storage file status (Should be something like: C:/xxxx/HealthCheck.log).
=item B<--file-health-env>
The location of the environment storage file status (Should be something like: C:/xxxx/HealthCheck_ENV.log).
=back
=cut

View File

@ -0,0 +1,48 @@
#
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
package storage::emc::symmetrix::dmx34::local::plugin;
use strict;
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;
$self->{version} = '0.1';
%{$self->{modes}} = (
'hardware' => 'storage::emc::symmetrix::dmx34::local::mode::hardware',
);
return $self;
}
1;
__END__
=head1 PLUGIN DESCRIPTION
Check symmetrix DMX 3 and 4. The plugin needs to be installed on Windows Management.
=cut