try to update synology
This commit is contained in:
parent
adc9fbbcf3
commit
3d378d80b1
|
@ -34,9 +34,7 @@ my $oid_fan = '.1.3.6.1.4.1.6574.1.4';
|
|||
sub load {
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$self->{request}}, {
|
||||
oid => $oid_fan
|
||||
};
|
||||
push @{$self->{request_leef}}, $mapping->{synoSystemsystemFanStatus}->{oid} . '.0', $mapping->{synoSystemcpuFanStatus}->{oid} . '.0';
|
||||
}
|
||||
|
||||
sub check {
|
||||
|
@ -45,9 +43,9 @@ sub check {
|
|||
$self->{output}->output_add(long_msg => "Checking cpu fan");
|
||||
$self->{components}->{fan} = {name => 'fan', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'fan'));
|
||||
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_fan}, instance => '0');
|
||||
if (!$self->check_filter(section => 'fan', instance => 'cpu')) {
|
||||
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results_leef}, instance => '0');
|
||||
if (defined($result->{synoSystemcpuFanStatus}) && !$self->check_filter(section => 'fan', instance => 'cpu')) {
|
||||
$self->{components}->{fan}->{total}++;
|
||||
|
||||
$self->{output}->output_add(
|
||||
|
@ -65,7 +63,7 @@ sub check {
|
|||
}
|
||||
}
|
||||
|
||||
if (!$self->check_filter(section => 'fan', instance => 'system')) {
|
||||
if (defined($result->{synoSystemsystemFanStatus}) && !$self->check_filter(section => 'fan', instance => 'system')) {
|
||||
$self->{components}->{fan}->{total}++;
|
||||
$self->{output}->output_add(
|
||||
long_msg => sprintf(
|
||||
|
|
|
@ -32,7 +32,7 @@ my $mapping = {
|
|||
sub load {
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$self->{request}}, { oid => $mapping->{synoSystempowerStatus}->{oid} };
|
||||
push @{$self->{request_leef}}, $mapping->{synoSystempowerStatus}->{oid} . '.0';
|
||||
}
|
||||
|
||||
sub check {
|
||||
|
@ -41,9 +41,12 @@ sub check {
|
|||
$self->{output}->output_add(long_msg => "Checking power supply");
|
||||
$self->{components}->{psu} = {name => 'psu', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'psu'));
|
||||
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results_leef}, instance => '0');
|
||||
return if (!defined($result->{synoSystempowerStatus}));
|
||||
|
||||
$self->{components}->{psu}->{total}++;
|
||||
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$mapping->{synoSystempowerStatus}->{oid}}, instance => '0');
|
||||
$self->{output}->output_add(
|
||||
long_msg => sprintf(
|
||||
"power supply status is %s.",
|
||||
|
|
|
@ -26,13 +26,13 @@ use warnings;
|
|||
my $map_status = { 1 => 'Normal', 2 => 'Failed' };
|
||||
|
||||
my $mapping = {
|
||||
synoSystemsystemStatus => { oid => '.1.3.6.1.4.1.6574.1.1', map => $map_status }
|
||||
synoSystemsystemStatus => { oid => '.1.3.6.1.4.1.6574.1.1', map => $map_status }
|
||||
};
|
||||
|
||||
sub load {
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$self->{request}}, { oid => $mapping->{synoSystemsystemStatus}->{oid} };
|
||||
|
||||
push @{$self->{request_leef}}, $mapping->{synoSystemsystemStatus}->{oid} . '.0';
|
||||
}
|
||||
|
||||
sub check {
|
||||
|
@ -41,9 +41,12 @@ sub check {
|
|||
$self->{output}->output_add(long_msg => "Checking system partition status");
|
||||
$self->{components}->{system} = {name => 'system', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'system'));
|
||||
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results_leef}, instance => '0');
|
||||
return if (!defined($result->{synoSystemsystemStatus}));
|
||||
|
||||
$self->{components}->{system}->{total}++;
|
||||
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$mapping->{synoSystemsystemStatus}->{oid}}, instance => '0');
|
||||
$self->{output}->output_add(
|
||||
long_msg => sprintf(
|
||||
"system partition status is %s.",
|
||||
|
|
|
@ -72,13 +72,20 @@ sub set_system {
|
|||
|
||||
$self->{components_path} = 'storage::synology::snmp::mode::components';
|
||||
$self->{components_module} = ['psu', 'fan', 'disk', 'raid', 'system'];
|
||||
|
||||
$self->{request_leef} = [];
|
||||
}
|
||||
|
||||
sub snmp_execute {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{snmp} = $options{snmp};
|
||||
$self->{results} = $self->{snmp}->get_multiple_table(oids => $self->{request});
|
||||
if (scalar(@{$self->{request}}) > 0) {
|
||||
$self->{results} = $self->{snmp}->get_multiple_table(oids => $self->{request});
|
||||
}
|
||||
if (scalar(@{$self->{request_leef}}) > 0) {
|
||||
$self->{results_leef} = $self->{snmp}->get_leef(oids => $self->{request_leef});
|
||||
}
|
||||
}
|
||||
|
||||
sub new {
|
||||
|
|
Loading…
Reference in New Issue