-
Documentation & bug reporting acknowledgmentYes, I read it Describe your problemHi, have some trouble to discover and import some hikvision devices with glpi-agent (1.10-1 on Rocky Linux 8.10) I make a snmpwalk (see below)
The result file is like this
So I made a new MibSupport module Hikvision.pm like a made before for Hwg devices fusioninventory/fusioninventory-agent#824 Same situation for this kind of device which have no serial number exposed through snmp
But discovery result is exactly the same... nothing can you tell me what's wrong ? Thx |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 4 replies
-
Hi @b-keller your snmpwalk only reports private parts, so I can't confirm the In your code, I would eventually change sub getMacAddress {
my ($self) = @_;
my $mac = getCanonicalString($self->get(hikvisionMac))
or return;
$mac =~ s/-/:/g;
return getCanonicalMacAddress($mac);
} That said, I just saw one little mistake in your constant definition... one dot is missing at the beginning of the string part and this should be this: use constant hikvisionModel => hikvision . '.1.1';
use constant hikvisionMac => hikvision . '.1.4'; |
Beta Was this translation helpful? Give feedback.
-
The snmpwalk was run like this
if I run like that
so i must add entry to sysobject.ids ? |
Beta Was this translation helpful? Give feedback.
-
Yes I made all constants fix
I double check snmp security setting, all is correct So, the root problem is sysobjectID not match nothing in |
Beta Was this translation helpful? Give feedback.
-
You should probably also contact Hikvision support to know why their device may not report standard OIDs. |
Beta Was this translation helpful? Give feedback.
-
I update Hikvision.pm code with your recommandations package GLPI::Agent::SNMP::MibSupport::Hikvision;
use strict;
use warnings;
use parent 'GLPI::Agent::SNMP::MibSupportTemplate';
use GLPI::Agent::Tools;
use GLPI::Agent::Tools::SNMP;
# See Hikvision-MIB
use constant hikvision => '.1.3.6.1.4.1.39165';
use constant hikvisionModel => hikvision . '.1.1';
use constant hikvisionMac => hikvision . '.1.4';
our $mibSupport = [
{
name => "hikvision",
sysobjectid => getRegexpOidMatch(hikvision)
},{
name => "hikvision-model",
privateoid => hikvisionModel
},
];
sub getType {
return 'NETWORKING';
}
sub getManufacturer {
return 'Hikvision';
}
sub getSerial {
my ($self) = @_;
my $serial = getCanonicalString($self->get(hikvisionMac))
or return;
$serial =~ s/-//g;
return $serial;
}
sub getMacAddress {
my ($self) = @_;
my $mac = getCanonicalString($self->get(hikvisionMac))
or return;
$mac =~ s/-/:/g;
return getCanonicalMacAddress($mac);
}
sub getSnmpHostname {
my ($self) = @_;
my $serial = $self->getSerial()
or return;
my $device = $self->device
or return;
return $device->{MODEL}.'_'.$serial;
}
sub getModel {
my ($self) = @_;
return $self->get(hikvisionModel);
}
1;
__END__
=head1 NAME
GLPI::Agent::SNMP::MibSupport::Hikvision - Inventory module for Hikvision
=head1 DESCRIPTION
This module enhances Hikvision devices support. and glpi-netdiscovery command start output [root@xxxx ~]# glpi-netdiscovery --host xxx.xxx.xxx.225 --community MyCommunity --v2c --debug --debug
[debug2] /etc/glpi-agent/toolbox.yaml configuration not found
[debug] initializing job 1
[debug] initializing block xxx.xxx.xxx.225-xxx.xxx.xxx.225
[debug] Current netdiscovery run expiration timeout: few minutes
[debug] using 1 netdiscovery worker
[debug] starting job 1 with 1 ip to scan using 1 worker
[debug] #1, scanning xxx.xxx.xxx.225
[debug] #1, - scanning xxx.xxx.xxx.225 with SNMP, credentials 1: success
[debug] #1, - scanning xxx.xxx.xxx.225 with netbios: no result
[debug] #1, - scanning xxx.xxx.xxx.225 with echo ping: success
[debug2] #1, executing arp -a xxx.xxx.xxx.225
[debug] #1, - scanning xxx.xxx.xxx.225 in arp table: no result
<?xml version="1.0" encoding="UTF-8"?>
<REQUEST>
<CONTENT>
<DEVICE>
<AUTHSNMP>1</AUTHSNMP>
<DNSHOSTNAME>xxx.xxx.xxx.225</DNSHOSTNAME>
<IP>xxx.xxx.xxx.225</IP>
</DEVICE>
<MODULEVERSION>6.3</MODULEVERSION>
<PROCESSNUMBER>1</PROCESSNUMBER>
</CONTENT>
<DEVICEID>foo</DEVICEID>
<QUERY>NETDISCOVERY</QUERY>
</REQUEST>
[debug] #1, #1, worker termination
[debug] #1, Netdiscovery worker terminated |
Beta Was this translation helpful? Give feedback.
-
So, I must update constants like this for have an output use constant hikvisionModel => hikvision . '.1.1.0';
use constant hikvisionMac => hikvision . '.1.4.0'; [root@xxxx ~]# glpi-netdiscovery --host xxx.xxx.xxx.225 --community SiEEEnNetWork --v2c --debug --debug
[debug2] /etc/glpi-agent/toolbox.yaml configuration not found
[debug] initializing job 1
[debug] initializing block xxx.xxx.xxx.225-xxx.xxx.xxx.225
[debug] Current netdiscovery run expiration timeout: few minutes
[debug] using 1 netdiscovery worker
[debug] starting job 1 with 1 ip to scan using 1 worker
[debug] #1, scanning xxx.xxx.xxx.225
[debug] #1, PrivateOID match: hikvision-model mib support enabled
[debug] #1, - scanning xxx.xxx.xxx.225 with SNMP, credentials 1: success
[debug] #1, - scanning xxx.xxx.xxx.225 with netbios: no result
[debug] #1, - scanning xxx.xxx.xxx.225 with echo ping: success
[debug2] #1, executing arp -a xxx.xxx.xxx.225
[debug] #1, - scanning xxx.xxx.xxx.225 in arp table: no result
<?xml version="1.0" encoding="UTF-8"?>
<REQUEST>
<CONTENT>
<DEVICE>
<AUTHSNMP>1</AUTHSNMP>
<DNSHOSTNAME>xxx.xxx.xxx.225</DNSHOSTNAME>
<IP>xxx.xxx.xxx.225</IP>
<MAC>e8:a0:ed:ef:75:46</MAC>
<MANUFACTURER>Hikvision</MANUFACTURER>
<MODEL>PTZ-N2404I-DE3</MODEL>
<SERIAL>e8a0edef7546</SERIAL>
<SNMPHOSTNAME>PTZ-N2404I-DE3_e8a0edef7546</SNMPHOSTNAME>
<TYPE>NETWORKING</TYPE>
</DEVICE>
<MODULEVERSION>6.3</MODULEVERSION>
<PROCESSNUMBER>1</PROCESSNUMBER>
</CONTENT>
<DEVICEID>foo</DEVICEID>
<QUERY>NETDISCOVERY</QUERY>
</REQUEST>
[debug] #1, #1, worker termination
[debug] #1, Netdiscovery worker terminated |
Beta Was this translation helpful? Give feedback.
-
I made #746 thx |
Beta Was this translation helpful? Give feedback.
Nice.
I leave you create a PR if you want it integrated.