Skip to content

Commit cc494e3

Browse files
authored
Support for QuTS hero OS 6.x
On QTS hero 6.x the SNMP OID are changed. With this change both SNMP OID's are checked
1 parent ba90771 commit cc494e3

1 file changed

Lines changed: 26 additions & 5 deletions

File tree

src/storage/qnap/snmp/mode/upgrade.pm

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright 2024 Centreon (http://www.centreon.com/)
2+
# Copyright 2026 Centreon (http://www.centreon.com/)
33
#
44
# Centreon is a full-fledged industry-strength solution that meets
55
# the needs in IT infrastructure and application monitoring for
@@ -68,19 +68,40 @@ sub new {
6868
return $self;
6969
}
7070

71-
my $mapping = {
71+
# QTS OS
72+
my $mapping_qts = {
7273
model => { oid => '.1.3.6.1.4.1.55062.1.12.3' }, # systemModel
7374
version => { oid => '.1.3.6.1.4.1.55062.1.12.6' }, # firmwareVersion
7475
upgrade => { oid => '.1.3.6.1.4.1.55062.1.12.7' } # firmwareUpgradeAvailable
7576
};
77+
# QuTS hero OS
78+
my $mapping_quts_hero = {
79+
model => { oid => '.1.3.6.1.4.1.55062.2.12.3' }, # systemModel
80+
version => { oid => '.1.3.6.1.4.1.55062.2.12.6' }, # firmwareVersion
81+
upgrade => { oid => '.1.3.6.1.4.1.55062.2.12.7' } # firmwareUpgradeAvailable
82+
};
7683

7784
sub manage_selection {
7885
my ($self, %options) = @_;
7986

8087
my $snmp_result = $options{snmp}->get_leef(
81-
oids => [ map($_->{oid} . '.0', values(%$mapping)) ],
82-
nothing_quit => 1
88+
oids => [
89+
map($_->{oid} . '.0', values(%$mapping_qts)),
90+
map($_->{oid} . '.0', values(%$mapping_quts_hero))
91+
],
92+
nothing_quit => 0
8393
);
94+
95+
my $mapping;
96+
if (defined($snmp_result->{ $mapping_qts->{model}->{oid} . '.0' })) {
97+
$mapping = $mapping_qts;
98+
} elsif (defined($snmp_result->{ $mapping_quts_hero->{model}->{oid} . '.0' })) {
99+
$mapping = $mapping_quts_hero;
100+
} else {
101+
$self->{output}->add_option_msg(short_msg => 'Cannot find firmware upgrade information (unsupported QNAP OS/MIB version)');
102+
$self->{output}->option_exit();
103+
}
104+
84105
$snmp_result->{$mapping->{version}->{oid} . '.0'} =~ s/\r*\n*$//;
85106
$self->{global} = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => 0);
86107
$self->{global}->{upgrade} = $self->{global}->{upgrade} ? 'available' : 'unavailable';
@@ -92,7 +113,7 @@ __END__
92113
93114
=head1 MODE
94115
95-
Check upgrade status (only works with QTS OS).
116+
Check upgrade status (works with QTS and QuTS hero OS).
96117
97118
=over 8
98119

0 commit comments

Comments
 (0)