mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-27 23:54:18 +02:00
commit
39f0d8061a
128
apps/cluster/mscs/local/mode/listnodes.pm
Normal file
128
apps/cluster/mscs/local/mode/listnodes.pm
Normal file
@ -0,0 +1,128 @@
|
||||
#
|
||||
# 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::cluster::mscs::local::mode::listnodes;
|
||||
|
||||
use base qw(centreon::plugins::mode);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Win32::OLE;
|
||||
|
||||
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-name:s" => { name => 'filter_name' },
|
||||
});
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::init(%options);
|
||||
}
|
||||
|
||||
my %map_state = (
|
||||
-1 => 'unknown',
|
||||
0 => 'up',
|
||||
1 => 'down',
|
||||
2 => 'paused',
|
||||
3 => 'joining',
|
||||
);
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
# winmgmts:{impersonationLevel=impersonate,authenticationLevel=pktPrivacy}!\\.\root\mscluster
|
||||
my $wmi = Win32::OLE->GetObject('winmgmts:root\mscluster');
|
||||
if (!defined($wmi)) {
|
||||
$self->{output}->add_option_msg(short_msg => "Cant create server object:" . Win32::OLE->LastError());
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
||||
$self->{nodes} = {};
|
||||
my $query = "Select * from MSCluster_Node";
|
||||
my $resultset = $wmi->ExecQuery($query);
|
||||
foreach my $obj (in $resultset) {
|
||||
my $name = $obj->{Name};
|
||||
my $state = $map_state{$obj->{State}};
|
||||
|
||||
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);
|
||||
next;
|
||||
}
|
||||
|
||||
$self->{nodes}->{$name} = { name => $name, state => $state };
|
||||
}
|
||||
}
|
||||
|
||||
sub run {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->manage_selection();
|
||||
foreach my $name (sort keys %{$self->{nodes}}) {
|
||||
$self->{output}->output_add(long_msg => "'" . $name . "' [state = " . $self->{nodes}->{$name}->{state} . "]");
|
||||
}
|
||||
|
||||
$self->{output}->output_add(severity => 'OK',
|
||||
short_msg => 'List Nodes:');
|
||||
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
|
||||
$self->{output}->exit();
|
||||
}
|
||||
|
||||
sub disco_format {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{output}->add_disco_format(elements => ['name', 'state']);
|
||||
}
|
||||
|
||||
sub disco_show {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->manage_selection(disco => 1);
|
||||
foreach my $name (sort keys %{$self->{nodes}}) {
|
||||
$self->{output}->add_disco_entry(name => $name, state => $self->{nodes}->{$name}->{state});
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
List nodes.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--filter-name>
|
||||
|
||||
Filter node name (can be a regexp).
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
148
apps/cluster/mscs/local/mode/listresources.pm
Normal file
148
apps/cluster/mscs/local/mode/listresources.pm
Normal file
@ -0,0 +1,148 @@
|
||||
#
|
||||
# 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::cluster::mscs::local::mode::listresources;
|
||||
|
||||
use base qw(centreon::plugins::mode);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Win32::OLE;
|
||||
|
||||
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-name:s" => { name => 'filter_name' },
|
||||
});
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::init(%options);
|
||||
}
|
||||
|
||||
my %map_state = (
|
||||
-1 => 'unknown',
|
||||
0 => 'inherited',
|
||||
1 => 'initializing',
|
||||
2 => 'online',
|
||||
3 => 'offline',
|
||||
4 => 'failed',
|
||||
128 => 'pending',
|
||||
129 => 'online pending',
|
||||
130 => 'offline pending',
|
||||
);
|
||||
|
||||
my %map_class = (
|
||||
0 => 'unknown',
|
||||
1 => 'storage',
|
||||
2 => 'network',
|
||||
32768 => 'user',
|
||||
);
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
# winmgmts:{impersonationLevel=impersonate,authenticationLevel=pktPrivacy}!\\.\root\mscluster
|
||||
my $wmi = Win32::OLE->GetObject('winmgmts:root\mscluster');
|
||||
if (!defined($wmi)) {
|
||||
$self->{output}->add_option_msg(short_msg => "Cant create server object:" . Win32::OLE->LastError());
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
||||
$self->{resources} = {};
|
||||
my $query = "Select * from MSCluster_Resource";
|
||||
my $resultset = $wmi->ExecQuery($query);
|
||||
foreach my $obj (in $resultset) {
|
||||
my $name = $obj->{Name};
|
||||
my $state = $map_state{$obj->{State}};
|
||||
my $class = $map_class{$obj->{ResourceClass}};
|
||||
|
||||
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);
|
||||
next;
|
||||
}
|
||||
|
||||
$self->{resources}->{$obj->{Id}} = { name => $name, state => $state, owner_node => $obj->{OwnerNode},
|
||||
class => $class };
|
||||
}
|
||||
}
|
||||
|
||||
sub run {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->manage_selection();
|
||||
foreach my $id (sort keys %{$self->{resources}}) {
|
||||
$self->{output}->output_add(long_msg => "'" . $self->{resources}->{$id}->{name} .
|
||||
"' [state = " . $self->{resources}->{$id}->{state} . "]" .
|
||||
"[owner node = " . $self->{resources}->{$id}->{owner_node} . "]" .
|
||||
"[class = " . $self->{resources}->{$id}->{class} . "]");
|
||||
}
|
||||
|
||||
$self->{output}->output_add(severity => 'OK',
|
||||
short_msg => 'List Resources:');
|
||||
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
|
||||
$self->{output}->exit();
|
||||
}
|
||||
|
||||
sub disco_format {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{output}->add_disco_format(elements => ['name', 'state', 'id', 'owner_node', 'class']);
|
||||
}
|
||||
|
||||
sub disco_show {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->manage_selection(disco => 1);
|
||||
foreach my $id (sort keys %{$self->{resources}}) {
|
||||
$self->{output}->add_disco_entry(name => $self->{resources}->{$id}->{name},
|
||||
state => $self->{resources}->{$id}->{state},
|
||||
id => $id,
|
||||
owner_node => $self->{resources}->{$id}->{owner_node},
|
||||
class => $self->{resources}->{$id}->{class});
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
List resources.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--filter-name>
|
||||
|
||||
Filter resource name (can be a regexp).
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
199
apps/cluster/mscs/local/mode/networkstatus.pm
Normal file
199
apps/cluster/mscs/local/mode/networkstatus.pm
Normal file
@ -0,0 +1,199 @@
|
||||
#
|
||||
# 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::cluster::mscs::local::mode::networkstatus;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Win32::OLE;
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'network', type => 1, cb_prefix_output => 'prefix_network_output', message_multiple => 'All networks are ok' }
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{network} = [
|
||||
{ label => 'status', threshold => 0, set => {
|
||||
key_values => [ { name => 'state' }, { 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'),
|
||||
}
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
sub custom_status_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $msg = 'state : ' . $self->{result_values}->{state};
|
||||
return $msg;
|
||||
}
|
||||
|
||||
sub custom_status_calc {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{result_values}->{state} = $options{new_datas}->{$self->{instance} . '_state'};
|
||||
$self->{result_values}->{display} = $options{new_datas}->{$self->{instance} . '_display'};
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub prefix_network_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Network '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
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-name:s" => { name => 'filter_name' },
|
||||
"unknown-status:s" => { name => 'unknown_status', default => '%{state} =~ /unknown/' },
|
||||
"warning-status:s" => { name => 'warning_status', default => '' },
|
||||
"critical-status:s" => { name => 'critical_status', default => '%{state} =~ /down|paritioned|unavailable/' },
|
||||
});
|
||||
|
||||
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', 'unknown_status')) {
|
||||
if (defined($self->{option_results}->{$_})) {
|
||||
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
my %map_state = (
|
||||
-1 => 'unknown',
|
||||
0 => 'unavailable',
|
||||
1 => 'down',
|
||||
2 => 'paritioned',
|
||||
3 => 'up',
|
||||
);
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
# winmgmts:{impersonationLevel=impersonate,authenticationLevel=pktPrivacy}!\\.\root\mscluster
|
||||
my $wmi = Win32::OLE->GetObject('winmgmts:root\mscluster');
|
||||
if (!defined($wmi)) {
|
||||
$self->{output}->add_option_msg(short_msg => "Cant create server object:" . Win32::OLE->LastError());
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
||||
$self->{network} = {};
|
||||
my $query = "Select * from MSCluster_Network";
|
||||
my $resultset = $wmi->ExecQuery($query);
|
||||
foreach my $obj (in $resultset) {
|
||||
my $name = $obj->{Name};
|
||||
my $state = $map_state{$obj->{State}};
|
||||
|
||||
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);
|
||||
next;
|
||||
}
|
||||
|
||||
$self->{network}->{$obj->{ID}} = { display => $name, state => $state };
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check network status.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--filter-name>
|
||||
|
||||
Filter interface name (can be a regexp).
|
||||
|
||||
=item B<--unknown-status>
|
||||
|
||||
Set warning threshold for status (Default: '%{state} =~ /unknown/').
|
||||
Can used special variables like: %{state}, %{display}
|
||||
|
||||
=item B<--warning-status>
|
||||
|
||||
Set warning threshold for status (Default: none).
|
||||
Can used special variables like: %{state}, %{display}
|
||||
|
||||
=item B<--critical-status>
|
||||
|
||||
Set critical threshold for status (Default: '%{state} =~ /down|paritioned|unavailable/').
|
||||
Can used special variables like: %{state}, %{display}
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
199
apps/cluster/mscs/local/mode/nodestatus.pm
Normal file
199
apps/cluster/mscs/local/mode/nodestatus.pm
Normal file
@ -0,0 +1,199 @@
|
||||
#
|
||||
# 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::cluster::mscs::local::mode::nodestatus;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Win32::OLE;
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'node', type => 1, cb_prefix_output => 'prefix_node_output', message_multiple => 'All nodes are ok' }
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{node} = [
|
||||
{ label => 'status', threshold => 0, set => {
|
||||
key_values => [ { name => 'state' }, { 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'),
|
||||
}
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
sub custom_status_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $msg = 'state : ' . $self->{result_values}->{state};
|
||||
return $msg;
|
||||
}
|
||||
|
||||
sub custom_status_calc {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{result_values}->{state} = $options{new_datas}->{$self->{instance} . '_state'};
|
||||
$self->{result_values}->{display} = $options{new_datas}->{$self->{instance} . '_display'};
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub prefix_node_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Node '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
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-name:s" => { name => 'filter_name' },
|
||||
"unknown-status:s" => { name => 'unknown_status', default => '%{state} =~ /unknown/' },
|
||||
"warning-status:s" => { name => 'warning_status', default => '%{state} =~ /pause|joining/' },
|
||||
"critical-status:s" => { name => 'critical_status', default => '%{state} =~ /down/' },
|
||||
});
|
||||
|
||||
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', 'unknown_status')) {
|
||||
if (defined($self->{option_results}->{$_})) {
|
||||
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
my %map_state = (
|
||||
-1 => 'unknown',
|
||||
0 => 'up',
|
||||
1 => 'down',
|
||||
2 => 'paused',
|
||||
3 => 'joining',
|
||||
);
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
# winmgmts:{impersonationLevel=impersonate,authenticationLevel=pktPrivacy}!\\.\root\mscluster
|
||||
my $wmi = Win32::OLE->GetObject('winmgmts:root\mscluster');
|
||||
if (!defined($wmi)) {
|
||||
$self->{output}->add_option_msg(short_msg => "Cant create server object:" . Win32::OLE->LastError());
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
||||
$self->{node} = {};
|
||||
my $query = "Select * from MSCluster_Node";
|
||||
my $resultset = $wmi->ExecQuery($query);
|
||||
foreach my $obj (in $resultset) {
|
||||
my $name = $obj->{Name};
|
||||
my $state = $map_state{$obj->{State}};
|
||||
|
||||
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);
|
||||
next;
|
||||
}
|
||||
|
||||
$self->{node}->{$name} = { display => $name, state => $state };
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check node status.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--filter-name>
|
||||
|
||||
Filter node name (can be a regexp).
|
||||
|
||||
=item B<--unknown-status>
|
||||
|
||||
Set warning threshold for status (Default: '%{state} =~ /unknown/').
|
||||
Can used special variables like: %{state}, %{display}
|
||||
|
||||
=item B<--warning-status>
|
||||
|
||||
Set warning threshold for status (Default: '%{state} =~ /pause|joining/').
|
||||
Can used special variables like: %{state}, %{display}
|
||||
|
||||
=item B<--critical-status>
|
||||
|
||||
Set critical threshold for status (Default: '%{state} =~ /down/').
|
||||
Can used special variables like: %{state}, %{display}
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
242
apps/cluster/mscs/local/mode/resourcegroupstatus.pm
Normal file
242
apps/cluster/mscs/local/mode/resourcegroupstatus.pm
Normal file
@ -0,0 +1,242 @@
|
||||
#
|
||||
# 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::cluster::mscs::local::mode::resourcegroupstatus;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Win32::OLE;
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'rg', type => 1, cb_prefix_output => 'prefix_rg_output', message_multiple => 'All resource groups are ok' }
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{rg} = [
|
||||
{ label => 'status', threshold => 0, set => {
|
||||
key_values => [ { name => 'state' }, { name => 'display' }, { name => 'owner_node' }, { name => 'preferred_owners' } ],
|
||||
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'),
|
||||
}
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
my $instance_mode;
|
||||
my $instance_current;
|
||||
|
||||
sub is_preferred_node {
|
||||
if (!defined($instance_current->{result_values}->{preferred_owners}) ||
|
||||
scalar(@{$instance_current->{result_values}->{preferred_owners}}) == 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
foreach my $pref_node (@{$instance_current->{result_values}->{preferred_owners}}) {
|
||||
if ($pref_node eq $instance_current->{result_values}->{owner_node}) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub custom_threshold_output {
|
||||
my ($self, %options) = @_;
|
||||
my $status = 'ok';
|
||||
my $message;
|
||||
|
||||
$instance_current = $self;
|
||||
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;
|
||||
}
|
||||
|
||||
sub custom_status_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $pref_nodes = 'any';
|
||||
if (defined($instance_current->{result_values}->{preferred_owners}) &&
|
||||
scalar(@{$instance_current->{result_values}->{preferred_owners}}) > 0) {
|
||||
$pref_nodes = join(', ', @{$instance_current->{result_values}->{preferred_owners}});
|
||||
}
|
||||
|
||||
my $msg = 'state : ' . $self->{result_values}->{state} . ' [node: ' . $self->{result_values}->{owner_node} . '] [preferred nodes: ' . $pref_nodes . ']';
|
||||
return $msg;
|
||||
}
|
||||
|
||||
sub custom_status_calc {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{result_values}->{state} = $options{new_datas}->{$self->{instance} . '_state'};
|
||||
$self->{result_values}->{display} = $options{new_datas}->{$self->{instance} . '_display'};
|
||||
$self->{result_values}->{owner_node} = $options{new_datas}->{$self->{instance} . '_owner_node'};
|
||||
$self->{result_values}->{preferred_owners} = $options{new_datas}->{$self->{instance} . '_preferred_owners'};
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub prefix_rg_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Resource group '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
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-name:s" => { name => 'filter_name' },
|
||||
"unknown-status:s" => { name => 'unknown_status', default => '%{state} =~ /unknown/' },
|
||||
"warning-status:s" => { name => 'warning_status', default => 'not is_preferred_node()' },
|
||||
"critical-status:s" => { name => 'critical_status', default => '%{state} =~ /failed|offline/' },
|
||||
});
|
||||
|
||||
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', 'unknown_status')) {
|
||||
if (defined($self->{option_results}->{$_})) {
|
||||
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
my %map_state = (
|
||||
-1 => 'unknown',
|
||||
0 => 'online',
|
||||
1 => 'offline',
|
||||
2 => 'failed',
|
||||
3 => 'partial online',
|
||||
4 => 'pending',
|
||||
);
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
# winmgmts:{impersonationLevel=impersonate,authenticationLevel=pktPrivacy}!\\.\root\mscluster
|
||||
my $wmi = Win32::OLE->GetObject('winmgmts:root\mscluster');
|
||||
if (!defined($wmi)) {
|
||||
$self->{output}->add_option_msg(short_msg => "Cant create server object:" . Win32::OLE->LastError());
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
||||
my $query = "Select * from MSCluster_ResourceGroupToPreferredNode";
|
||||
my $resultset = $wmi->ExecQuery($query);
|
||||
my $preferred_nodes = {};
|
||||
foreach my $obj (in $resultset) {
|
||||
use Data::Dumper;
|
||||
|
||||
# MSCluster_ResourceGroup.Name="xxx"
|
||||
if ($obj->GroupComponent =~ /MSCluster_ResourceGroup.Name="(.*?)"/i) {
|
||||
my $rg = $1;
|
||||
next if ($obj->PartComponent !~ /MSCluster_Node.Name="(.*?)"/i);
|
||||
my $node = $1;
|
||||
$preferred_nodes->{$rg} = [] if (!defined($preferred_nodes->{$rg}));
|
||||
push @{$preferred_nodes->{$rg}}, $node;
|
||||
}
|
||||
}
|
||||
|
||||
$self->{rg} = {};
|
||||
$query = "Select * from MSCluster_ResourceGroup";
|
||||
$resultset = $wmi->ExecQuery($query);
|
||||
foreach my $obj (in $resultset) {
|
||||
my $name = $obj->{Name};
|
||||
my $state = $map_state{$obj->{State}};
|
||||
|
||||
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);
|
||||
next;
|
||||
}
|
||||
|
||||
$self->{rg}->{$obj->{Id}} = { display => $name, state => $state, owner_node => $obj->{OwnerNode},
|
||||
preferred_owners => defined($preferred_nodes->{$name}) ? $preferred_nodes->{$name} : [] };
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check resource group status.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--filter-name>
|
||||
|
||||
Filter resource group name (can be a regexp).
|
||||
|
||||
=item B<--unknown-status>
|
||||
|
||||
Set warning threshold for status (Default: '%{state} =~ /unknown/').
|
||||
Can used special variables like: %{state}, %{display}, %{owner_node}
|
||||
|
||||
=item B<--warning-status>
|
||||
|
||||
Set warning threshold for status (Default: 'not is_preferred_node()').
|
||||
Can used special variables like: %{state}, %{display}, %{owner_node}
|
||||
|
||||
=item B<--critical-status>
|
||||
|
||||
Set critical threshold for status (Default: '%{state} =~ /failed|offline/').
|
||||
Can used special variables like: %{state}, %{display}, %{owner_node}
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
204
apps/cluster/mscs/local/mode/resourcestatus.pm
Normal file
204
apps/cluster/mscs/local/mode/resourcestatus.pm
Normal file
@ -0,0 +1,204 @@
|
||||
#
|
||||
# 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::cluster::mscs::local::mode::resourcestatus;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Win32::OLE;
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'resource', type => 1, cb_prefix_output => 'prefix_resource_output', message_multiple => 'All resources are ok' }
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{resource} = [
|
||||
{ label => 'status', threshold => 0, set => {
|
||||
key_values => [ { name => 'state' }, { name => 'display' }, { name => 'owner_node' } ],
|
||||
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'),
|
||||
}
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
sub custom_status_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $msg = 'state : ' . $self->{result_values}->{state} . ' [node: ' . $self->{result_values}->{owner_node} . ']';
|
||||
return $msg;
|
||||
}
|
||||
|
||||
sub custom_status_calc {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{result_values}->{state} = $options{new_datas}->{$self->{instance} . '_state'};
|
||||
$self->{result_values}->{display} = $options{new_datas}->{$self->{instance} . '_display'};
|
||||
$self->{result_values}->{owner_node} = $options{new_datas}->{$self->{instance} . '_owner_node'};
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub prefix_resource_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Resource '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
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-name:s" => { name => 'filter_name' },
|
||||
"unknown-status:s" => { name => 'unknown_status', default => '%{state} =~ /unknown/' },
|
||||
"warning-status:s" => { name => 'warning_status', default => '' },
|
||||
"critical-status:s" => { name => 'critical_status', default => '%{state} =~ /failed|offline/' },
|
||||
});
|
||||
|
||||
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', 'unknown_status')) {
|
||||
if (defined($self->{option_results}->{$_})) {
|
||||
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
my %map_state = (
|
||||
-1 => 'unknown',
|
||||
0 => 'inherited',
|
||||
1 => 'initializing',
|
||||
2 => 'online',
|
||||
3 => 'offline',
|
||||
4 => 'failed',
|
||||
128 => 'pending',
|
||||
129 => 'online pending',
|
||||
130 => 'offline pending',
|
||||
);
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
# winmgmts:{impersonationLevel=impersonate,authenticationLevel=pktPrivacy}!\\.\root\mscluster
|
||||
my $wmi = Win32::OLE->GetObject('winmgmts:root\mscluster');
|
||||
if (!defined($wmi)) {
|
||||
$self->{output}->add_option_msg(short_msg => "Cant create server object:" . Win32::OLE->LastError());
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
||||
$self->{resource} = {};
|
||||
my $query = "Select * from MSCluster_Resource";
|
||||
my $resultset = $wmi->ExecQuery($query);
|
||||
foreach my $obj (in $resultset) {
|
||||
my $name = $obj->{Name};
|
||||
my $state = $map_state{$obj->{State}};
|
||||
|
||||
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);
|
||||
next;
|
||||
}
|
||||
|
||||
$self->{resource}->{$obj->{Id}} = { display => $name, state => $state, owner_node => $obj->{OwnerNode} };
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check resource status.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--filter-name>
|
||||
|
||||
Filter resource name (can be a regexp).
|
||||
|
||||
=item B<--unknown-status>
|
||||
|
||||
Set warning threshold for status (Default: '%{state} =~ /unknown/').
|
||||
Can used special variables like: %{state}, %{display}
|
||||
|
||||
=item B<--warning-status>
|
||||
|
||||
Set warning threshold for status (Default: none).
|
||||
Can used special variables like: %{state}, %{display}, %{owner_node}
|
||||
|
||||
=item B<--critical-status>
|
||||
|
||||
Set critical threshold for status (Default: '%{state} =~ /failed|offline/').
|
||||
Can used special variables like: %{state}, %{display}, %{owner_node}
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
53
apps/cluster/mscs/local/plugin.pm
Normal file
53
apps/cluster/mscs/local/plugin.pm
Normal file
@ -0,0 +1,53 @@
|
||||
#
|
||||
# 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::cluster::mscs::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}} = (
|
||||
'list-nodes' => 'apps::cluster::mscs::local::mode::listnodes',
|
||||
'list-resources' => 'apps::cluster::mscs::local::mode::listresources',
|
||||
'network-status' => 'apps::cluster::mscs::local::mode::networkstatus',
|
||||
'node-status' => 'apps::cluster::mscs::local::mode::nodestatus',
|
||||
'resource-status' => 'apps::cluster::mscs::local::mode::resourcestatus',
|
||||
'resourcegroup-status' => 'apps::cluster::mscs::local::mode::resourcegroupstatus',
|
||||
);
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 PLUGIN DESCRIPTION
|
||||
|
||||
Check Microsoft Cluster Service.
|
||||
|
||||
=cut
|
@ -44,7 +44,6 @@ __END__
|
||||
|
||||
=head1 PLUGIN DESCRIPTION
|
||||
|
||||
Check Arkoon firewall in SNMP.
|
||||
!!! Be careful: ifAlias and ifName are empty. Use --oid-filter and --oid-display on ifDesc !!!
|
||||
Check BGP protocol in SNMP.
|
||||
|
||||
=cut
|
||||
|
@ -239,7 +239,7 @@ sub run {
|
||||
$self->{json_response} = $self->{http}->request(method => $self->{method}, query_form_post => $self->{json_request});
|
||||
my $timeelapsed = tv_interval ($timing0, [gettimeofday]);
|
||||
|
||||
$self->{output}->output_add(long_msg => $self->{json_response});
|
||||
$self->{output}->output_add(long_msg => $self->{json_response}, debug => 1);
|
||||
if (!defined($self->{option_results}->{lookup}) || scalar(@{$self->{option_results}->{lookup}}) == 0) {
|
||||
$self->{output}->output_add(severity => 'OK',
|
||||
short_msg => "JSON webservice request success");
|
||||
|
@ -248,7 +248,7 @@ sub run {
|
||||
$self->{soap_response} = $self->{http}->request(method => 'POST', query_form_post => $self->{soap_request});
|
||||
my $timeelapsed = tv_interval ($timing0, [gettimeofday]);
|
||||
|
||||
$self->{output}->output_add(long_msg => $self->{soap_response});
|
||||
$self->{output}->output_add(long_msg => $self->{soap_response}, debug => 1);
|
||||
if (!defined($self->{option_results}->{lookup}) || scalar(@{$self->{option_results}->{lookup}}) == 0) {
|
||||
$self->{output}->output_add(severity => 'OK',
|
||||
short_msg => "SOAP request success");
|
||||
|
281
apps/protocols/ospf/snmp/mode/neighbor.pm
Normal file
281
apps/protocols/ospf/snmp/mode/neighbor.pm
Normal 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 apps::protocols::ospf::snmp::mode::neighbor;
|
||||
|
||||
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_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;
|
||||
}
|
||||
|
||||
sub custom_status_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $msg = 'state : ' . $self->{result_values}->{NbrState};
|
||||
return $msg;
|
||||
}
|
||||
|
||||
sub custom_status_calc {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{result_values}->{NbrState} = $options{new_datas}->{$self->{instance} . '_NbrState'};
|
||||
$self->{result_values}->{NbrIpAddr} = $options{new_datas}->{$self->{instance} . '_NbrIpAddr'};
|
||||
$self->{result_values}->{NbrRtrId} = $options{new_datas}->{$self->{instance} . '_NbrRtrId'};
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub custom_change_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_total_change}) && $instance_mode->{option_results}->{critical_total_change} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{critical_total_change}") {
|
||||
$status = 'critical';
|
||||
} elsif (defined($instance_mode->{option_results}->{warning_total_change}) && $instance_mode->{option_results}->{warning_total_change} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{warning_total_change}") {
|
||||
$status = 'warning';
|
||||
}
|
||||
};
|
||||
if (defined($message)) {
|
||||
$self->{output}->output_add(long_msg => 'filter status issue: ' . $message);
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
sub custom_change_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $msg = 'Neighbors current : ' . $self->{result_values}->{Total} . ' (last : ' . $self->{result_values}->{TotalLast} . ')';
|
||||
return $msg;
|
||||
}
|
||||
|
||||
sub custom_change_calc {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{result_values}->{TotalLast} = $options{old_datas}->{$self->{instance} . '_total'};
|
||||
$self->{result_values}->{Total} = $options{new_datas}->{$self->{instance} . '_total'};
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'global', type => 0, message_separator => ' - ' },
|
||||
{ name => 'nb', type => 1, cb_prefix_output => 'prefix_nb_output', message_multiple => 'All neighbor relations are ok' }
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{global} = [
|
||||
{ label => 'total', set => {
|
||||
key_values => [ { name => 'total' } ],
|
||||
output_template => 'Total neighbors : %s',
|
||||
perfdatas => [
|
||||
{ label => 'total', value => 'total_absolute', template => '%s',
|
||||
min => 0 },
|
||||
],
|
||||
}
|
||||
},
|
||||
{ label => 'total-change', threshold => 0, set => {
|
||||
key_values => [ { name => 'total', diff => 1 } ],
|
||||
closure_custom_calc => $self->can('custom_change_calc'),
|
||||
closure_custom_output => $self->can('custom_change_output'),
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => $self->can('custom_change_threshold'),
|
||||
}
|
||||
},
|
||||
];
|
||||
$self->{maps_counters}->{nb} = [
|
||||
{ label => 'status', threshold => 0, set => {
|
||||
key_values => [ { name => 'NbrIpAddr' }, { name => 'NbrRtrId' }, { name => 'NbrState' } ],
|
||||
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'),
|
||||
}
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$self->{version} = '1.0';
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"warning-status:s" => { name => 'warning_status', default => '' },
|
||||
"critical-status:s" => { name => 'critical_status', default => '%{NbrState} =~ /down/i' },
|
||||
"warning-total-change:s" => { name => 'warning_total_change', default => '' },
|
||||
"critical-total-change:s" => { name => 'critical_total_change', default => '' },
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
$instance_mode = $self;
|
||||
$self->change_macros();
|
||||
}
|
||||
|
||||
sub prefix_nb_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Neighbor '" . $options{instance_value}->{NbrIpAddr} . "/" . $options{instance_value}->{NbrRtrId} . "' ";
|
||||
}
|
||||
|
||||
sub change_macros {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
foreach (('warning_status', 'critical_status', 'warning_total_change', 'critical_total_change')) {
|
||||
if (defined($self->{option_results}->{$_})) {
|
||||
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
my %map_state = (
|
||||
1 => 'down',
|
||||
2 => 'attempt',
|
||||
3 => 'init',
|
||||
4 => 'twoWay',
|
||||
5 => 'exchangeStart',
|
||||
6 => 'exchange',
|
||||
7 => 'loading',
|
||||
8 => 'full',
|
||||
);
|
||||
my $mapping = {
|
||||
NbrIpAddr => { oid => '.1.3.6.1.2.1.14.10.1.1' },
|
||||
NbrRtrId => { oid => '.1.3.6.1.2.1.14.10.1.3' },
|
||||
NbrState => { oid => '.1.3.6.1.2.1.14.10.1.6', map => \%map_state },
|
||||
};
|
||||
|
||||
my $oid_ospfNbrEntry = '.1.3.6.1.2.1.14.10.1';
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{nb} = {};
|
||||
$self->{global} = { total => 0 };
|
||||
my $snmp_result = $options{snmp}->get_table(oid => $oid_ospfNbrEntry,
|
||||
nothing_quit => 1);
|
||||
|
||||
foreach my $oid (keys %{$snmp_result}) {
|
||||
next if ($oid !~ /^$mapping->{NbrState}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => $instance);
|
||||
|
||||
$self->{global}->{total}++;
|
||||
$self->{nb}->{$instance} = { %$result };
|
||||
}
|
||||
|
||||
if (scalar(keys %{$self->{nb}}) <= 0) {
|
||||
$self->{output}->add_option_msg(short_msg => "No neighbors found.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
||||
$self->{cache_name} = "ospf_" . $self->{mode} . '_' . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() . '_' .
|
||||
(defined($self->{option_results}->{filter_counters}) ? md5_hex($self->{option_results}->{filter_counters}) : md5_hex('all'));
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check neighbor relations.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--filter-counters>
|
||||
|
||||
Only display some counters (regexp can be used).
|
||||
Example: --filter-counters='^status$'
|
||||
|
||||
=item B<--warning-status>
|
||||
|
||||
Set warning threshold for status.
|
||||
Can used special variables like: %{NbrState}, %{NbrRtrId}, %{NbrIpAddr}
|
||||
|
||||
=item B<--critical-status>
|
||||
|
||||
Set critical threshold for status (Default: '%{NbrState} =~ /down/i').
|
||||
Can used special variables like: %{NbrState}, %{NbrRtrId}, %{NbrIpAddr}
|
||||
|
||||
=item B<--warning-total-change>
|
||||
|
||||
Set warning threshold. Should be used if there is a difference of total neighbors between two checks.
|
||||
Example: %{TotalLast} != %{Total}
|
||||
|
||||
=item B<--critical-total-change>
|
||||
|
||||
Set critical threshold. Should be used if there is a difference of total neighbors between two checks.
|
||||
Example: %{TotalLast} != %{Total}
|
||||
|
||||
=item B<--warning-*>
|
||||
|
||||
Threshold warning.
|
||||
Can be: 'total'.
|
||||
|
||||
=item B<--critical-*>
|
||||
|
||||
Threshold critical.
|
||||
Can be: 'total'.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
48
apps/protocols/ospf/snmp/plugin.pm
Normal file
48
apps/protocols/ospf/snmp/plugin.pm
Normal 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 apps::protocols::ospf::snmp::plugin;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use base qw(centreon::plugins::script_snmp);
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$self->{version} = '1.0';
|
||||
%{$self->{modes}} = (
|
||||
'neighbor' => 'apps::protocols::ospf::snmp::mode::neighbor',
|
||||
);
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 PLUGIN DESCRIPTION
|
||||
|
||||
Check OSPF protocol in SNMP.
|
||||
|
||||
=cut
|
109
centreon/common/powershell/dell/compellent/volumeusage.pm
Normal file
109
centreon/common/powershell/dell/compellent/volumeusage.pm
Normal file
@ -0,0 +1,109 @@
|
||||
#
|
||||
# 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 centreon::common::powershell::dell::compellent::volumeusage;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::misc;
|
||||
|
||||
sub get_powershell {
|
||||
my (%options) = @_;
|
||||
my $no_ps = (defined($options{no_ps})) ? 1 : 0;
|
||||
|
||||
return '' if ($no_ps == 1);
|
||||
|
||||
my $ps = '
|
||||
$culture = new-object "System.Globalization.CultureInfo" "en-us"
|
||||
[System.Threading.Thread]::CurrentThread.CurrentUICulture = $culture
|
||||
$ProgressPreference = "SilentlyContinue"
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$scuser = "' . $options{cem_user} . '"
|
||||
$scpass = ConvertTo-SecureString "' . $options{cem_password} . '" -AsPlainText -Force
|
||||
$schost = "' . $options{cem_host} . '"
|
||||
$scport = "' . $options{cem_port} . '"
|
||||
$connName = "EMDefault"
|
||||
|
||||
Function display_volume_information {
|
||||
$conn = Connect-DellApiConnection -HostName $schost -Port $scport -User $scuser -password $scpass -Save $connName
|
||||
';
|
||||
if (defined($options{filter_sc}) && $options{filter_sc} ne '') {
|
||||
$ps .= '$storageCenters = Get-DellStorageCenter -ConnectionName $connName -Name "' . $options{filter_sc} . '"
|
||||
';
|
||||
} else {
|
||||
$ps .= '$storageCenters = Get-DellStorageCenter -ConnectionName $connName
|
||||
';
|
||||
}
|
||||
|
||||
$ps .= '
|
||||
foreach ($sc in $storageCenters) {
|
||||
$volumeList = Get-DellScVolume -ConnectionName $connName -StorageCenter $sc
|
||||
foreach ($vol in $volumeList) {
|
||||
$volusage = Get-DellScVolumeStorageUsageAssociation -ConnectionName $connName -Instance $vol
|
||||
$usage = Get-DellScVolumeStorageUsage -ConnectionName $connName -Instance $volusage
|
||||
|
||||
write-host ("[sc={0}]" -f $sc.Name) -NoNewline
|
||||
write-host ("[volume={0}]" -f $usage.Name) -NoNewline
|
||||
write-host ("[configuredSpace={0}]" -f $usage.ConfiguredSpace.GetByteSize()) -NoNewline
|
||||
write-host ("[freeSpace={0}]" -f $usage.FreeSpace.GetByteSize()) -NoNewline
|
||||
write-host ("[activeSpace={0}]" -f $usage.ActiveSpace.GetByteSize()) -NoNewline
|
||||
write-host ("[raidOverhead={0}]" -f $usage.RaidOverhead.GetByteSize()) -NoNewline
|
||||
write-host ("[totalDiskSpace={0}]" -f $usage.TotalDiskSpace.GetByteSize()) -NoNewline
|
||||
write-host ("[replaySpace={0}]" -f $usage.replaySpace.GetByteSize())
|
||||
}
|
||||
|
||||
$diskList = Get-DellScDisk -ConnectionName $connName -StorageCenter $sc
|
||||
foreach ($disk in $diskList) {
|
||||
$diskusage = Get-DellScDiskStorageUsageAssociation -ConnectionName $connName -Instance $disk
|
||||
$usage = Get-DellScDiskStorageUsage -ConnectionName $connName -Instance $diskusage
|
||||
write-host ("[sc={0}]" -f $sc.Name) -NoNewline
|
||||
write-host ("[disk={0}]" -f $disk.Name) -NoNewline
|
||||
write-host ("[spare={0}]" -f $disk.Spare) -NoNewline
|
||||
write-host ("[allocatedSpace={0}]" -f $usage.AllocatedSpace.GetByteSize())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Try {
|
||||
Import-Module "' . $options{sdk_path_dll} . '"
|
||||
display_volume_information
|
||||
} Catch {
|
||||
Write-Host $Error[0].Exception
|
||||
$ret = Remove-DellSavedApiConnection -Name $connName
|
||||
exit 1
|
||||
}
|
||||
|
||||
$ret = Remove-DellSavedApiConnection -Name $connName
|
||||
exit 0
|
||||
';
|
||||
|
||||
return centreon::plugins::misc::powershell_encoded($ps);
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Method to get compellent volume informations.
|
||||
|
||||
=cut
|
@ -30,7 +30,7 @@ use Pod::Find qw(pod_where);
|
||||
|
||||
my %handlers = (DIE => {});
|
||||
|
||||
my $global_version = 20160220;
|
||||
my $global_version = 20160324;
|
||||
my $alternative_fatpacker = 0;
|
||||
|
||||
sub new {
|
||||
|
@ -1,3 +1,12 @@
|
||||
2016-03-24 Quentin Garnier <qgarnier@centreon.com>
|
||||
* Plugin added: to check AKCP SensorProbe
|
||||
* Plugin added: to check Juniper ISG
|
||||
* Plugin added: to check OSPF protocol
|
||||
* Plugin added: to check Microsoft Cluster Service
|
||||
* Plugin added: to check Dell Compellent in SNMP and Powershell SDK
|
||||
* Enhancement: [snmp_standard]{string-value} Many changes (#228)
|
||||
* Fix: [raritan] OnOff sending errors (#348)
|
||||
|
||||
2016-02-20 Quentin Garnier <qgarnier@centreon.com>
|
||||
* Add a class for FatPacker system
|
||||
|
||||
|
@ -65,8 +65,8 @@ sub run {
|
||||
$result->{$oid_licenceUsers} = undef if ($result->{$oid_licenceUsers} == 0);
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("'%d' connected users (Available licence: %s)",
|
||||
$result->{$oid_totalConnectedUsers}),
|
||||
defined($result->{$oid_licenceUsers}) ? $result->{$oid_licenceUsers} : '-');
|
||||
$result->{$oid_totalConnectedUsers},
|
||||
defined($result->{$oid_licenceUsers}) ? $result->{$oid_licenceUsers} : '-'));
|
||||
$self->{output}->perfdata_add(value => $result->{$oid_totalConnectedUsers}, label => 'users',
|
||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
|
||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
|
||||
|
338
storage/dell/compellent/local/mode/volumeusage.pm
Normal file
338
storage/dell/compellent/local/mode/volumeusage.pm
Normal file
@ -0,0 +1,338 @@
|
||||
#
|
||||
# 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::dell::compellent::local::mode::volumeusage;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::misc;
|
||||
use centreon::common::powershell::dell::compellent::volumeusage;
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'sc', type => 1, cb_prefix_output => 'prefix_sc_output', message_multiple => 'All storage centers are ok' },
|
||||
{ name => 'volume', type => 1, cb_prefix_output => 'prefix_volume_output', message_multiple => 'All volumes are ok' }
|
||||
];
|
||||
$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,
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
$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,
|
||||
}
|
||||
},
|
||||
{ label => 'volume-overhead', set => {
|
||||
key_values => [ { name => 'overhead' }, { name => 'display' } ],
|
||||
output_template => 'Raid Overhead : %s %s',
|
||||
output_change_bytes => 1,
|
||||
perfdatas => [
|
||||
{ label => 'volume_overhead', value => 'overhead_absolute', template => '%d',
|
||||
unit => 'B', min => 0, label_extra_instance => 1, instance_use => 'display_absolute' },
|
||||
],
|
||||
}
|
||||
},
|
||||
{ label => 'volume-replay', set => {
|
||||
key_values => [ { name => 'replay' }, { name => 'display' } ],
|
||||
output_template => 'Replay : %s %s',
|
||||
output_change_bytes => 1,
|
||||
perfdatas => [
|
||||
{ label => 'volume_replay', value => 'replay_absolute', template => '%d',
|
||||
unit => 'B', min => 0, label_extra_instance => 1, instance_use => 'display_absolute' },
|
||||
],
|
||||
}
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
sub prefix_sc_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Storage center '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
sub prefix_volume_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Volume '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
my $instance_mode;
|
||||
|
||||
sub custom_usage_perfdata {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $label = $self->{result_values}->{type} . '_used';
|
||||
my $value_perf = $self->{result_values}->{used};
|
||||
if (defined($instance_mode->{option_results}->{free})) {
|
||||
$label = $self->{result_values}->{type} . '_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 '%') {
|
||||
$total_options{total} = $self->{result_values}->{total};
|
||||
$total_options{cast_int} = 1;
|
||||
}
|
||||
|
||||
$self->{output}->perfdata_add(label => $label . $extra_label, unit => 'B',
|
||||
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 ($total_size_value, $total_size_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{total});
|
||||
my ($total_used_value, $total_used_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{used});
|
||||
my ($total_free_value, $total_free_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{free});
|
||||
my $msg = sprintf("Total: %s Used: %s (%.2f%%) Free: %s (%.2f%%)",
|
||||
$total_size_value . " " . $total_size_unit,
|
||||
$total_used_value . " " . $total_used_unit, $self->{result_values}->{prct_used},
|
||||
$total_free_value . " " . $total_free_unit, $self->{result_values}->{prct_free});
|
||||
return $msg;
|
||||
}
|
||||
|
||||
sub custom_usage_calc {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{result_values}->{display} = $options{new_datas}->{$self->{instance} . '_display'};
|
||||
$self->{result_values}->{total} = $options{new_datas}->{$self->{instance} . '_total'};
|
||||
$self->{result_values}->{used} = $options{new_datas}->{$self->{instance} . '_used'};
|
||||
$self->{result_values}->{type} = $options{new_datas}->{$self->{instance} . '_type'};
|
||||
|
||||
$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};
|
||||
# snapshot can be over 100%
|
||||
if ($self->{result_values}->{free} < 0) {
|
||||
$self->{result_values}->{free} = 0;
|
||||
$self->{result_values}->{prct_free} = 0;
|
||||
}
|
||||
|
||||
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 =>
|
||||
{
|
||||
"cem-host:s" => { name => 'cem_host' },
|
||||
"cem-user:s" => { name => 'cem_user' },
|
||||
"cem-password:s" => { name => 'cem_password' },
|
||||
"cem-port:s" => { name => 'cem_port', default => 3033 },
|
||||
"sdk-path-dll:s" => { name => 'sdk_path_dll' },
|
||||
"timeout:s" => { name => 'timeout', default => 50 },
|
||||
"command:s" => { name => 'command', default => 'powershell.exe' },
|
||||
"command-path:s" => { name => 'command_path' },
|
||||
"command-options:s" => { name => 'command_options', default => '-InputFormat none -NoLogo -EncodedCommand' },
|
||||
"no-ps" => { name => 'no_ps' },
|
||||
"ps-exec-only" => { name => 'ps_exec_only' },
|
||||
"ps-sc-filter:s" => { name => 'ps_sc_filter' },
|
||||
"units:s" => { name => 'units', default => '%' },
|
||||
"free" => { name => 'free' },
|
||||
});
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
foreach my $label (('cem_host', 'cem_user', 'cem_password', 'cem_port', 'sdk_path_dll')) {
|
||||
if (!defined($self->{option_results}->{$label}) || $self->{option_results}->{$label} eq '') {
|
||||
my ($label_opt) = $label;
|
||||
$label_opt =~ tr/_/-/;
|
||||
$self->{output}->add_option_msg(short_msg => "Need to specify --" . $label_opt . " option.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
}
|
||||
|
||||
$instance_mode = $self;
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $ps = centreon::common::powershell::dell::compellent::volumeusage::get_powershell(cem_host => $self->{option_results}->{cem_host},
|
||||
cem_user => $self->{option_results}->{cem_user},
|
||||
cem_password => $self->{option_results}->{cem_password},
|
||||
cem_port => $self->{option_results}->{cem_port},
|
||||
sdk_path_dll => $self->{option_results}->{sdk_path_dll},
|
||||
no_ps => $self->{option_results}->{no_ps},
|
||||
filter_sc => $self->{option_results}->{ps_sc_filter});
|
||||
|
||||
$self->{option_results}->{command_options} .= " " . $ps;
|
||||
my ($stdout) = centreon::plugins::misc::windows_execute(output => $self->{output},
|
||||
timeout => $self->{option_results}->{timeout},
|
||||
command => $self->{option_results}->{command},
|
||||
command_path => $self->{option_results}->{command_path},
|
||||
command_options => $self->{option_results}->{command_options});
|
||||
if (defined($self->{option_results}->{ps_exec_only})) {
|
||||
$self->{output}->output_add(severity => 'OK',
|
||||
short_msg => $stdout);
|
||||
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
|
||||
$self->{output}->exit();
|
||||
}
|
||||
|
||||
# [sc=PRD-SAN-01][volume=SC-S06][configuredSpace=xxxxx][freeSpace=xxxxx][activeSpace=xxxxx][raidOverhead=xxx][totalDiskSpace=xxxx][replaySpace=xxxx]
|
||||
$self->{volume} = {};
|
||||
$self->{sc} = {};
|
||||
while ($stdout =~ /^\[sc=(.*?)\]\[volume=(.*?)\]\[configuredSpace=(.*?)\]\[freeSpace=(.*?)\]\[activeSpace=(.*?)\]\[raidOverhead=(.*?)\]\[totalDiskSpace=(.*?)\]\[replaySpace=(.*?)\]/mig) {
|
||||
my ($sc, $volume, $configured_space, $free_space, $active_space, $raid_overhead, $total_disk_space, $replay_space) =
|
||||
($1, $2, $3, $4, $5, $6, $7, $8);
|
||||
my $name = $sc . '/' . $volume;
|
||||
|
||||
$self->{volume}->{$name} = { display => $name, total => $configured_space, type => 'volume',
|
||||
used => $active_space + $raid_overhead + $replay_space,
|
||||
overhead => $raid_overhead, replay => $replay_space};
|
||||
$self->{sc}->{$sc} = { display => $sc, total => 0, used => 0, type => 'sc' } if (!defined($self->{sc}->{$sc}));
|
||||
$self->{sc}->{$sc}->{used} += $active_space + $raid_overhead + $replay_space;
|
||||
}
|
||||
|
||||
# [sc=PRD-SAN-01][disk=01-01][spare=False][allocatedSpace=960195723264]
|
||||
while ($stdout =~ /^\[sc=(.*?)\]\[disk=(.*?)\]\[spare=(.*?)\]\[allocatedSpace=(.*?)\]/mig) {
|
||||
my ($sc, $disk, $spare, $allocated_space) =
|
||||
($1, $2, $3, $4);
|
||||
$self->{sc}->{$sc}->{total} += $allocated_space;
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check storage center and volume usages.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--cem-host>
|
||||
|
||||
Compellent Entreprise Manager hostname (Required).
|
||||
|
||||
=item B<--cem-user>
|
||||
|
||||
Compellent Entreprise Manager username (Required).
|
||||
|
||||
=item B<--cem-password>
|
||||
|
||||
Compellent Entreprise Manager password (Required).
|
||||
|
||||
=item B<--cem-port>
|
||||
|
||||
Compellent Entreprise Manager port (Default: 3033).
|
||||
|
||||
=item B<--sdk-path-dll>
|
||||
|
||||
Path to 'DellStorage.ApiCommandSet.dll' (Required).
|
||||
|
||||
=item B<--timeout>
|
||||
|
||||
Set timeout time for command execution (Default: 50 sec)
|
||||
|
||||
=item B<--no-ps>
|
||||
|
||||
Don't encode powershell. To be used with --command and 'type' command.
|
||||
|
||||
=item B<--command>
|
||||
|
||||
Command to get information (Default: 'powershell.exe').
|
||||
Can be changed if you have output in a file. To be used with --no-ps option!!!
|
||||
|
||||
=item B<--command-path>
|
||||
|
||||
Command path (Default: none).
|
||||
|
||||
=item B<--command-options>
|
||||
|
||||
Command options (Default: '-InputFormat none -NoLogo -EncodedCommand').
|
||||
|
||||
=item B<--ps-exec-only>
|
||||
|
||||
Print powershell output.
|
||||
|
||||
=item B<--ps-sc-filter>
|
||||
|
||||
Filter Storage Center (only wilcard '*' can be used. In Powershell).
|
||||
|
||||
=item B<--units>
|
||||
|
||||
Units of thresholds (Default: '%') ('%', 'B').
|
||||
|
||||
=item B<--free>
|
||||
|
||||
Thresholds are on free space left.
|
||||
|
||||
=item B<--filter-counters>
|
||||
|
||||
Only display some counters (regexp can be used).
|
||||
Example: --filter-counters='^sc-total$'
|
||||
|
||||
=item B<--warning-*>
|
||||
|
||||
Threshold warning.
|
||||
Can be: 'sc-total', 'volume-usage', 'volume-overhead', 'volume-replay'.
|
||||
|
||||
=item B<--critical-*>
|
||||
|
||||
Threshold critical.
|
||||
Can be: 'sc-total', 'volume-usage', 'volume-overhead', 'volume-replay'.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
48
storage/dell/compellent/local/plugin.pm
Normal file
48
storage/dell/compellent/local/plugin.pm
Normal 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::dell::compellent::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}} = (
|
||||
'volume-usage' => 'storage::dell::compellent::local::mode::volumeusage',
|
||||
);
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 PLUGIN DESCRIPTION
|
||||
|
||||
Check Dell Compellent Storage. Need Dell Storage PowerShell SDK.
|
||||
|
||||
=cut
|
66
storage/dell/compellent/snmp/mode/components/cache.pm
Normal file
66
storage/dell/compellent/snmp/mode/components/cache.pm
Normal file
@ -0,0 +1,66 @@
|
||||
#
|
||||
# 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::dell::compellent::snmp::mode::components::cache;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use storage::dell::compellent::snmp::mode::components::resources qw(%map_sc_status);
|
||||
|
||||
my $mapping = {
|
||||
scCacheStatus => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.28.1.3', map => \%map_sc_status },
|
||||
scCacheName => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.28.1.4' },
|
||||
};
|
||||
my $oid_scCacheEntry = '.1.3.6.1.4.1.674.11000.2000.500.1.2.28.1';
|
||||
|
||||
sub load {
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$self->{request}}, { oid => $oid_scCacheEntry, begin => $mapping->{scCacheStatus}->{oid}, end => $mapping->{scCacheName}->{oid} };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking caches");
|
||||
$self->{components}->{cache} = {name => 'caches', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'cache'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_scCacheEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{scCacheStatus}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_scCacheEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_filter(section => 'cache', instance => $instance));
|
||||
$self->{components}->{cache}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("cache '%s' status is '%s' [instance = %s]",
|
||||
$result->{scCacheName}, $result->{scCacheStatus}, $instance,
|
||||
));
|
||||
|
||||
my $exit = $self->get_severity(label => 'default', section => 'cache', value => $result->{scCacheStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Cache '%s' status is '%s'", $result->{scCacheName}, $result->{scCacheStatus}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
66
storage/dell/compellent/snmp/mode/components/ctrl.pm
Normal file
66
storage/dell/compellent/snmp/mode/components/ctrl.pm
Normal file
@ -0,0 +1,66 @@
|
||||
#
|
||||
# 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::dell::compellent::snmp::mode::components::ctrl;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use storage::dell::compellent::snmp::mode::components::resources qw(%map_sc_status);
|
||||
|
||||
my $mapping = {
|
||||
scCtlrStatus => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.13.1.3', map => \%map_sc_status },
|
||||
scCtlrName => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.13.1.4' },
|
||||
};
|
||||
my $oid_scCtlrEntry = '.1.3.6.1.4.1.674.11000.2000.500.1.2.13.1';
|
||||
|
||||
sub load {
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$self->{request}}, { oid => $oid_scCtlrEntry, begin => $mapping->{scCtlrStatus}->{oid}, end => $mapping->{scCtlrName}->{oid} };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking controllers");
|
||||
$self->{components}->{ctrl} = {name => 'controllers', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'ctrl'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_scCtlrEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{scCtlrStatus}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_scCtlrEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_filter(section => 'ctrl', instance => $instance));
|
||||
$self->{components}->{ctrl}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("controller '%s' status is '%s' [instance = %s]",
|
||||
$result->{scCtlrName}, $result->{scCtlrStatus}, $instance,
|
||||
));
|
||||
|
||||
my $exit = $self->get_severity(label => 'default', section => 'ctrl', value => $result->{scCtlrStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Controller '%s' status is '%s'", $result->{scCtlrName}, $result->{scCtlrStatus}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
102
storage/dell/compellent/snmp/mode/components/ctrlfan.pm
Normal file
102
storage/dell/compellent/snmp/mode/components/ctrlfan.pm
Normal file
@ -0,0 +1,102 @@
|
||||
#
|
||||
# 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::dell::compellent::snmp::mode::components::ctrlfan;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use storage::dell::compellent::snmp::mode::components::resources qw(%map_sc_status);
|
||||
|
||||
my $mapping = {
|
||||
scCtlrFanStatus => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.16.1.3', map => \%map_sc_status },
|
||||
scCtlrFanName => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.16.1.4' },
|
||||
scCtlrFanCurrentRpm => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.16.1.5' },
|
||||
scCtlrFanWarnLwrRpm => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.16.1.8' },
|
||||
scCtlrFanWarnUprRpm => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.16.1.9' },
|
||||
scCtlrFanCritLwrRpm => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.16.1.10' },
|
||||
scCtlrFanCritUprRpm => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.16.1.11' },
|
||||
};
|
||||
my $oid_scCtlrFanEntry = '.1.3.6.1.4.1.674.11000.2000.500.1.2.16.1';
|
||||
|
||||
sub load {
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$self->{request}}, { oid => $oid_scCtlrFanEntry };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking controller fans");
|
||||
$self->{components}->{ctrlfan} = {name => 'controller fans', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'ctrlfan'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_scCtlrFanEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{scCtlrFanStatus}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_scCtlrFanEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_filter(section => 'ctrlfan', instance => $instance));
|
||||
|
||||
$self->{components}->{ctrlfan}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("controller fan '%s' status is '%s' [instance = %s] [value = %s]",
|
||||
$result->{scCtlrFanName}, $result->{scCtlrFanStatus}, $instance,
|
||||
$result->{scCtlrFanCurrentRpm}));
|
||||
|
||||
my $exit = $self->get_severity(label => 'default', section => 'ctrlfan', value => $result->{scCtlrFanStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Controller fan '%s' status is '%s'", $result->{scCtlrFanName}, $result->{scCtlrFanStatus}));
|
||||
}
|
||||
|
||||
my ($exit2, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'ctrlfan', instance => $instance, value => $result->{scCtlrFanCurrentRpm});
|
||||
if ($checked == 0) {
|
||||
$result->{scCtlrFanWarnLwrRpm} = (defined($result->{scCtlrFanWarnLwrRpm}) && $result->{scCtlrFanWarnLwrRpm} =~ /[0-9]/) ?
|
||||
$result->{scCtlrFanWarnLwrRpm} : '';
|
||||
$result->{scCtlrFanCritLwrRpm} = (defined($result->{scCtlrFanCritLwrRpm}) && $result->{scCtlrFanCritLwrRpm} =~ /[0-9]/) ?
|
||||
$result->{scCtlrFanCritLwrRpm} : '';
|
||||
$result->{scCtlrFanWarnUprRpm} = (defined($result->{scCtlrFanWarnUprRpm}) && $result->{scCtlrFanWarnUprRpm} =~ /[0-9]/) ?
|
||||
$result->{scCtlrFanWarnUprRpm} : '';
|
||||
$result->{scCtlrFanCritUprRpm} = (defined($result->{scCtlrFanCritUprRpm}) && $result->{scCtlrFanCritUprRpm} =~ /[0-9]/) ?
|
||||
$result->{scCtlrFanCritUprRpm} : '';
|
||||
my $warn_th = $result->{scCtlrFanWarnLwrRpm} . ':' . $result->{scCtlrFanWarnUprRpm};
|
||||
my $crit_th = $result->{scCtlrFanCritLwrRpm} . ':' . $result->{scCtlrFanCritUprRpm};
|
||||
$self->{perfdata}->threshold_validate(label => 'warning-ctrlfan-instance-' . $instance, value => $warn_th);
|
||||
$self->{perfdata}->threshold_validate(label => 'critical-ctrlfan-instance-' . $instance, value => $crit_th);
|
||||
|
||||
$warn = $self->{perfdata}->get_perfdata_for_output(label => 'warning-ctrlfan-instance-' . $instance);
|
||||
$crit = $self->{perfdata}->get_perfdata_for_output(label => 'critical-ctrlfan-instance-' . $instance);
|
||||
}
|
||||
|
||||
if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit2,
|
||||
short_msg => sprintf("Controller fan '%s' is %s rpm", $result->{scCtlrFanName}, $result->{scCtlrFanCurrentRpm}));
|
||||
}
|
||||
$self->{output}->perfdata_add(label => 'ctrlfan_' . $instance, unit => 'rpm',
|
||||
value => $result->{scCtlrFanCurrentRpm},
|
||||
warning => $warn,
|
||||
critical => $crit,
|
||||
min => 0
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
66
storage/dell/compellent/snmp/mode/components/ctrlpower.pm
Normal file
66
storage/dell/compellent/snmp/mode/components/ctrlpower.pm
Normal file
@ -0,0 +1,66 @@
|
||||
#
|
||||
# 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::dell::compellent::snmp::mode::components::ctrlpower;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use storage::dell::compellent::snmp::mode::components::resources qw(%map_sc_status);
|
||||
|
||||
my $mapping = {
|
||||
scCtlrPowerStatus => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.17.1.3', map => \%map_sc_status },
|
||||
scCtlrPowerName => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.17.1.4' },
|
||||
};
|
||||
my $oid_scCtlrPowerEntry = '.1.3.6.1.4.1.674.11000.2000.500.1.2.17.1';
|
||||
|
||||
sub load {
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$self->{request}}, { oid => $oid_scCtlrPowerEntry, begin => $mapping->{scCtlrPowerStatus}->{oid}, end => $mapping->{scCtlrPowerName}->{oid} };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking controller power supplies");
|
||||
$self->{components}->{ctrlpower} = {name => 'controller psus', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'ctrlpower'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_scCtlrPowerEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{scCtlrPowerStatus}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_scCtlrPowerEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_filter(section => 'ctrlpower', instance => $instance));
|
||||
$self->{components}->{ctrlpower}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("controller power supply '%s' status is '%s' [instance = %s]",
|
||||
$result->{scCtlrPowerName}, $result->{scCtlrPowerStatus}, $instance,
|
||||
));
|
||||
|
||||
my $exit = $self->get_severity(label => 'default', section => 'ctrlpower', value => $result->{scCtlrPowerStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Controller power supply '%s' status is '%s'", $result->{scCtlrPowerName}, $result->{scCtlrPowerStatus}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
101
storage/dell/compellent/snmp/mode/components/ctrltemp.pm
Normal file
101
storage/dell/compellent/snmp/mode/components/ctrltemp.pm
Normal file
@ -0,0 +1,101 @@
|
||||
#
|
||||
# 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::dell::compellent::snmp::mode::components::ctrltemp;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use storage::dell::compellent::snmp::mode::components::resources qw(%map_sc_status);
|
||||
|
||||
my $mapping = {
|
||||
scCtlrTempStatus => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.19.1.3', map => \%map_sc_status },
|
||||
scCtlrTempName => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.19.1.4' },
|
||||
scCtlrTempCurrentC => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.19.1.5' },
|
||||
scCtlrTempWarnLwrC => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.19.1.8' },
|
||||
scCtlrTempWarnUprC => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.19.1.9' },
|
||||
scCtlrTempCritLwrC => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.19.1.10' },
|
||||
scCtlrTempCritUprC => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.19.1.11' },
|
||||
};
|
||||
my $oid_scCtlrTempEntry = '.1.3.6.1.4.1.674.11000.2000.500.1.2.19.1';
|
||||
|
||||
sub load {
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$self->{request}}, { oid => $oid_scCtlrTempEntry };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking controller temperatures");
|
||||
$self->{components}->{ctrltemp} = {name => 'controller temperatures', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'ctrltemp'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_scCtlrTempEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{scCtlrTempStatus}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_scCtlrTempEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_filter(section => 'ctrltemp', instance => $instance));
|
||||
|
||||
$self->{components}->{ctrltemp}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("controller temperature '%s' status is '%s' [instance = %s] [value = %s]",
|
||||
$result->{scCtlrTempName}, $result->{scCtlrTempStatus}, $instance,
|
||||
$result->{scCtlrTempCurrentC}));
|
||||
|
||||
my $exit = $self->get_severity(label => 'default', section => 'ctrltemp', value => $result->{scCtlrTempStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Controller temperature '%s' status is '%s'", $result->{scCtlrTempName}, $result->{scCtlrTempStatus}));
|
||||
}
|
||||
|
||||
my ($exit2, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'ctrltemp', instance => $instance, value => $result->{scCtlrTempCurrentC});
|
||||
if ($checked == 0) {
|
||||
$result->{scCtlrTempWarnLwrC} = (defined($result->{scCtlrTempWarnLwrC}) && $result->{scCtlrTempWarnLwrC} =~ /[0-9]/) ?
|
||||
$result->{scCtlrTempWarnLwrC} : '';
|
||||
$result->{scCtlrTempCritLwrC} = (defined($result->{scCtlrTempCritLwrC}) && $result->{scCtlrTempCritLwrC} =~ /[0-9]/) ?
|
||||
$result->{scCtlrTempCritLwrC} : '';
|
||||
$result->{scCtlrTempWarnUprC} = (defined($result->{scCtlrTempWarnUprC}) && $result->{scCtlrTempWarnUprC} =~ /[0-9]/) ?
|
||||
$result->{scCtlrTempWarnUprC} : '';
|
||||
$result->{scCtlrTempCritUprC} = (defined($result->{scCtlrTempCritUprC}) && $result->{scCtlrTempCritUprC} =~ /[0-9]/) ?
|
||||
$result->{scCtlrTempCritUprC} : '';
|
||||
my $warn_th = $result->{scCtlrTempWarnLwrC} . ':' . $result->{scCtlrTempWarnUprC};
|
||||
my $crit_th = $result->{scCtlrTempCritLwrC} . ':' . $result->{scCtlrTempCritUprC};
|
||||
$self->{perfdata}->threshold_validate(label => 'warning-ctrltemp-instance-' . $instance, value => $warn_th);
|
||||
$self->{perfdata}->threshold_validate(label => 'critical-ctrltemp-instance-' . $instance, value => $crit_th);
|
||||
|
||||
$warn = $self->{perfdata}->get_perfdata_for_output(label => 'warning-ctrltemp-instance-' . $instance);
|
||||
$crit = $self->{perfdata}->get_perfdata_for_output(label => 'critical-ctrltemp-instance-' . $instance);
|
||||
}
|
||||
|
||||
if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit2,
|
||||
short_msg => sprintf("Controller temperature '%s' is %s C", $result->{scCtlrTempName}, $result->{scCtlrTempCurrentC}));
|
||||
}
|
||||
$self->{output}->perfdata_add(label => 'ctrltemp_' . $instance, unit => 'C',
|
||||
value => $result->{scCtlrTempCurrentC},
|
||||
warning => $warn,
|
||||
critical => $crit,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
101
storage/dell/compellent/snmp/mode/components/ctrlvoltage.pm
Normal file
101
storage/dell/compellent/snmp/mode/components/ctrlvoltage.pm
Normal file
@ -0,0 +1,101 @@
|
||||
#
|
||||
# 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::dell::compellent::snmp::mode::components::ctrlvoltage;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use storage::dell::compellent::snmp::mode::components::resources qw(%map_sc_status);
|
||||
|
||||
my $mapping = {
|
||||
scCtlrVoltageStatus => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.18.1.3', map => \%map_sc_status },
|
||||
scCtlrVoltageName => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.18.1.4' },
|
||||
scCtlrVoltageCurrentV => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.18.1.5' },
|
||||
scCtlrVoltageWarnLwrV => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.18.1.8' },
|
||||
scCtlrVoltageWarnUprV => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.18.1.9' },
|
||||
scCtlrVoltageCritLwrV => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.18.1.10' },
|
||||
scCtlrVoltageCritUprV => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.18.1.11' },
|
||||
};
|
||||
my $oid_scCtlrVoltageEntry = '.1.3.6.1.4.1.674.11000.2000.500.1.2.18.1';
|
||||
|
||||
sub load {
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$self->{request}}, { oid => $oid_scCtlrVoltageEntry };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking controller voltages");
|
||||
$self->{components}->{ctrlvoltage} = {name => 'controller voltages', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'ctrlvoltage'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_scCtlrVoltageEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{scCtlrVoltageStatus}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_scCtlrVoltageEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_filter(section => 'ctrlvoltage', instance => $instance));
|
||||
|
||||
$self->{components}->{ctrlvoltage}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("controller voltage '%s' status is '%s' [instance = %s] [value = %s]",
|
||||
$result->{scCtlrVoltageName}, $result->{scCtlrVoltageStatus}, $instance,
|
||||
$result->{scCtlrVoltageCurrentV}));
|
||||
|
||||
my $exit = $self->get_severity(label => 'default', section => 'ctrlvoltage', value => $result->{scCtlrVoltageStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Controller voltage '%s' status is '%s'", $result->{scCtlrVoltageName}, $result->{scCtlrVoltageStatus}));
|
||||
}
|
||||
|
||||
my ($exit2, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'ctrlvoltage', instance => $instance, value => $result->{scCtlrVoltageCurrentV});
|
||||
if ($checked == 0) {
|
||||
$result->{scCtlrVoltageWarnLwrV} = (defined($result->{scCtlrVoltageWarnLwrV}) && $result->{scCtlrVoltageWarnLwrV} =~ /[0-9]/) ?
|
||||
$result->{scCtlrVoltageWarnLwrV} : '';
|
||||
$result->{scCtlrVoltageCritLwrV} = (defined($result->{scCtlrVoltageCritLwrV}) && $result->{scCtlrVoltageCritLwrV} =~ /[0-9]/) ?
|
||||
$result->{scCtlrVoltageCritLwrV} : '';
|
||||
$result->{scCtlrVoltageWarnUprV} = (defined($result->{scCtlrVoltageWarnUprV}) && $result->{scCtlrVoltageWarnUprV} =~ /[0-9]/) ?
|
||||
$result->{scCtlrVoltageWarnUprV} : '';
|
||||
$result->{scCtlrVoltageCritUprV} = (defined($result->{scCtlrVoltageCritUprV}) && $result->{scCtlrVoltageCritUprV} =~ /[0-9]/) ?
|
||||
$result->{scCtlrVoltageCritUprV} : '';
|
||||
my $warn_th = $result->{scCtlrVoltageWarnLwrV} . ':' . $result->{scCtlrVoltageWarnUprV};
|
||||
my $crit_th = $result->{scCtlrVoltageCritLwrV} . ':' . $result->{scCtlrVoltageCritUprV};
|
||||
$self->{perfdata}->threshold_validate(label => 'warning-ctrlvoltage-instance-' . $instance, value => $warn_th);
|
||||
$self->{perfdata}->threshold_validate(label => 'critical-ctrlvoltage-instance-' . $instance, value => $crit_th);
|
||||
|
||||
$warn = $self->{perfdata}->get_perfdata_for_output(label => 'warning-ctrlvoltage-instance-' . $instance);
|
||||
$crit = $self->{perfdata}->get_perfdata_for_output(label => 'critical-ctrlvoltage-instance-' . $instance);
|
||||
}
|
||||
|
||||
if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit2,
|
||||
short_msg => sprintf("Controller voltage '%s' is %s V", $result->{scCtlrVoltageName}, $result->{scCtlrVoltageCurrentV}));
|
||||
}
|
||||
$self->{output}->perfdata_add(label => 'ctrlvoltage_' . $instance, unit => 'V',
|
||||
value => $result->{scCtlrVoltageCurrentV},
|
||||
warning => $warn,
|
||||
critical => $crit,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
66
storage/dell/compellent/snmp/mode/components/disk.pm
Normal file
66
storage/dell/compellent/snmp/mode/components/disk.pm
Normal file
@ -0,0 +1,66 @@
|
||||
#
|
||||
# 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::dell::compellent::snmp::mode::components::disk;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use storage::dell::compellent::snmp::mode::components::resources qw(%map_sc_status);
|
||||
|
||||
my $mapping = {
|
||||
scDiskStatus => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.14.1.3', map => \%map_sc_status },
|
||||
scDiskNamePosition => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.14.1.4' },
|
||||
};
|
||||
my $oid_scDiskEntry = '.1.3.6.1.4.1.674.11000.2000.500.1.2.14.1';
|
||||
|
||||
sub load {
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$self->{request}}, { oid => $oid_scDiskEntry, begin => $mapping->{scDiskStatus}->{oid}, end => $mapping->{scDiskNamePosition}->{oid} };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking disks");
|
||||
$self->{components}->{disk} = {name => 'disks', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'disk'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_scDiskEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{scDiskStatus}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_scDiskEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_filter(section => 'disk', instance => $instance));
|
||||
$self->{components}->{disk}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("disk '%s' status is '%s' [instance = %s]",
|
||||
$result->{scDiskNamePosition}, $result->{scDiskStatus}, $instance,
|
||||
));
|
||||
|
||||
my $exit = $self->get_severity(label => 'default', section => 'disk', value => $result->{scDiskStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Disk '%s' status is '%s'", $result->{scDiskNamePosition}, $result->{scDiskStatus}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
66
storage/dell/compellent/snmp/mode/components/encl.pm
Normal file
66
storage/dell/compellent/snmp/mode/components/encl.pm
Normal file
@ -0,0 +1,66 @@
|
||||
#
|
||||
# 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::dell::compellent::snmp::mode::components::encl;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use storage::dell::compellent::snmp::mode::components::resources qw(%map_sc_status);
|
||||
|
||||
my $mapping = {
|
||||
scEnclStatus => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.15.1.3', map => \%map_sc_status },
|
||||
scEnclName => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.15.1.4' },
|
||||
};
|
||||
my $oid_scEnclEntry = '.1.3.6.1.4.1.674.11000.2000.500.1.2.15.1';
|
||||
|
||||
sub load {
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$self->{request}}, { oid => $oid_scEnclEntry, begin => $mapping->{scEnclStatus}->{oid}, end => $mapping->{scEnclName}->{oid} };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking enclosures");
|
||||
$self->{components}->{encl} = {name => 'enclosures', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'encl'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_scEnclEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{scEnclStatus}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_scEnclEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_filter(section => 'encl', instance => $instance));
|
||||
$self->{components}->{encl}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("enclosure '%s' status is '%s' [instance = %s]",
|
||||
$result->{scEnclName}, $result->{scEnclStatus}, $instance,
|
||||
));
|
||||
|
||||
my $exit = $self->get_severity(label => 'default', section => 'encl', value => $result->{scEnclStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Enclosure '%s' status is '%s'", $result->{scEnclName}, $result->{scEnclStatus}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
66
storage/dell/compellent/snmp/mode/components/enclfan.pm
Normal file
66
storage/dell/compellent/snmp/mode/components/enclfan.pm
Normal file
@ -0,0 +1,66 @@
|
||||
#
|
||||
# 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::dell::compellent::snmp::mode::components::enclfan;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use storage::dell::compellent::snmp::mode::components::resources qw(%map_sc_status);
|
||||
|
||||
my $mapping = {
|
||||
scEnclFanStatus => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.20.1.3', map => \%map_sc_status },
|
||||
scEnclFanLocation => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.20.1.4' },
|
||||
};
|
||||
my $oid_scEnclFanEntry = '.1.3.6.1.4.1.674.11000.2000.500.1.2.20.1';
|
||||
|
||||
sub load {
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$self->{request}}, { oid => $oid_scEnclFanEntry, begin => $mapping->{scEnclFanStatus}->{oid}, end => $mapping->{scEnclFanLocation}->{oid} };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking enclosure fans");
|
||||
$self->{components}->{enclfan} = {name => 'enclosure fans', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'enclfan'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_scEnclFanEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{scEnclFanStatus}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_scEnclFanEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_filter(section => 'enclfan', instance => $instance));
|
||||
$self->{components}->{enclfan}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("enclosure fan '%s' status is '%s' [instance = %s]",
|
||||
$result->{scEnclFanLocation}, $result->{scEnclFanStatus}, $instance,
|
||||
));
|
||||
|
||||
my $exit = $self->get_severity(label => 'default', section => 'enclfan', value => $result->{scEnclFanStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Enclosure fan '%s' status is '%s'", $result->{scEnclFanLocation}, $result->{scEnclFanStatus}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
66
storage/dell/compellent/snmp/mode/components/encliomod.pm
Normal file
66
storage/dell/compellent/snmp/mode/components/encliomod.pm
Normal file
@ -0,0 +1,66 @@
|
||||
#
|
||||
# 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::dell::compellent::snmp::mode::components::encliomod;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use storage::dell::compellent::snmp::mode::components::resources qw(%map_sc_status);
|
||||
|
||||
my $mapping = {
|
||||
scEnclIoModStatus => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.22.1.3', map => \%map_sc_status },
|
||||
scEnclIoModPosition => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.22.1.4' },
|
||||
};
|
||||
my $oid_scEnclIoModEntry = '.1.3.6.1.4.1.674.11000.2000.500.1.2.22.1';
|
||||
|
||||
sub load {
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$self->{request}}, { oid => $oid_scEnclIoModEntry, begin => $mapping->{scEnclIoModStatus}->{oid}, end => $mapping->{scEnclIoModPosition}->{oid} };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking enclosure I/O modules");
|
||||
$self->{components}->{encliomod} = {name => 'enclosure I/O modules', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'encliomod'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_scEnclIoModEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{scEnclIoModStatus}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_scEnclIoModEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_filter(section => 'encliomod', instance => $instance));
|
||||
$self->{components}->{encliomod}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("enclosure I/O module '%s' status is '%s' [instance = %s]",
|
||||
$result->{scEnclIoModPosition}, $result->{scEnclIoModStatus}, $instance,
|
||||
));
|
||||
|
||||
my $exit = $self->get_severity(label => 'default', section => 'encliomod', value => $result->{scEnclIoModStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Enclosure I/O module '%s' status is '%s'", $result->{scEnclIoModPosition}, $result->{scEnclIoModStatus}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
66
storage/dell/compellent/snmp/mode/components/enclpower.pm
Normal file
66
storage/dell/compellent/snmp/mode/components/enclpower.pm
Normal file
@ -0,0 +1,66 @@
|
||||
#
|
||||
# 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::dell::compellent::snmp::mode::components::enclpower;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use storage::dell::compellent::snmp::mode::components::resources qw(%map_sc_status);
|
||||
|
||||
my $mapping = {
|
||||
scEnclPowerStatus => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.21.1.3', map => \%map_sc_status },
|
||||
scEnclPowerPosition => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.21.1.4' },
|
||||
};
|
||||
my $oid_scEnclPowerEntry = '.1.3.6.1.4.1.674.11000.2000.500.1.2.21.1';
|
||||
|
||||
sub load {
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$self->{request}}, { oid => $oid_scEnclPowerEntry, begin => $mapping->{scEnclPowerStatus}->{oid}, end => $mapping->{scEnclPowerPosition}->{oid} };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking enclosure power supplies");
|
||||
$self->{components}->{enclpower} = {name => 'enclosure psus', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'enclpower'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_scEnclPowerEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{scEnclPowerStatus}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_scEnclPowerEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_filter(section => 'enclpower', instance => $instance));
|
||||
$self->{components}->{enclpower}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("enclosure power supply '%s' status is '%s' [instance = %s]",
|
||||
$result->{scEnclPowerPosition}, $result->{scEnclPowerStatus}, $instance,
|
||||
));
|
||||
|
||||
my $exit = $self->get_severity(label => 'default', section => 'enclpower', value => $result->{scEnclPowerStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Enclosure power supply '%s' status is '%s'", $result->{scEnclPowerPosition}, $result->{scEnclPowerStatus}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
80
storage/dell/compellent/snmp/mode/components/encltemp.pm
Normal file
80
storage/dell/compellent/snmp/mode/components/encltemp.pm
Normal file
@ -0,0 +1,80 @@
|
||||
#
|
||||
# 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::dell::compellent::snmp::mode::components::encltemp;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use storage::dell::compellent::snmp::mode::components::resources qw(%map_sc_status);
|
||||
|
||||
my $mapping = {
|
||||
scEnclTempStatus => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.23.1.3', map => \%map_sc_status },
|
||||
scEnclTempLocation => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.23.1.4' },
|
||||
scEnclTempCurrentC => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.23.1.5' },
|
||||
};
|
||||
my $oid_scEnclTempEntry = '.1.3.6.1.4.1.674.11000.2000.500.1.2.23.1';
|
||||
|
||||
sub load {
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$self->{request}}, { oid => $oid_scEnclTempEntry };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking enclosure temperatures");
|
||||
$self->{components}->{encltemp} = {name => 'enclosure temperatures', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'encltemp'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_scEnclTempEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{scEnclTempStatus}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_scEnclTempEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_filter(section => 'encltemp', instance => $instance));
|
||||
|
||||
$self->{components}->{encltemp}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("enclosure temperature '%s' status is '%s' [instance = %s] [value = %s]",
|
||||
$result->{scEnclTempLocation}, $result->{scEnclTempStatus}, $instance,
|
||||
$result->{scEnclTempCurrentC}));
|
||||
|
||||
my $exit = $self->get_severity(label => 'default', section => 'encltemp', value => $result->{scEnclTempStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Enclosure temperature '%s' status is '%s'", $result->{scEnclTempLocation}, $result->{scEnclTempStatus}));
|
||||
}
|
||||
|
||||
my ($exit2, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'encltemp', instance => $instance, value => $result->{scEnclTempCurrentC});
|
||||
|
||||
if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit2,
|
||||
short_msg => sprintf("Enclosure temperature '%s' is %s C", $result->{scEnclTempLocation}, $result->{scEnclTempCurrentC}));
|
||||
}
|
||||
$self->{output}->perfdata_add(label => 'encltemp_' . $instance, unit => 'C',
|
||||
value => $result->{scEnclTempCurrentC},
|
||||
warning => $warn,
|
||||
critical => $crit,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
38
storage/dell/compellent/snmp/mode/components/resources.pm
Normal file
38
storage/dell/compellent/snmp/mode/components/resources.pm
Normal file
@ -0,0 +1,38 @@
|
||||
#
|
||||
# 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::dell::compellent::snmp::mode::components::resources;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Exporter;
|
||||
|
||||
our %map_sc_status;
|
||||
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT_OK = qw(%map_sc_status);
|
||||
|
||||
%map_sc_status = (
|
||||
1 => 'up',
|
||||
2 => 'down',
|
||||
3 => 'degraded',
|
||||
);
|
||||
|
||||
1;
|
66
storage/dell/compellent/snmp/mode/components/sc.pm
Normal file
66
storage/dell/compellent/snmp/mode/components/sc.pm
Normal file
@ -0,0 +1,66 @@
|
||||
#
|
||||
# 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::dell::compellent::snmp::mode::components::sc;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use storage::dell::compellent::snmp::mode::components::resources qw(%map_sc_status);
|
||||
|
||||
my $mapping = {
|
||||
scScStatus => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.29.1.3', map => \%map_sc_status },
|
||||
scScName => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.29.1.4' },
|
||||
};
|
||||
my $oid_scScEntry = '.1.3.6.1.4.1.674.11000.2000.500.1.2.29.1';
|
||||
|
||||
sub load {
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$self->{request}}, { oid => $oid_scScEntry, begin => $mapping->{scScStatus}->{oid}, end => $mapping->{scScName}->{oid} };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking storage centers");
|
||||
$self->{components}->{sc} = {name => 'storage centers', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'sc'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_scScEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{scScStatus}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_scScEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_filter(section => 'sc', instance => $instance));
|
||||
$self->{components}->{sc}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("storage center '%s' status is '%s' [instance = %s]",
|
||||
$result->{scScName}, $result->{scScStatus}, $instance,
|
||||
));
|
||||
|
||||
my $exit = $self->get_severity(label => 'default', section => 'sc', value => $result->{scScStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Storage center '%s' status is '%s'", $result->{scScName}, $result->{scScStatus}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
66
storage/dell/compellent/snmp/mode/components/server.pm
Normal file
66
storage/dell/compellent/snmp/mode/components/server.pm
Normal file
@ -0,0 +1,66 @@
|
||||
#
|
||||
# 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::dell::compellent::snmp::mode::components::server;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use storage::dell::compellent::snmp::mode::components::resources qw(%map_sc_status);
|
||||
|
||||
my $mapping = {
|
||||
scServerStatus => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.27.1.3', map => \%map_sc_status },
|
||||
scServerName => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.27.1.4' },
|
||||
};
|
||||
my $oid_scServerEntry = '.1.3.6.1.4.1.674.11000.2000.500.1.2.27.1';
|
||||
|
||||
sub load {
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$self->{request}}, { oid => $oid_scServerEntry, begin => $mapping->{scServerStatus}->{oid}, end => $mapping->{scServerName}->{oid} };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking servers");
|
||||
$self->{components}->{server} = {name => 'servers', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'server'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_scServerEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{scServerStatus}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_scServerEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_filter(section => 'server', instance => $instance));
|
||||
$self->{components}->{server}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("server '%s' status is '%s' [instance = %s]",
|
||||
$result->{scServerName}, $result->{scServerStatus}, $instance,
|
||||
));
|
||||
|
||||
my $exit = $self->get_severity(label => 'default', section => 'server', value => $result->{scServerStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Server '%s' status is '%s'", $result->{scServerName}, $result->{scServerStatus}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
66
storage/dell/compellent/snmp/mode/components/volume.pm
Normal file
66
storage/dell/compellent/snmp/mode/components/volume.pm
Normal file
@ -0,0 +1,66 @@
|
||||
#
|
||||
# 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::dell::compellent::snmp::mode::components::volume;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use storage::dell::compellent::snmp::mode::components::resources qw(%map_sc_status);
|
||||
|
||||
my $mapping = {
|
||||
scVolumeStatus => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.26.1.3', map => \%map_sc_status },
|
||||
scVolumeName => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.26.1.4' },
|
||||
};
|
||||
my $oid_scVolumeEntry = '.1.3.6.1.4.1.674.11000.2000.500.1.2.26.1';
|
||||
|
||||
sub load {
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$self->{request}}, { oid => $oid_scVolumeEntry, begin => $mapping->{scVolumeStatus}->{oid}, end => $mapping->{scVolumeName}->{oid} };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking volumes");
|
||||
$self->{components}->{volume} = {name => 'volumes', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'volume'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_scVolumeEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{scVolumeStatus}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_scVolumeEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_filter(section => 'volume', instance => $instance));
|
||||
$self->{components}->{volume}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("volume '%s' status is '%s' [instance = %s]",
|
||||
$result->{scVolumeName}, $result->{scVolumeStatus}, $instance,
|
||||
));
|
||||
|
||||
my $exit = $self->get_severity(label => 'default', section => 'volume', value => $result->{scVolumeStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Volume '%s' status is '%s'", $result->{scVolumeName}, $result->{scVolumeStatus}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
114
storage/dell/compellent/snmp/mode/hardware.pm
Normal file
114
storage/dell/compellent/snmp/mode/hardware.pm
Normal file
@ -0,0 +1,114 @@
|
||||
#
|
||||
# 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::dell::compellent::snmp::mode::hardware;
|
||||
|
||||
use base qw(centreon::plugins::templates::hardware);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub set_system {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{regexp_threshold_overload_check_section_option} =
|
||||
'^(ctrl|disk|encl|ctrlfan|ctrlpower|ctrlvoltage|ctrltemp|enclfan|enclpower|encliomod|encltemp|volume|cache|server|sc)$';
|
||||
$self->{regexp_threshold_numeric_check_section_option} = '^(ctrltemp|ctrlvoltage|ctrlfan|encltemp)$';
|
||||
|
||||
$self->{cb_hook2} = 'snmp_execute';
|
||||
|
||||
$self->{thresholds} = {
|
||||
default => [
|
||||
['up', 'OK'],
|
||||
['down', 'CRITICAL'],
|
||||
['degraded', 'WARNING'],
|
||||
],
|
||||
};
|
||||
|
||||
$self->{components_path} = 'storage::dell::compellent::snmp::mode::components';
|
||||
$self->{components_module} = ['ctrl', 'disk', 'ctrlfan', 'ctrlpower', 'ctrlvoltage', 'ctrltemp',
|
||||
'encl', 'enclfan', 'enclpower', 'encliomod', 'encltemp', 'volume', 'cache', 'server', 'sc'];
|
||||
}
|
||||
|
||||
sub snmp_execute {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{snmp} = $options{snmp};
|
||||
$self->{results} = $self->{snmp}->get_multiple_table(oids => $self->{request});
|
||||
}
|
||||
|
||||
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 =>
|
||||
{
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check sensors.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--component>
|
||||
|
||||
Which component to check (Default: '.*').
|
||||
Can be: 'ctrl', 'disk', 'encl', 'ctrlfan', 'ctrlpower', 'ctrlvoltage',
|
||||
'ctrltemp', 'enclfan', 'enclpower', 'encliomod', 'encltemp', 'volume', 'cache', 'server', 'sc'.
|
||||
|
||||
=item B<--filter>
|
||||
|
||||
Exclude some parts (comma seperated list) (Example: --filter=ctrlfan --filter=enclpower)
|
||||
Can also exclude specific instance: --filter=ctrlfan,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='ctrl,CRITICAL,^(?!(up)$)'
|
||||
|
||||
=item B<--warning>
|
||||
|
||||
Set warning threshold for 'ctrltemp', 'ctrlfan', 'ctrlvoltage', 'encltemp' (syntax: type,regexp,threshold)
|
||||
Example: --warning='ctrltemp,1,30'
|
||||
|
||||
=item B<--critical>
|
||||
|
||||
Set critical threshold for 'ctrltemp', 'ctrlfan', 'ctrlvoltage', 'encltemp' (syntax: type,regexp,threshold)
|
||||
Example: --critical='ctrltemp,1,50'
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
50
storage/dell/compellent/snmp/plugin.pm
Normal file
50
storage/dell/compellent/snmp/plugin.pm
Normal file
@ -0,0 +1,50 @@
|
||||
#
|
||||
# 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::dell::compellent::snmp::plugin;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use base qw(centreon::plugins::script_snmp);
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$self->{version} = '1.0';
|
||||
%{$self->{modes}} = (
|
||||
'hardware' => 'storage::dell::compellent::snmp::mode::hardware',
|
||||
'interfaces' => 'snmp_standard::mode::interfaces',
|
||||
'list-interfaces' => 'snmp_standard::mode::listinterfaces',
|
||||
);
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 PLUGIN DESCRIPTION
|
||||
|
||||
Check Dell Compellent in SNMP.
|
||||
|
||||
=cut
|
@ -45,7 +45,7 @@ sub custom_threshold_output {
|
||||
$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 = 'warning';
|
||||
$status = 'unknown';
|
||||
}
|
||||
};
|
||||
if (defined($message)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user