Skip to content

Commit 42e096f

Browse files
committed
fix: Add HTek phones support
1 parent ee2159f commit 42e096f

File tree

2 files changed

+86
-0
lines changed

2 files changed

+86
-0
lines changed

Changes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ netdiscovery/netinventory:
5454
* fix #1026: Update LLDP support fixing connection detection on few Cisco, Dell,
5555
Mikrotik and TP-Link devices
5656
* Add Tiesse devices support
57+
* fix #1001: Add HTek phones support
5758

5859
injector:
5960
* Add support for --ca-cert-file and --ssl-fingerprint options
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
package GLPI::Agent::SNMP::MibSupport::Htek;
2+
3+
use strict;
4+
use warnings;
5+
6+
use parent 'GLPI::Agent::SNMP::MibSupportTemplate';
7+
8+
use GLPI::Agent::Tools;
9+
use GLPI::Agent::Tools::SNMP;
10+
11+
# UNICORN-MIB
12+
use constant htek => ".1.3.6.1.4.1.38241" ;
13+
14+
use constant firmware => htek . ".1.1.0";
15+
use constant model => htek . ".1.2.0";
16+
use constant macaddr => htek . ".1.3.0";
17+
use constant ip => htek . ".1.4.0";
18+
19+
our $mibSupport = [
20+
{
21+
name => "htek",
22+
sysobjectid => getRegexpOidMatch(htek)
23+
}
24+
];
25+
26+
sub getMacAddress {
27+
my ($self) = @_;
28+
29+
return getCanonicalMacAddress(getCanonicalString($self->get(macaddr)));
30+
}
31+
32+
sub getFirmware {
33+
my ($self) = @_;
34+
35+
my $device = $self->device
36+
or return;
37+
38+
my $firmwares = getCanonicalString($self->get(firmware));
39+
my ($firmware) = $firmwares =~ /^BOOT--([0-9.]+)/;
40+
return $firmware;
41+
}
42+
43+
sub getModel {
44+
my ($self) = @_;
45+
46+
return getCanonicalString($self->get(model));
47+
}
48+
49+
sub getIp {
50+
my ($self) = @_;
51+
52+
return getCanonicalString($self->get(ip));
53+
}
54+
55+
sub run {
56+
my ($self) = @_;
57+
58+
my $device = $self->device
59+
or return;
60+
61+
# Fix IPS
62+
if (ref($device->{IPS}) eq 'HASH' && ref($device->{IPS}->{IP}) eq 'ARRAY') {
63+
my @ips = grep { ! empty($_) } @{$device->{IPS}->{IP}};
64+
$device->{IPS}->{IP} = \@ips;
65+
}
66+
67+
# Fix hostname
68+
if ($device->{SNMPHOSTNAME} =~ /^\(none\)\s+Description: (\S+).*MAC\s\d:\s(\S\S \S\S \S\S \S\S \S\S \S\S) /) {
69+
$device->{SNMPHOSTNAME} = "$1 $2";
70+
}
71+
$device->{INFO}{NAME} = $device->{SNMPHOSTNAME}
72+
if $device->{INFO} && $device->{INFO}{NAME};
73+
}
74+
75+
1;
76+
77+
__END__
78+
79+
=head1 NAME
80+
81+
GLPI::Agent::SNMP::MibSupport::Htek - Inventory module for Htek IP phones devices
82+
83+
=head1 DESCRIPTION
84+
85+
The module enhances support for Htek IP phones devices

0 commit comments

Comments
 (0)