fix(buffalo/terastation/snmp): hardware mode - wrong component path (#2726)
This commit is contained in:
parent
e2ec119a86
commit
02920a86ab
|
@ -32,11 +32,12 @@ sub custom_usage_output {
|
||||||
my ($total_used_value, $total_used_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{used});
|
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 ($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%%)",
|
return sprintf(
|
||||||
$total_size_value . " " . $total_size_unit,
|
"Total: %s Used: %s (%.2f%%) Free: %s (%.2f%%)",
|
||||||
$total_used_value . " " . $total_used_unit, $self->{result_values}->{prct_used},
|
$total_size_value . " " . $total_size_unit,
|
||||||
$total_free_value . " " . $total_free_unit, $self->{result_values}->{prct_free});
|
$total_used_value . " " . $total_used_unit, $self->{result_values}->{prct_used},
|
||||||
return $msg;
|
$total_free_value . " " . $total_free_unit, $self->{result_values}->{prct_free}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub custom_usage_calc {
|
sub custom_usage_calc {
|
||||||
|
@ -67,10 +68,10 @@ sub set_counters {
|
||||||
threshold_use => 'prct_used',
|
threshold_use => 'prct_used',
|
||||||
perfdatas => [
|
perfdatas => [
|
||||||
{ label => 'used', value => 'used', template => '%s',
|
{ label => 'used', value => 'used', template => '%s',
|
||||||
unit => 'B', min => 0, max => 'total', cast_int => 1 },
|
unit => 'B', min => 0, max => 'total', cast_int => 1 }
|
||||||
],
|
]
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +81,7 @@ sub new {
|
||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
|
|
||||||
$options{options}->add_options(arguments => {
|
$options{options}->add_options(arguments => {
|
||||||
"filter-name:s" => { name => 'filter_name' },
|
'filter-name:s' => { name => 'filter_name' }
|
||||||
});
|
});
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
|
@ -94,7 +95,7 @@ sub prefix_array_output {
|
||||||
|
|
||||||
my $mapping = {
|
my $mapping = {
|
||||||
nasArrayCapacity => { oid => '.1.3.6.1.4.1.5227.27.1.3.1.3' }, # in GB
|
nasArrayCapacity => { oid => '.1.3.6.1.4.1.5227.27.1.3.1.3' }, # in GB
|
||||||
nasArrayUsed => { oid => '.1.3.6.1.4.1.5227.27.1.3.1.4' }, # in %
|
nasArrayUsed => { oid => '.1.3.6.1.4.1.5227.27.1.3.1.4' } # in %
|
||||||
};
|
};
|
||||||
|
|
||||||
sub manage_selection {
|
sub manage_selection {
|
||||||
|
@ -113,7 +114,7 @@ sub manage_selection {
|
||||||
next if ($oid !~ /^$mapping->{nasArrayCapacity}->{oid}\.(.*)/);
|
next if ($oid !~ /^$mapping->{nasArrayCapacity}->{oid}\.(.*)/);
|
||||||
my $instance = $1;
|
my $instance = $1;
|
||||||
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => $instance);
|
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => $instance);
|
||||||
|
|
||||||
if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
|
if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
|
||||||
$instance !~ /$self->{option_results}->{filter_name}/) {
|
$instance !~ /$self->{option_results}->{filter_name}/) {
|
||||||
$self->{output}->output_add(long_msg => "skipping '" . $instance . "': no matching array name.", debug => 1);
|
$self->{output}->output_add(long_msg => "skipping '" . $instance . "': no matching array name.", debug => 1);
|
||||||
|
|
|
@ -18,20 +18,20 @@
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
package storage::buffalo::terastation::snmp::::mode::components::disk;
|
package storage::buffalo::terastation::snmp::mode::components::disk;
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
|
||||||
my %map_disk_status = (
|
my %map_disk_status = (
|
||||||
1 => 'notSupport', 1 => 'normal', 2 => 'array1', 3 => 'array2',
|
-1 => 'notSupport', 1 => 'normal', 2 => 'array1', 3 => 'array2',
|
||||||
4 => 'standby', 5 => 'degrade', 6 => 'remove', 7 => 'standbyRemoved',
|
4 => 'standby', 5 => 'degrade', 6 => 'remove', 7 => 'standbyRemoved',
|
||||||
8 => 'degradeRemoved', 9 => 'removeRemoved', 10 => 'array3',
|
8 => 'degradeRemoved', 9 => 'removeRemoved', 10 => 'array3',
|
||||||
11 => 'array4', 12 => 'mediaCartridge', 13 => 'array5', 14 => 'array6',
|
11 => 'array4', 12 => 'mediaCartridge', 13 => 'array5', 14 => 'array6',
|
||||||
);
|
);
|
||||||
|
|
||||||
my $mapping = {
|
my $mapping = {
|
||||||
nasDiskStatus => { oid => '.1.3.6.1.4.1.5227.27.1.2.1.2', map => \%map_disk_status },
|
nasDiskStatus => { oid => '.1.3.6.1.4.1.5227.27.1.2.1.2', map => \%map_disk_status }
|
||||||
};
|
};
|
||||||
|
|
||||||
sub load {
|
sub load {
|
||||||
|
@ -55,14 +55,21 @@ sub check {
|
||||||
next if ($self->check_filter(section => 'disk', instance => $instance));
|
next if ($self->check_filter(section => 'disk', instance => $instance));
|
||||||
$self->{components}->{disk}->{total}++;
|
$self->{components}->{disk}->{total}++;
|
||||||
|
|
||||||
$self->{output}->output_add(long_msg => sprintf("disk '%s' status is '%s' [instance: %s].",
|
$self->{output}->output_add(
|
||||||
$instance, $result->{nasDiskStatus}, $instance
|
long_msg => sprintf(
|
||||||
));
|
"disk '%s' status is '%s' [instance: %s].",
|
||||||
|
$instance, $result->{nasDiskStatus}, $instance
|
||||||
|
)
|
||||||
|
);
|
||||||
my $exit = $self->get_severity(section => 'disk', value => $result->{nasDiskStatus});
|
my $exit = $self->get_severity(section => 'disk', value => $result->{nasDiskStatus});
|
||||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
$self->{output}->output_add(severity => $exit,
|
$self->{output}->output_add(
|
||||||
short_msg => sprintf("Disk '%s' status is '%s'",
|
severity => $exit,
|
||||||
$instance, $result->{nasDiskStatus}));
|
short_msg => sprintf(
|
||||||
|
"Disk '%s' status is '%s'",
|
||||||
|
$instance, $result->{nasDiskStatus}
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
package storage::buffalo::terastation::snmp::::mode::components::iscsi;
|
package storage::buffalo::terastation::snmp::mode::components::iscsi;
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
@ -29,7 +29,7 @@ my %map_iscsi_status = (
|
||||||
|
|
||||||
my $mapping = {
|
my $mapping = {
|
||||||
nasISCSIName => { oid => '.1.3.6.1.4.1.5227.27.1.9.1.2' },
|
nasISCSIName => { oid => '.1.3.6.1.4.1.5227.27.1.9.1.2' },
|
||||||
nasISCSIStatus => { oid => '.1.3.6.1.4.1.5227.27.1.9.1.3', map => \%map_iscsi_status },
|
nasISCSIStatus => { oid => '.1.3.6.1.4.1.5227.27.1.9.1.3', map => \%map_iscsi_status }
|
||||||
};
|
};
|
||||||
my $nasISCSIEntry = '.1.3.6.1.4.1.5227.27.1.9.1';
|
my $nasISCSIEntry = '.1.3.6.1.4.1.5227.27.1.9.1';
|
||||||
|
|
||||||
|
@ -54,14 +54,21 @@ sub check {
|
||||||
next if ($self->check_filter(section => 'iscsi', instance => $instance, name => $result->{nasISCSIName}));
|
next if ($self->check_filter(section => 'iscsi', instance => $instance, name => $result->{nasISCSIName}));
|
||||||
$self->{components}->{iscsi}->{total}++;
|
$self->{components}->{iscsi}->{total}++;
|
||||||
|
|
||||||
$self->{output}->output_add(long_msg => sprintf("iscsi '%s' status is '%s' [instance: %s].",
|
$self->{output}->output_add(
|
||||||
$result->{nasISCSIName}, $result->{nasISCSIStatus}, $instance
|
long_msg => sprintf(
|
||||||
));
|
"iscsi '%s' status is '%s' [instance: %s].",
|
||||||
|
$result->{nasISCSIName}, $result->{nasISCSIStatus}, $instance
|
||||||
|
)
|
||||||
|
);
|
||||||
my $exit = $self->get_severity(section => 'iscsi', value => $result->{nasISCSIStatus});
|
my $exit = $self->get_severity(section => 'iscsi', value => $result->{nasISCSIStatus});
|
||||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
$self->{output}->output_add(severity => $exit,
|
$self->{output}->output_add(
|
||||||
short_msg => sprintf("Iscsi '%s' status is '%s'",
|
severity => $exit,
|
||||||
$result->{nasISCSIName}, $result->{nasISCSIStatus}));
|
short_msg => sprintf(
|
||||||
|
"Iscsi '%s' status is '%s'",
|
||||||
|
$result->{nasISCSIName}, $result->{nasISCSIStatus}
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
package storage::buffalo::terastation::snmp::::mode::components::psu;
|
package storage::buffalo::terastation::snmp::mode::components::psu;
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
@ -28,18 +28,18 @@ my %map_psu_status = (
|
||||||
);
|
);
|
||||||
|
|
||||||
my $mapping = {
|
my $mapping = {
|
||||||
nasRPSUStatus => { oid => '.1.3.6.1.4.1.5227.27.1.8.1.2', map => \%map_psu_status },
|
nasRPSUStatus => { oid => '.1.3.6.1.4.1.5227.27.1.8.1.2', map => \%map_psu_status }
|
||||||
};
|
};
|
||||||
|
|
||||||
sub load {
|
sub load {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
|
||||||
push @{$self->{request}}, { oid => $mapping->{nasRPSUStatus}->{oid} };
|
push @{$self->{request}}, { oid => $mapping->{nasRPSUStatus}->{oid} };
|
||||||
}
|
}
|
||||||
|
|
||||||
sub check {
|
sub check {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
|
||||||
$self->{output}->output_add(long_msg => "Checking redundant power supplies");
|
$self->{output}->output_add(long_msg => "Checking redundant power supplies");
|
||||||
$self->{components}->{psu} = { name => 'psu', total => 0, skip => 0 };
|
$self->{components}->{psu} = { name => 'psu', total => 0, skip => 0 };
|
||||||
return if ($self->check_filter(section => 'psu'));
|
return if ($self->check_filter(section => 'psu'));
|
||||||
|
@ -52,14 +52,21 @@ sub check {
|
||||||
next if ($self->check_filter(section => 'psu', instance => $instance));
|
next if ($self->check_filter(section => 'psu', instance => $instance));
|
||||||
$self->{components}->{psu}->{total}++;
|
$self->{components}->{psu}->{total}++;
|
||||||
|
|
||||||
$self->{output}->output_add(long_msg => sprintf("redundant psu '%s' status is '%s' [instance: %s].",
|
$self->{output}->output_add(
|
||||||
$instance, $result->{nasRPSUStatus}, $instance
|
long_msg => sprintf(
|
||||||
));
|
"redundant psu '%s' status is '%s' [instance: %s].",
|
||||||
|
$instance, $result->{nasRPSUStatus}, $instance
|
||||||
|
)
|
||||||
|
);
|
||||||
my $exit = $self->get_severity(section => 'psu', value => $result->{nasRPSUStatus});
|
my $exit = $self->get_severity(section => 'psu', value => $result->{nasRPSUStatus});
|
||||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
$self->{output}->output_add(severity => $exit,
|
$self->{output}->output_add(
|
||||||
short_msg => sprintf("Redundant psu '%s' status is '%s'",
|
severity => $exit,
|
||||||
$instance, $result->{nasRPSUStatus}));
|
short_msg => sprintf(
|
||||||
|
"Redundant psu '%s' status is '%s'",
|
||||||
|
$instance, $result->{nasRPSUStatus}
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ sub set_system {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
$self->{cb_hook2} = 'snmp_execute';
|
$self->{cb_hook2} = 'snmp_execute';
|
||||||
|
|
||||||
$self->{thresholds} = {
|
$self->{thresholds} = {
|
||||||
disk => [
|
disk => [
|
||||||
['notSupport', 'WARNING'],
|
['notSupport', 'WARNING'],
|
||||||
|
@ -46,21 +46,21 @@ sub set_system {
|
||||||
['array4', 'OK'],
|
['array4', 'OK'],
|
||||||
['mediaCartridge', 'OK'],
|
['mediaCartridge', 'OK'],
|
||||||
['array5', 'OK'],
|
['array5', 'OK'],
|
||||||
['array6', 'OK'],
|
['array6', 'OK']
|
||||||
],
|
],
|
||||||
iscsi => [
|
iscsi => [
|
||||||
['unknown', 'WARNING'],
|
['unknown', 'WARNING'],
|
||||||
['connected', 'OK'],
|
['connected', 'OK'],
|
||||||
['standing-by', 'OK'],
|
['standing-by', 'OK']
|
||||||
],
|
],
|
||||||
psu => [
|
psu => [
|
||||||
['unknown', 'WARNING'],
|
['unknown', 'WARNING'],
|
||||||
['fine', 'OK'],
|
['fine', 'OK'],
|
||||||
['broken', 'CRITICAL'],
|
['broken', 'CRITICAL']
|
||||||
],
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
$self->{components_path} = 'storage::buffalo::terastation::snmp::::mode::components';
|
$self->{components_path} = 'storage::buffalo::terastation::snmp::mode::components';
|
||||||
$self->{components_module} = ['disk', 'psu', 'iscsi'];
|
$self->{components_module} = ['disk', 'psu', 'iscsi'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,15 +30,15 @@ sub new {
|
||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
|
|
||||||
$self->{version} = '0.1';
|
$self->{version} = '0.1';
|
||||||
%{$self->{modes}} = (
|
$self->{modes} = {
|
||||||
'array-usage' => 'storage::buffalo::terastation::snmp::mode::arrayusage',
|
'array-usage' => 'storage::buffalo::terastation::snmp::mode::arrayusage',
|
||||||
'cpu-detailed' => 'snmp_standard::mode::cpudetailed',
|
'cpu-detailed' => 'snmp_standard::mode::cpudetailed',
|
||||||
'hardware' => 'storage::buffalo::terastation::snmp::mode::hardware',
|
'hardware' => 'storage::buffalo::terastation::snmp::mode::hardware',
|
||||||
'list-interfaces' => 'snmp_standard::mode::listinterfaces',
|
'list-interfaces' => 'snmp_standard::mode::listinterfaces',
|
||||||
'load' => 'snmp_standard::mode::loadaverage',
|
'load' => 'snmp_standard::mode::loadaverage',
|
||||||
'interfaces' => 'snmp_standard::mode::interfaces',
|
'interfaces' => 'snmp_standard::mode::interfaces',
|
||||||
'memory' => 'snmp_standard::mode::memory',
|
'memory' => 'snmp_standard::mode::memory'
|
||||||
);
|
};
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue