parent
f2438e7296
commit
8225df9be9
|
@ -48,8 +48,10 @@ sub check {
|
|||
} else {
|
||||
$oid_nvramBatteryStatus = '.1.3.6.1.4.1.19746.1.2.3.1.1.2';
|
||||
$oid_nvramBatteryCharge = '.1.3.6.1.4.1.19746.1.2.3.1.1.3';
|
||||
%map_battery_status = (1 => 'ok', 2 => 'disabled', 3 => 'discharged', 4 => 'unknown',
|
||||
5 => 'softdisabled');
|
||||
%map_battery_status = (
|
||||
1 => 'ok', 2 => 'disabled', 3 => 'discharged', 4 => 'unknown',
|
||||
5 => 'softdisabled'
|
||||
);
|
||||
}
|
||||
|
||||
foreach my $oid (keys %{$self->{results}->{$oid_nvramBatteryEntry}}) {
|
||||
|
@ -62,22 +64,30 @@ sub check {
|
|||
next if ($self->check_filter(section => 'battery', instance => $instance));
|
||||
next if ($batt_status =~ /disabled/i &&
|
||||
$self->absent_problem(section => 'battery', instance => $instance));
|
||||
|
||||
|
||||
$self->{components}->{battery}->{total}++;
|
||||
$self->{output}->output_add(long_msg => sprintf("Nvram battery '%s' status is '%s'",
|
||||
$instance, $batt_status));
|
||||
$self->{output}->output_add(
|
||||
long_msg => sprintf(
|
||||
"Nvram battery '%s' status is '%s'",
|
||||
$instance, $batt_status
|
||||
)
|
||||
);
|
||||
my $exit = $self->get_severity(section => 'battery', value => $batt_status);
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Nvram battery '%s' status is '%s'", $instance, $batt_status));
|
||||
$self->{output}->output_add(
|
||||
severity => $exit,
|
||||
short_msg => sprintf("Nvram battery '%s' status is '%s'", $instance, $batt_status)
|
||||
);
|
||||
}
|
||||
|
||||
if (defined($batt_value) && $batt_value =~ /[0-9]/) {
|
||||
my ($exit, $warn, $crit) = $self->get_severity_numeric(section => 'battery', instance => $instance, value => $batt_value);
|
||||
$self->{output}->output_add(long_msg => sprintf("Nvram battery '%s' charge is %s %%", $instance, $batt_value));
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Nvram battery '%s' charge is %s %%", $instance, $batt_value));
|
||||
$self->{output}->output_add(
|
||||
severity => $exit,
|
||||
short_msg => sprintf("Nvram battery '%s' charge is %s %%", $instance, $batt_value)
|
||||
);
|
||||
}
|
||||
$self->{output}->perfdata_add(
|
||||
label => 'nvram_battery', unit => '%',
|
||||
|
|
|
@ -35,12 +35,12 @@ my %map_disk_status = (
|
|||
6 => 'available', # since OS 5.4
|
||||
8 => 'raidReconstruction', # since OS 7.x
|
||||
9 => 'copyReconstruction', # since OS 7.x
|
||||
10 => 'system', # since OS 7.x
|
||||
10 => 'system' # since OS 7.x
|
||||
);
|
||||
|
||||
sub load {
|
||||
my ($self) = @_;
|
||||
|
||||
|
||||
if (centreon::plugins::misc::minimal_version($self->{os_version}, '5.x')) {
|
||||
$oid_diskPropState = '.1.3.6.1.4.1.19746.1.6.1.1.1.8';
|
||||
} else {
|
||||
|
@ -53,26 +53,32 @@ sub check {
|
|||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking disks");
|
||||
$self->{components}->{disk} = {name => 'disks', total => 0, skip => 0};
|
||||
$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_diskPropState}})) {
|
||||
$oid =~ /^$oid_diskPropState\.(.*)$/;
|
||||
my $instance = $1;
|
||||
my $disk_status = defined($map_disk_status{$self->{results}->{$oid_diskPropState}->{$oid}}) ?
|
||||
$map_disk_status{$self->{results}->{$oid_diskPropState}->{$oid}} : 'unknown';
|
||||
$map_disk_status{$self->{results}->{$oid_diskPropState}->{$oid}} : 'unknown';
|
||||
|
||||
next if ($self->check_filter(section => 'disk', instance => $instance));
|
||||
next if ($disk_status =~ /absent/i &&
|
||||
$self->absent_problem(section => 'disk', instance => $instance));
|
||||
|
||||
$self->{components}->{disk}->{total}++;
|
||||
$self->{output}->output_add(long_msg => sprintf("Disk '%s' status is '%s'",
|
||||
$instance, $disk_status));
|
||||
$self->{output}->output_add(
|
||||
long_msg => sprintf(
|
||||
"Disk '%s' status is '%s'",
|
||||
$instance, $disk_status
|
||||
)
|
||||
);
|
||||
my $exit = $self->get_severity(section => 'disk', value => $disk_status);
|
||||
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'", $instance, $disk_status));
|
||||
$self->{output}->output_add(
|
||||
severity => $exit,
|
||||
short_msg => sprintf("Disk '%s' status is '%s'", $instance, $disk_status)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,13 +27,13 @@ use centreon::plugins::misc;
|
|||
my %map_fan_status = (
|
||||
0 => 'notfound',
|
||||
1 => 'ok',
|
||||
2 => 'failed',
|
||||
2 => 'failed'
|
||||
);
|
||||
my %level_map = (
|
||||
0 => 'unknown',
|
||||
1 => 'low',
|
||||
2 => 'normal',
|
||||
3 => 'high',
|
||||
3 => 'high'
|
||||
);
|
||||
|
||||
my ($oid_fanDescription, $oid_fanLevel, $oid_fanStatus);
|
||||
|
@ -51,7 +51,7 @@ sub check {
|
|||
$self->{output}->output_add(long_msg => "Checking fans");
|
||||
$self->{components}->{fan} = {name => 'fans', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'fan'));
|
||||
|
||||
|
||||
if (centreon::plugins::misc::minimal_version($self->{os_version}, '5.x')) {
|
||||
$oid_fanDescription = '.1.3.6.1.4.1.19746.1.1.3.1.1.1.4';
|
||||
$oid_fanLevel = '.1.3.6.1.4.1.19746.1.1.3.1.1.1.5';
|
||||
|
@ -67,22 +67,28 @@ sub check {
|
|||
my $instance = $1;
|
||||
my $fan_descr = centreon::plugins::misc::trim($self->{results}->{$oid_fanPropertiesEntry}->{$oid_fanDescription . '.' . $instance});
|
||||
my $fan_status = defined($map_fan_status{$self->{results}->{$oid_fanPropertiesEntry}->{$oid}}) ?
|
||||
$map_fan_status{$self->{results}->{$oid_fanPropertiesEntry}->{$oid}} : 'unknown';
|
||||
$map_fan_status{$self->{results}->{$oid_fanPropertiesEntry}->{$oid}} : 'unknown';
|
||||
my $fan_level = $self->{results}->{$oid_fanPropertiesEntry}->{$oid_fanLevel . '.' . $instance};
|
||||
|
||||
next if ($self->check_filter(section => 'fan', instance => $instance));
|
||||
next if ($fan_status =~ /notfound/i &&
|
||||
$self->absent_problem(section => 'fan', instance => $instance));
|
||||
|
||||
|
||||
$self->{components}->{fan}->{total}++;
|
||||
$self->{output}->output_add(long_msg => sprintf("Fan '%s' status is '%s' [instance = %s, level = %s]",
|
||||
$fan_descr, $fan_status, $instance, $level_map{$fan_level}));
|
||||
$self->{output}->output_add(
|
||||
long_msg => sprintf(
|
||||
"Fan '%s' status is '%s' [instance = %s, level = %s]",
|
||||
$fan_descr, $fan_status, $instance, $level_map{$fan_level}
|
||||
)
|
||||
);
|
||||
my $exit = $self->get_severity(section => 'fan', value => $fan_status);
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Fan '%s' status is '%s'", $fan_descr, $fan_status));
|
||||
$self->{output}->output_add(
|
||||
severity => $exit,
|
||||
short_msg => sprintf("Fan '%s' status is '%s'", $fan_descr, $fan_status)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
1;
|
||||
|
|
|
@ -39,12 +39,14 @@ sub check {
|
|||
$self->{output}->output_add(long_msg => "Checking power supplies");
|
||||
$self->{components}->{psu} = {name => 'psus', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'psu'));
|
||||
|
||||
|
||||
if (centreon::plugins::misc::minimal_version($self->{os_version}, '5.x')) {
|
||||
$oid_powerModuleDescription = '.1.3.6.1.4.1.19746.1.1.1.1.1.1.3';
|
||||
$oid_powerModuleStatus = '.1.3.6.1.4.1.19746.1.1.1.1.1.1.4';
|
||||
%map_psu_status = (0 => 'absent', 1 => 'ok', 2 => 'failed', 3 => 'faulty', 4 => 'acnone',
|
||||
99 => 'unknown');
|
||||
%map_psu_status = (
|
||||
0 => 'absent', 1 => 'ok', 2 => 'failed', 3 => 'faulty', 4 => 'acnone',
|
||||
99 => 'unknown'
|
||||
);
|
||||
} else {
|
||||
$oid_powerModuleDescription = ''; # none
|
||||
$oid_powerModuleStatus = '.1.3.6.1.4.1.19746.1.1.1.1.1.1.4';
|
||||
|
@ -55,23 +57,29 @@ sub check {
|
|||
next if ($oid !~ /^$oid_powerModuleStatus\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $psu_descr = defined($self->{results}->{$oid_powerModuleEntry}->{$oid_powerModuleDescription . '.' . $instance}) ?
|
||||
centreon::plugins::misc::trim($self->{results}->{$oid_powerModuleEntry}->{$oid_powerModuleDescription . '.' . $instance}) : 'unknown';
|
||||
centreon::plugins::misc::trim($self->{results}->{$oid_powerModuleEntry}->{$oid_powerModuleDescription . '.' . $instance}) : 'unknown';
|
||||
my $psu_status = defined($map_psu_status{$self->{results}->{$oid_powerModuleEntry}->{$oid}}) ?
|
||||
$map_psu_status{$self->{results}->{$oid_powerModuleEntry}->{$oid}} : 'unknown';
|
||||
$map_psu_status{$self->{results}->{$oid_powerModuleEntry}->{$oid}} : 'unknown';
|
||||
|
||||
next if ($self->check_filter(section => 'psu', instance => $instance));
|
||||
next if ($psu_status =~ /absent/i &&
|
||||
$self->absent_problem(section => 'psu', instance => $instance));
|
||||
|
||||
|
||||
$self->{components}->{psu}->{total}++;
|
||||
$self->{output}->output_add(long_msg => sprintf("Power Supply '%s' status is '%s' [description = %s]",
|
||||
$instance, $psu_status, $instance));
|
||||
$self->{output}->output_add(
|
||||
long_msg => sprintf(
|
||||
"Power Supply '%s' status is '%s' [description = %s]",
|
||||
$instance, $psu_status, $instance
|
||||
)
|
||||
);
|
||||
my $exit = $self->get_severity(section => 'psu', value => $psu_status);
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Power Supply '%s' status is '%s'", $instance, $psu_status));
|
||||
$self->{output}->output_add(
|
||||
severity => $exit,
|
||||
short_msg => sprintf("Power Supply '%s' status is '%s'", $instance, $psu_status)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
1;
|
||||
|
|
|
@ -45,8 +45,10 @@ sub check {
|
|||
$oid_tempSensorDescription = '.1.3.6.1.4.1.19746.1.1.2.1.1.1.4';
|
||||
$oid_tempSensorCurrentValue = '.1.3.6.1.4.1.19746.1.1.2.1.1.1.5';
|
||||
$oid_tempSensorStatus = '.1.3.6.1.4.1.19746.1.1.2.1.1.1.6';
|
||||
%map_temp_status = (0 => 'failed', 1 => 'ok', 2 => 'notfound', 3 => 'overheatWarning',
|
||||
4 => 'overheatCritical');
|
||||
%map_temp_status = (
|
||||
0 => 'failed', 1 => 'ok', 2 => 'notfound', 3 => 'overheatWarning',
|
||||
4 => 'overheatCritical'
|
||||
);
|
||||
} else {
|
||||
$oid_tempSensorDescription = '.1.3.6.1.4.1.19746.1.1.2.1.1.1.3';
|
||||
$oid_tempSensorCurrentValue = '.1.3.6.1.4.1.19746.1.1.2.1.1.1.4';
|
||||
|
@ -58,30 +60,38 @@ sub check {
|
|||
next if ($oid !~ /^$oid_tempSensorStatus\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $temp_descr = defined($self->{results}->{$oid_temperatureSensorEntry}->{$oid_tempSensorDescription . '.' . $instance}) ?
|
||||
centreon::plugins::misc::trim($self->{results}->{$oid_temperatureSensorEntry}->{$oid_tempSensorDescription . '.' . $instance}) : 'unknown';
|
||||
centreon::plugins::misc::trim($self->{results}->{$oid_temperatureSensorEntry}->{$oid_tempSensorDescription . '.' . $instance}) : 'unknown';
|
||||
my $temp_status = defined($map_temp_status{$self->{results}->{$oid_temperatureSensorEntry}->{$oid}}) ?
|
||||
$map_temp_status{$self->{results}->{$oid_temperatureSensorEntry}->{$oid}} : 'unknown';
|
||||
$map_temp_status{$self->{results}->{$oid_temperatureSensorEntry}->{$oid}} : 'unknown';
|
||||
my $temp_value = $self->{results}->{$oid_temperatureSensorEntry}->{$oid_tempSensorCurrentValue . '.' . $instance};
|
||||
|
||||
next if ($self->check_filter(section => 'temperature', instance => $instance));
|
||||
next if ($temp_status =~ /absent|notfound/i &&
|
||||
$self->absent_problem(section => 'temperature', instance => $instance));
|
||||
|
||||
|
||||
$self->{components}->{temperature}->{total}++;
|
||||
$self->{output}->output_add(long_msg => sprintf("Temperature '%s' status is '%s' [instance = %s]",
|
||||
$temp_descr, $temp_status, $instance));
|
||||
$self->{output}->output_add(
|
||||
long_msg => sprintf(
|
||||
"Temperature '%s' status is '%s' [instance = %s]",
|
||||
$temp_descr, $temp_status, $instance
|
||||
)
|
||||
);
|
||||
my $exit = $self->get_severity(section => 'temperature', value => $temp_status);
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Temperature '%s' status is '%s'", $temp_descr, $temp_status));
|
||||
$self->{output}->output_add(
|
||||
severity => $exit,
|
||||
short_msg => sprintf("Temperature '%s' status is '%s'", $temp_descr, $temp_status)
|
||||
);
|
||||
}
|
||||
|
||||
if (defined($temp_value) && $temp_value =~ /[0-9]/) {
|
||||
my ($exit, $warn, $crit) = $self->get_severity_numeric(section => 'temperature', instance => $instance, value => $temp_value);
|
||||
$self->{output}->output_add(long_msg => sprintf("Temperature '%s' is %s degree centigrade", $temp_descr, $temp_value));
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Temperature '%s' is %s degree centigrade", $temp_descr, $temp_value));
|
||||
$self->{output}->output_add(
|
||||
severity => $exit,
|
||||
short_msg => sprintf("Temperature '%s' is %s degree centigrade", $temp_descr, $temp_value)
|
||||
);
|
||||
}
|
||||
$self->{output}->perfdata_add(
|
||||
label => 'temp', unit => 'C',
|
||||
|
@ -89,7 +99,7 @@ sub check {
|
|||
instances => $instance,
|
||||
value => $temp_value,
|
||||
warning => $warn,
|
||||
critical => $crit,
|
||||
critical => $crit
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,35 +26,6 @@ use strict;
|
|||
use warnings;
|
||||
use storage::emc::DataDomain::lib::functions;
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'fs', type => 1, cb_prefix_output => 'prefix_fs_output', message_multiple => 'All filesystems are ok.' },
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{fs} = [
|
||||
{ label => 'usage', set => {
|
||||
key_values => [ { name => 'free' }, { name => 'used' }, { name => 'display' } ],
|
||||
closure_custom_calc => $self->can('custom_used_calc'),
|
||||
closure_custom_output => $self->can('custom_used_output'),
|
||||
threshold_use => 'used_prct', output_error_template => '%s',
|
||||
perfdatas => [
|
||||
{ value => 'used', label => 'used', cast_int => 1,
|
||||
unit => 'B', min => 0, max => 'total', threshold_total => 'total',
|
||||
label_extra_instance => 1, instance_use => 'display' }
|
||||
]
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
sub prefix_fs_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Filesystem '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
sub custom_used_calc {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
|
@ -82,6 +53,35 @@ sub custom_used_output {
|
|||
);
|
||||
}
|
||||
|
||||
sub prefix_fs_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Filesystem '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'fs', type => 1, cb_prefix_output => 'prefix_fs_output', message_multiple => 'All filesystems are ok.' }
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{fs} = [
|
||||
{ label => 'usage', set => {
|
||||
key_values => [ { name => 'free' }, { name => 'used' }, { name => 'display' } ],
|
||||
closure_custom_calc => $self->can('custom_used_calc'),
|
||||
closure_custom_output => $self->can('custom_used_output'),
|
||||
threshold_use => 'used_prct', output_error_template => '%s',
|
||||
perfdatas => [
|
||||
{ value => 'used', label => 'used', cast_int => 1,
|
||||
unit => 'B', min => 0, max => 'total', threshold_total => 'total',
|
||||
label_extra_instance => 1, instance_use => 'display' }
|
||||
]
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
|
@ -98,29 +98,26 @@ sub new {
|
|||
}
|
||||
|
||||
my $oid_fileSystemSpaceEntry = '.1.3.6.1.4.1.19746.1.3.2.1.1';
|
||||
my $oid_sysDescr = '.1.3.6.1.2.1.1.1'; # 'Data Domain OS 5.4.1.1-411752'
|
||||
my $oid_sysDescr = '.1.3.6.1.2.1.1.1.0'; # 'Data Domain OS 5.4.1.1-411752'
|
||||
my ($oid_fileSystemResourceName, $oid_fileSystemSpaceUsed, $oid_fileSystemSpaceAvail);
|
||||
|
||||
sub add_result {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{fs}->{$options{instance}} = {};
|
||||
$self->{fs}->{$options{instance}}->{display} = $self->{results}->{$oid_fileSystemSpaceEntry}->{$oid_fileSystemResourceName . '.' . $options{instance}};
|
||||
$self->{fs}->{$options{instance}}->{free} = int($self->{results}->{$oid_fileSystemSpaceEntry}->{$oid_fileSystemSpaceAvail . '.' . $options{instance}} * 1024 * 1024 * 1024);
|
||||
$self->{fs}->{$options{instance}}->{used} = int($self->{results}->{$oid_fileSystemSpaceEntry}->{$oid_fileSystemSpaceUsed . '.' . $options{instance}} * 1024 * 1024 * 1024);
|
||||
$self->{fs}->{ $options{instance} } = {};
|
||||
$self->{fs}->{ $options{instance} }->{display} = $options{snmp_result}->{$oid_fileSystemResourceName . '.' . $options{instance}};
|
||||
$self->{fs}->{ $options{instance} }->{free} = int($options{snmp_result}->{$oid_fileSystemSpaceAvail . '.' . $options{instance}} * 1024 * 1024 * 1024);
|
||||
$self->{fs}->{ $options{instance} }->{used} = int($options{snmp_result}->{$oid_fileSystemSpaceUsed . '.' . $options{instance}} * 1024 * 1024 * 1024);
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{results} = $options{snmp}->get_multiple_table(
|
||||
oids => [
|
||||
{ oid => $oid_sysDescr },
|
||||
{ oid => $oid_fileSystemSpaceEntry },
|
||||
],
|
||||
my $snmp_result = $options{snmp}->get_leef(
|
||||
oids => [ $oid_sysDescr ],
|
||||
nothing_quit => 1
|
||||
);
|
||||
if (!($self->{os_version} = storage::emc::DataDomain::lib::functions::get_version(value => $self->{results}->{$oid_sysDescr}->{$oid_sysDescr . '.0'}))) {
|
||||
if (!($self->{os_version} = storage::emc::DataDomain::lib::functions::get_version(value => $snmp_result->{$oid_sysDescr}))) {
|
||||
$self->{output}->output_add(
|
||||
severity => 'UNKNOWN',
|
||||
short_msg => 'Cannot get DataDomain OS version.'
|
||||
|
@ -128,6 +125,12 @@ sub manage_selection {
|
|||
$self->{output}->display();
|
||||
$self->{output}->exit();
|
||||
}
|
||||
|
||||
$snmp_result = $options{snmp}->get_table(
|
||||
oid => $oid_fileSystemSpaceEntry,
|
||||
nothing_quit => 1
|
||||
);
|
||||
|
||||
if (centreon::plugins::misc::minimal_version($self->{os_version}, '5.x')) {
|
||||
$oid_fileSystemResourceName = '.1.3.6.1.4.1.19746.1.3.2.1.1.3';
|
||||
$oid_fileSystemSpaceUsed = '.1.3.6.1.4.1.19746.1.3.2.1.1.5';
|
||||
|
@ -139,28 +142,28 @@ sub manage_selection {
|
|||
}
|
||||
|
||||
if (!defined($self->{option_results}->{use_name}) && defined($self->{option_results}->{filesystem})) {
|
||||
if (!defined($self->{results}->{$oid_fileSystemSpaceEntry}->{$oid_fileSystemResourceName . '.' . $self->{option_results}->{filesystem}})) {
|
||||
if (!defined($snmp_result->{$oid_fileSystemResourceName . '.' . $self->{option_results}->{filesystem}})) {
|
||||
$self->{output}->add_option_msg(short_msg => "No filesystem found for id '" . $self->{option_results}->{filesystem} . "'.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
$self->add_result(instance => $self->{option_results}->{filesystem});
|
||||
$self->add_result(instance => $self->{option_results}->{filesystem}, snmp_result => $snmp_result);
|
||||
} else {
|
||||
foreach my $oid (keys %{$self->{results}->{$oid_fileSystemSpaceEntry}}) {
|
||||
foreach my $oid (keys %$snmp_result) {
|
||||
next if ($oid !~ /^$oid_fileSystemResourceName\.(\d+)$/);
|
||||
my $instance = $1;
|
||||
my $filter_name = $self->{results}->{$oid_fileSystemSpaceEntry}->{$oid_fileSystemResourceName . '.' . $instance};
|
||||
my $filter_name = $snmp_result->{$oid_fileSystemResourceName . '.' . $instance};
|
||||
if (!defined($self->{option_results}->{filesystem})) {
|
||||
$self->add_result(instance => $instance);
|
||||
$self->add_result(instance => $instance, snmp_result => $snmp_result);
|
||||
next;
|
||||
}
|
||||
if (defined($self->{option_results}->{use_regexp}) && defined($self->{option_results}->{use_regexpi}) && $filter_name =~ /$self->{option_results}->{filesystem}/i) {
|
||||
$self->add_result(instance => $instance);
|
||||
$self->add_result(instance => $instance, snmp_result => $snmp_result);
|
||||
}
|
||||
if (defined($self->{option_results}->{use_regexp}) && !defined($self->{option_results}->{use_regexpi}) && $filter_name =~ /$self->{option_results}->{filesystem}/) {
|
||||
$self->add_result(instance => $instance);
|
||||
$self->add_result(instance => $instance, snmp_result => $snmp_result);
|
||||
}
|
||||
if (!defined($self->{option_results}->{use_regexp}) && !defined($self->{option_results}->{use_regexpi}) && $filter_name eq $self->{option_results}->{filesystem}) {
|
||||
$self->add_result(instance => $instance);
|
||||
$self->add_result(instance => $instance, snmp_result => $snmp_result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -184,8 +187,7 @@ sub disco_format {
|
|||
sub disco_show {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{snmp} = $options{snmp};
|
||||
$self->manage_selection(disco => 1);
|
||||
$self->manage_selection(disco => 1, snmp => $options{snmp});
|
||||
foreach (sort keys %{$self->{fs}}) {
|
||||
$self->{output}->add_disco_entry(
|
||||
name => $self->{fs}->{$_}->{display},
|
||||
|
|
|
@ -33,12 +33,12 @@ sub set_system {
|
|||
|
||||
$self->{cb_hook1} = 'get_version'; # before the loads
|
||||
$self->{cb_hook2} = 'snmp_execute';
|
||||
|
||||
|
||||
$self->{thresholds} = {
|
||||
fan => [
|
||||
['notfound', 'OK'],
|
||||
['ok', 'OK'],
|
||||
['failed', 'CRITICAL'],
|
||||
['failed', 'CRITICAL']
|
||||
],
|
||||
temperature => [
|
||||
['failed', 'CRITICAL'],
|
||||
|
@ -46,7 +46,7 @@ sub set_system {
|
|||
['notfound', 'OK'],
|
||||
['absent', 'OK'],
|
||||
['overheatWarning', 'WARNING'],
|
||||
['overheatCritical', 'CRITICAL'],
|
||||
['overheatCritical', 'CRITICAL']
|
||||
],
|
||||
psu => [
|
||||
['absent', 'OK'],
|
||||
|
@ -54,7 +54,7 @@ sub set_system {
|
|||
['failed', 'CRITICAL'],
|
||||
['faulty', 'WARNING'],
|
||||
['acnone', 'WARNING'],
|
||||
['unknown', 'UNKNOWN'],
|
||||
['unknown', 'UNKNOWN']
|
||||
],
|
||||
disk => [
|
||||
['ok', 'OK'],
|
||||
|
@ -62,17 +62,17 @@ sub set_system {
|
|||
['available', 'OK'],
|
||||
['unknown', 'UNKNOWN'],
|
||||
['absent', 'OK'],
|
||||
['failed', 'CRITICAL'],
|
||||
['failed', 'CRITICAL']
|
||||
],
|
||||
battery => [
|
||||
['ok', 'OK'],
|
||||
['disabled', 'OK'],
|
||||
['discharged', 'WARNING'],
|
||||
['softdisabled', 'OK'],
|
||||
['UNKNOWN', 'UNKNOWN'],
|
||||
],
|
||||
['UNKNOWN', 'UNKNOWN']
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
$self->{components_path} = 'storage::emc::DataDomain::mode::components';
|
||||
$self->{components_module} = ['fan', 'temperature', 'psu', 'disk', 'battery'];
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ sub new {
|
|||
|
||||
sub get_version {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
|
||||
my $oid_sysDescr = '.1.3.6.1.2.1.1.1.0'; # 'Data Domain OS 5.4.1.1-411752'
|
||||
my $result = $options{snmp}->get_leef(oids => [ $oid_sysDescr ]);
|
||||
if (!($self->{os_version} = storage::emc::DataDomain::lib::functions::get_version(value => $result->{$oid_sysDescr}))) {
|
||||
|
@ -107,7 +107,7 @@ sub get_version {
|
|||
$self->{output}->display();
|
||||
$self->{output}->exit();
|
||||
}
|
||||
|
||||
|
||||
$self->{output}->output_add(long_msg => 'DataDomain OS version: ' . $self->{os_version} . '.');
|
||||
}
|
||||
|
||||
|
|
|
@ -24,14 +24,13 @@ use base qw(centreon::plugins::templates::counter);
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);
|
||||
use storage::emc::DataDomain::lib::functions;
|
||||
|
||||
sub custom_status_calc {
|
||||
sub prefix_repl_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{result_values}->{state} = $options{new_datas}->{$self->{instance} . '_state'};
|
||||
return 0;
|
||||
return "Replication '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
|
@ -42,13 +41,17 @@ sub set_counters {
|
|||
];
|
||||
|
||||
$self->{maps_counters}->{repl} = [
|
||||
{ label => 'status', threshold => 0, set => {
|
||||
{
|
||||
label => 'status',
|
||||
type => 2,
|
||||
warning_default => '%{state} =~ /initializing|recovering/i',
|
||||
critical_default => '%{state} =~ /disabledNeedsResync|uninitialized/i',
|
||||
set => {
|
||||
key_values => [ { name => 'state' } ],
|
||||
output_template => "status is '%s'",
|
||||
output_use => 'state',
|
||||
closure_custom_calc => $self->can('custom_status_calc'),
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => \&catalog_status_threshold
|
||||
closure_custom_threshold_check => \&catalog_status_threshold_ng
|
||||
}
|
||||
},
|
||||
{ label => 'offset', set => {
|
||||
|
@ -63,48 +66,29 @@ sub set_counters {
|
|||
];
|
||||
}
|
||||
|
||||
sub prefix_repl_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Replication '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
'unknown-status:s' => { name => 'unknown_status', default => '' },
|
||||
'warning-status:s' => { name => 'warning_status', default => '%{state} =~ /initializing|recovering/i' },
|
||||
'critical-status:s' => { name => 'critical_status', default => '%{state} =~ /disabledNeedsResync|uninitialized/i' }
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
$self->change_macros(macros => ['warning_status', 'critical_status', 'unknown_status']);
|
||||
}
|
||||
|
||||
my $oid_sysDescr = '.1.3.6.1.2.1.1.1'; # 'Data Domain OS 5.4.1.1-411752'
|
||||
my $oid_replicationInfoEntry = '.1.3.6.1.4.1.19746.1.8.1.1.1';
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $snmp_result = $options{snmp}->get_multiple_table(
|
||||
oids => [
|
||||
{ oid => $oid_sysDescr },
|
||||
{ oid => $oid_replicationInfoEntry }
|
||||
],
|
||||
my $oid_sysDescr = '.1.3.6.1.2.1.1.1.0'; # 'Data Domain OS 5.4.1.1-411752'
|
||||
my $oid_replicationInfoEntry = '.1.3.6.1.4.1.19746.1.8.1.1.1';
|
||||
|
||||
my $snmp_result = $options{snmp}->get_leef(
|
||||
oids => [ $oid_sysDescr ],
|
||||
nothing_quit => 1
|
||||
);
|
||||
|
||||
if (!($self->{os_version} = storage::emc::DataDomain::lib::functions::get_version(value => $snmp_result->{$oid_sysDescr}->{$oid_sysDescr . '.0'}))) {
|
||||
if (!($self->{os_version} = storage::emc::DataDomain::lib::functions::get_version(value => $snmp_result->{$oid_sysDescr}))) {
|
||||
$self->{output}->output_add(
|
||||
severity => 'UNKNOWN',
|
||||
short_msg => 'Cannot get DataDomain OS version.'
|
||||
|
@ -113,10 +97,10 @@ sub manage_selection {
|
|||
$self->{output}->exit();
|
||||
}
|
||||
|
||||
if (scalar(keys %{$snmp_result->{$oid_replicationInfoEntry}}) <= 0) {
|
||||
$self->{output}->add_option_msg(short_msg => 'no replication informations');
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
$snmp_result = $options{snmp}->get_table(
|
||||
oid => $oid_replicationInfoEntry,
|
||||
nothing_quit => 1
|
||||
);
|
||||
|
||||
my ($oid_replSource, $oid_replDestination, $oid_replState);
|
||||
my %map_state = (
|
||||
|
@ -147,10 +131,10 @@ sub manage_selection {
|
|||
};
|
||||
|
||||
$self->{repl} = {};
|
||||
foreach my $oid (keys %{$snmp_result->{$oid_replicationInfoEntry}}) {
|
||||
foreach my $oid (keys %$snmp_result) {
|
||||
next if ($oid !~ /^$mapping->{replState}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result->{$oid_replicationInfoEntry}, instance => $instance);
|
||||
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => $instance);
|
||||
$self->{repl}->{$instance} = {
|
||||
display => $result->{replSource} . '/' . $result->{replDestination},
|
||||
state => $result->{replState},
|
||||
|
|
|
@ -30,11 +30,11 @@ sub new {
|
|||
bless $self, $class;
|
||||
|
||||
$self->{version} = '1.0';
|
||||
%{$self->{modes}} = (
|
||||
$self->{modes} = {
|
||||
'hardware' => 'storage::emc::DataDomain::mode::hardware',
|
||||
'filesystem-usage' => 'storage::emc::DataDomain::mode::filesystem',
|
||||
'replication' => 'storage::emc::DataDomain::mode::replication',
|
||||
);
|
||||
'replication' => 'storage::emc::DataDomain::mode::replication'
|
||||
};
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue