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_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;
|
||||
return 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}
|
||||
);
|
||||
}
|
||||
|
||||
sub custom_usage_calc {
|
||||
|
@ -67,10 +68,10 @@ sub set_counters {
|
|||
threshold_use => 'prct_used',
|
||||
perfdatas => [
|
||||
{ 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;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
"filter-name:s" => { name => 'filter_name' },
|
||||
'filter-name:s' => { name => 'filter_name' }
|
||||
});
|
||||
|
||||
return $self;
|
||||
|
@ -94,7 +95,7 @@ sub prefix_array_output {
|
|||
|
||||
my $mapping = {
|
||||
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 {
|
||||
|
@ -113,7 +114,7 @@ sub manage_selection {
|
|||
next if ($oid !~ /^$mapping->{nasArrayCapacity}->{oid}\.(.*)/);
|
||||
my $instance = $1;
|
||||
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 '' &&
|
||||
$instance !~ /$self->{option_results}->{filter_name}/) {
|
||||
$self->{output}->output_add(long_msg => "skipping '" . $instance . "': no matching array name.", debug => 1);
|
||||
|
|
|
@ -18,20 +18,20 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
package storage::buffalo::terastation::snmp::::mode::components::disk;
|
||||
package storage::buffalo::terastation::snmp::mode::components::disk;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
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',
|
||||
8 => 'degradeRemoved', 9 => 'removeRemoved', 10 => 'array3',
|
||||
11 => 'array4', 12 => 'mediaCartridge', 13 => 'array5', 14 => 'array6',
|
||||
);
|
||||
|
||||
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 {
|
||||
|
@ -55,14 +55,21 @@ sub check {
|
|||
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].",
|
||||
$instance, $result->{nasDiskStatus}, $instance
|
||||
));
|
||||
$self->{output}->output_add(
|
||||
long_msg => sprintf(
|
||||
"disk '%s' status is '%s' [instance: %s].",
|
||||
$instance, $result->{nasDiskStatus}, $instance
|
||||
)
|
||||
);
|
||||
my $exit = $self->get_severity(section => 'disk', value => $result->{nasDiskStatus});
|
||||
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, $result->{nasDiskStatus}));
|
||||
$self->{output}->output_add(
|
||||
severity => $exit,
|
||||
short_msg => sprintf(
|
||||
"Disk '%s' status is '%s'",
|
||||
$instance, $result->{nasDiskStatus}
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
package storage::buffalo::terastation::snmp::::mode::components::iscsi;
|
||||
package storage::buffalo::terastation::snmp::mode::components::iscsi;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
@ -29,7 +29,7 @@ my %map_iscsi_status = (
|
|||
|
||||
my $mapping = {
|
||||
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';
|
||||
|
||||
|
@ -54,14 +54,21 @@ sub check {
|
|||
next if ($self->check_filter(section => 'iscsi', instance => $instance, name => $result->{nasISCSIName}));
|
||||
$self->{components}->{iscsi}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("iscsi '%s' status is '%s' [instance: %s].",
|
||||
$result->{nasISCSIName}, $result->{nasISCSIStatus}, $instance
|
||||
));
|
||||
$self->{output}->output_add(
|
||||
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});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Iscsi '%s' status is '%s'",
|
||||
$result->{nasISCSIName}, $result->{nasISCSIStatus}));
|
||||
$self->{output}->output_add(
|
||||
severity => $exit,
|
||||
short_msg => sprintf(
|
||||
"Iscsi '%s' status is '%s'",
|
||||
$result->{nasISCSIName}, $result->{nasISCSIStatus}
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
package storage::buffalo::terastation::snmp::::mode::components::psu;
|
||||
package storage::buffalo::terastation::snmp::mode::components::psu;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
@ -28,18 +28,18 @@ my %map_psu_status = (
|
|||
);
|
||||
|
||||
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 {
|
||||
my ($self) = @_;
|
||||
|
||||
|
||||
push @{$self->{request}}, { oid => $mapping->{nasRPSUStatus}->{oid} };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking redundant power supplies");
|
||||
$self->{components}->{psu} = { name => 'psu', total => 0, skip => 0 };
|
||||
return if ($self->check_filter(section => 'psu'));
|
||||
|
@ -52,14 +52,21 @@ sub check {
|
|||
next if ($self->check_filter(section => 'psu', instance => $instance));
|
||||
$self->{components}->{psu}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("redundant psu '%s' status is '%s' [instance: %s].",
|
||||
$instance, $result->{nasRPSUStatus}, $instance
|
||||
));
|
||||
$self->{output}->output_add(
|
||||
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});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Redundant psu '%s' status is '%s'",
|
||||
$instance, $result->{nasRPSUStatus}));
|
||||
$self->{output}->output_add(
|
||||
severity => $exit,
|
||||
short_msg => sprintf(
|
||||
"Redundant psu '%s' status is '%s'",
|
||||
$instance, $result->{nasRPSUStatus}
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ sub set_system {
|
|||
my ($self, %options) = @_;
|
||||
|
||||
$self->{cb_hook2} = 'snmp_execute';
|
||||
|
||||
|
||||
$self->{thresholds} = {
|
||||
disk => [
|
||||
['notSupport', 'WARNING'],
|
||||
|
@ -46,21 +46,21 @@ sub set_system {
|
|||
['array4', 'OK'],
|
||||
['mediaCartridge', 'OK'],
|
||||
['array5', 'OK'],
|
||||
['array6', 'OK'],
|
||||
['array6', 'OK']
|
||||
],
|
||||
iscsi => [
|
||||
['unknown', 'WARNING'],
|
||||
['connected', 'OK'],
|
||||
['standing-by', 'OK'],
|
||||
['standing-by', 'OK']
|
||||
],
|
||||
psu => [
|
||||
['unknown', 'WARNING'],
|
||||
['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'];
|
||||
}
|
||||
|
||||
|
|
|
@ -30,15 +30,15 @@ sub new {
|
|||
bless $self, $class;
|
||||
|
||||
$self->{version} = '0.1';
|
||||
%{$self->{modes}} = (
|
||||
$self->{modes} = {
|
||||
'array-usage' => 'storage::buffalo::terastation::snmp::mode::arrayusage',
|
||||
'cpu-detailed' => 'snmp_standard::mode::cpudetailed',
|
||||
'hardware' => 'storage::buffalo::terastation::snmp::mode::hardware',
|
||||
'list-interfaces' => 'snmp_standard::mode::listinterfaces',
|
||||
'load' => 'snmp_standard::mode::loadaverage',
|
||||
'interfaces' => 'snmp_standard::mode::interfaces',
|
||||
'memory' => 'snmp_standard::mode::memory',
|
||||
);
|
||||
'memory' => 'snmp_standard::mode::memory'
|
||||
};
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue