Send netdisco-users mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.sourceforge.net/lists/listinfo/netdisco-users
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of netdisco-users digest..."
Today's Topics:
1. Re: Add serial number from servers and workstations to
Netdisco's devices (v2) (Carsten Emde)
--- Begin Message ---
Hi,
The “model” property can also be accessed via ‘e_model’—so I expanded the patch
for "model" and also added a check to ensure that an already defined property
is not overwritten, with the exception of the special case of the static
“linux” model, which would be replaced by an explicit setting if any. The patch
now looks like this:
Index: Netdisco/Worker/Plugin/Discover/Properties.pm
===================================================================
--- Netdisco.orig/Worker/Plugin/Discover/Properties.pm
+++ Netdisco/Worker/Plugin/Discover/Properties.pm
@@ -73,7 +73,23 @@ register_worker({ phase => 'early', driv
);
foreach my $property (keys %utf8_properties) {
- my $val = $snmp->$property;
+ my $useproperty = $property;
+ if ($snmp->class eq 'SNMP::Info::Layer3::NetSNMP') {
+ if (!defined $snmp->$property || $snmp->$property eq '') {
+ if ($property eq 'serial' || $property eq 'model') {
+ $useproperty = 'e_' . $property;
+ }
+ }
+ else {
+ if ($property eq 'model' && $snmp->$property eq 'linux') {
+ my $tryuseproperty = 'e_' . $property;
+ if (defined $snmp->$tryuseproperty && $snmp->$tryuseproperty
ne '') {
+ $useproperty = $tryuseproperty;
+ }
+ }
+ }
+ }
+ my $val = $snmp->$useproperty;
$val = [values %$val]->[0] if ref $val eq 'HASH';
($val = Encode::decode('UTF-8', ($val || ''))) =~ s/\s+$//;
$val = undef if $val and $val =~ m/^HASH\(/;
Is anyone else interested in this feature besides me? If so, please let me
know, and I'll submit a merge request. If not, that's fine too.
By the way: To use this feature, two lines such as
pass .1.3.6.1.2.1.47.1.1.1.1.11 /usr/bin/snmpserial
pass .1.3.6.1.2.1.47.1.1.1.1.13 /usr/bin/snmpmodel
must be appended to a peer's /etc/snmp/snmpd.conf, and the referenced scripts
be provided. Examples are given in the documentation, which is likely located
in /usr/share/doc/net-snmp/passtest.
Thanks,
carsten
--- End Message ---
_______________________________________________
Netdisco mailing list - Digest Mode
[email protected]
https://lists.sourceforge.net/lists/listinfo/netdisco-users