rc9000 / nd2-worker-plugin-aci

Netdisco plugin to fetch mac and arp tables from APIC (Cisco SDN Controller)
BSD 3-Clause "New" or "Revised" License
2 stars 1 forks source link

Use of uninitialized value #4

Closed sjuerges closed 2 years ago

sjuerges commented 2 years ago

Hey,

upon use, this error is thrown. The device is snmp reachable, netdisco has the correct snmp credentials.

[516674] 2022-10-25 06:33:48  info App::Netdisco version 2.057008 loaded.
[516674] 2022-10-25 06:33:49  info discover: [10.10.10.10] started at Tue Oct 25 08:33:49 2022
Use of uninitialized value in string eq at /data/netdisco/nd2-worker-plugin-aci/lib/App/NetdiscoX/Worker/Plugin/Discover/Properties.pm line 14.
[516674] 2022-10-25 06:33:49  info  [10.10.10.10] NetdiscoX::Properties - not an ACIController, ignored
[516674] 2022-10-25 06:33:49  info discover: finished at Tue Oct 25 08:33:49 2022
[516674] 2022-10-25 06:33:49  info discover: status info: skip: driver or action not applicable
rc9000 commented 2 years ago

Hi Sebastian! Yeah that's weird, all the ACI controllers I've seen so far reported their model as "ACIController" to netdisco, and yours does not seem to do that. Can you do a "netdisco-do psql" and show the output of this query for your controller's IP address?

select ip, description, model, snmp_class, layers from device where ip = '10.x.yyy.zz';

|ip         |description                                                 |model        |snmp_class                     |layers  |
|-----------|------------------------------------------------------------|-------------|-------------------------------|--------|
|10.x.yyy.zz|APIC VERSION 5.2(2f); PID APIC-SERVER-L2; Serial FCH2131V17F|ACIController|SNMP::Info::Layer3::CiscoSwitch|01001110|
sjuerges commented 2 years ago

Hey, gladly :)

Thanks for your assistance!

Doesn't seem to get added:

netdisco@netdisco:~$ netdisco-do psql
[539213] 2022-10-25 07:25:23  info App::Netdisco version 2.057008 loaded.
[539213] 2022-10-25 07:25:23  info psql:  started at Tue Oct 25 09:25:23 2022
psql (12.12 (Ubuntu 12.12-0ubuntu0.20.04.1), server 9.3.24)
Type "help" for help.

netdisco=> select ip, description, model, snmp_class, layers from device where ip = '10.10.10.10';
 ip | description | model | snmp_class | layers 
----+-------------+-------+------------+--------
(0 rows)
netdisco@netdisco:~$ netdisco-do discover -DISQ -d 10.10.10.10
[548957] 2022-10-25 07:45:51  info App::Netdisco version 2.057008 loaded.
SELECT me.version, me.installed 
  FROM dbix_class_schema_versions me 
WHERE 1 = 0
SELECT me.version 
  FROM dbix_class_schema_versions me 
ORDER BY installed DESC 
  LIMIT '1'
SELECT me.ip, me.alias, me.subnet, me.port, me.dns, me.creation 
  FROM device_ip me 
WHERE me.alias = '10.10.10.10' AND me.ip = '10.10.10.10'
SELECT me.ip, me.alias, me.subnet, me.port, me.dns, me.creation 
  FROM device_ip me 
WHERE alias = '10.10.10.10'
SELECT me.ip, me.creation, me.dns, me.description, me.uptime, me.contact, me.name, me.location, me.layers, me.num_ports, me.mac, me.serial, me.chassis_id, me.model, me.ps1_type, me.ps2_type, me.ps1_status, me.ps2_status, me.fan, me.slots, me.vendor, me.os, me.os_ver, me.log, me.snmp_ver, me.snmp_comm, me.snmp_class, me.snmp_engineid, me.vtp_domain, me.last_discover, me.last_macsuck, me.last_arpnip, me.is_pseudo, to_char( me.creation, 'YYYY-MM-DD HH24:MI' ), to_char( me.last_arpnip, 'YYYY-MM-DD HH24:MI' ), to_char( me.last_discover, 'YYYY-MM-DD HH24:MI' ), to_char( me.last_macsuck, 'YYYY-MM-DD HH24:MI' ), extract( epoch 
      FROM age( now(  ), me.creation ) ), extract( epoch 
      FROM age( now(  ), me.last_arpnip ) ), extract( epoch 
      FROM age( now(  ), me.last_discover ) ), extract( epoch 
      FROM age( now(  ), me.last_macsuck ) ), replace( age( timestamp 'epoch' + me.uptime / 100 * interval '1 second', timestamp '1970-01-01 00:00:00-00' ) ::text, 'mon', 'month' ) 
  FROM device me 
WHERE me.ip = '10.10.10.10'
[548957] 2022-10-25 07:45:51  info discover: [10.10.10.10] started at Tue Oct 25 09:45:51 2022
[548957] 2022-10-25 07:45:51 debug discover: running with timeout 600s
[548957] 2022-10-25 07:45:51 debug => running workers for phase: check
[548957] 2022-10-25 07:45:51 debug -> run worker check/_base_/0
[548957] 2022-10-25 07:45:51 debug Discover is able to run.
[548957] 2022-10-25 07:45:51 debug => running workers for phase: early
[548957] 2022-10-25 07:45:51 debug -> run worker early/properties/100
[548957] 2022-10-25 07:45:51 debug skip: driver or action not applicable
[548957] 2022-10-25 07:45:51 debug -> run worker early/properties/100
[548957] 2022-10-25 07:45:51 debug skip: driver or action not applicable
[548957] 2022-10-25 07:45:51 debug -> run worker early/properties/100
[548957] 2022-10-25 07:45:51 debug skip: driver or action not applicable
[548957] 2022-10-25 07:45:51 debug -> run worker early/properties/100
[548957] 2022-10-25 07:45:51 debug skip: driver or action not applicable
[548957] 2022-10-25 07:45:51 debug -> run worker early/properties/100
[548957] 2022-10-25 07:45:51 debug skip: driver or action not applicable
[548957] 2022-10-25 07:45:51 debug => running workers for phase: main
[548957] 2022-10-25 07:45:51 debug -> run worker main/canonicalip/100
[548957] 2022-10-25 07:45:51 debug skip: driver or action not applicable
[548957] 2022-10-25 07:45:51 debug -> run worker main/entities/100
[548957] 2022-10-25 07:45:51 debug skip: driver or action not applicable
[548957] 2022-10-25 07:45:51 debug -> run worker main/neighbors/100
[548957] 2022-10-25 07:45:51 debug skip: driver or action not applicable
[548957] 2022-10-25 07:45:51 debug -> run worker main/neighbors/100
[548957] 2022-10-25 07:45:51 debug skip: driver or action not applicable
[548957] 2022-10-25 07:45:51 debug -> run worker main/neighbors/100
[548957] 2022-10-25 07:45:51 debug skip: driver or action not applicable
[548957] 2022-10-25 07:45:51 debug -> run worker main/portpower/100
[548957] 2022-10-25 07:45:51 debug skip: driver or action not applicable
[548957] 2022-10-25 07:45:51 debug -> run worker main/portproperties/100
[548957] 2022-10-25 07:45:51 debug skip: driver or action not applicable
[548957] 2022-10-25 07:45:51 debug -> run worker main/vlans/100
[548957] 2022-10-25 07:45:51 debug skip: driver or action not applicable
[548957] 2022-10-25 07:45:51 debug -> run worker main/wireless/100
[548957] 2022-10-25 07:45:51 debug skip: driver or action not applicable
[548957] 2022-10-25 07:45:51 debug -> run worker main/withnodes/0
[548957] 2022-10-25 07:45:51 debug => running workers for phase: user
[548957] 2022-10-25 07:45:51 debug -> run worker user/properties/0
Use of uninitialized value in string eq at /data/netdisco/nd2-worker-plugin-aci/lib/App/NetdiscoX/Worker/Plugin/Discover/Properties.pm line 14.
[548957] 2022-10-25 07:45:51  info  [10.10.10.10] NetdiscoX::Properties - not an ACIController, ignored
[548957] 2022-10-25 07:45:51 debug NetdiscoX Worker done
[548957] 2022-10-25 07:45:51 debug => running workers for phase: late
[548957] 2022-10-25 07:45:51 debug -> run worker late/hooks/0
[548957] 2022-10-25 07:45:51 debug  [10.10.10.10] hooks - 0 queued
[548957] 2022-10-25 07:45:51  info discover: finished at Tue Oct 25 09:45:51 2022
[548957] 2022-10-25 07:45:51  info discover: status info: skip: driver or action not applicable
sjuerges commented 2 years ago

Upon reading documentation again: I think I misread the documentation. Is it possible that the SNMP basedevices for the APIC and the Switches needs to be in the Database BEFORE activating the plugin ?

Afterwards, it looks like this:

netdisco=> select ip, description, model, snmp_class, layers from device where ip='10.10.10.10';
      ip      |                         description                          |     model     |           snmp_class            |  layers  
--------------+--------------------------------------------------------------+---------------+---------------------------------+----------
 10.10.10.10 | APIC VERSION 5.2(6e); PID APIC-SERVER-L2; Serial FCHREDACTED | ACIController | SNMP::Info::Layer3::CiscoSwitch | 01001110
(1 row)
rc9000 commented 2 years ago

Oh interesting, apparently the discover does not work when the plugin is enabled while the APIC was never discovered before? I'll have to try that.

But yes now your query output looks fine, if you enable the plugin again it should work.

rc9000 commented 2 years ago

Hmm weird, I can't manage to reproduce this here. Even when rediscovering the ACI from zero, it seems to work:

netdisco@eu-nms-02:~> netdisco-do delete -d xx.xxx.66.19
[3011] 2022-10-26 21:42:39  info App::Netdisco version 2.052008 loaded.
[3011] 2022-10-26 21:42:40  info delete: [xx.xxx.66.19] started at Wed Oct 26 23:42:40 2022
[3011] 2022-10-26 21:42:41  info delete: finished at Wed Oct 26 23:42:41 2022
[3011] 2022-10-26 21:42:41  info delete: status done: Deleted device: xx.xxx.66.19

netdisco@eu-nms-02:~> netdisco-do discover -d xx.xxx.66.19
[4002] 2022-10-26 21:43:19  info App::Netdisco version 2.052008 loaded.
[4002] 2022-10-26 21:43:19  info discover: [xx.xxx.66.19] started at Wed Oct 26 23:43:19 2022
[4002] 2022-10-26 21:43:47  info  [xx.xxx.66.19] NetdiscoX::Properties found an ACIController - running device.layers fixup
[4002] 2022-10-26 21:43:47  info discover: finished at Wed Oct 26 23:43:47 2022
[4002] 2022-10-26 21:43:47  info discover: status done: Ended discover for xx.xxx.66.19

I've also tried with only the restconf but not the SNMP settings in deployment.yml. Then it doesn't work as is to be expected, but the error message is different to what you got.

Not quite sure what else could have been different on your end. If you care you can try if you can still reproduce the issue with the above delete/discover sequence, otherwise we can also leave it at that.

sjuerges commented 2 years ago

I think this might be due to user error (by me)

I can only reproduce this if i create a second device_auth block.

I initially used it that way, but restructured the config after reading the documentation of netdisco and your plugin again.

I will close this from my side. Many thanks for your assistance ❤️