scaleway / netbox-netprod-importer

Poll data from network devices in production and import it into netbox
GNU General Public License v3.0
101 stars 31 forks source link

Device inventory fails with "ERROR: netbox_importer: Error getting neighbours on 2 device(s)" #34

Open erdems opened 4 years ago

erdems commented 4 years ago

For all three devices, netbox shows LLDP neighbors without errors.

Full output:

Initializing importers… 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:00<00:00, 21.46it/s] Fetching and pushing data… 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3/3 [01:10<00:00, 23.53s/it] Finding neighbours and interconnecting… 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:04<00:00, 1.37s/it] 0 interconnection(s) applied ERROR: netbox_importer: Error getting neighbours on 3 device(s)

aruhier commented 4 years ago

Hi, You have to enable the debug mode with -v debug. I made the choice to not print errors in normal verbosity, otherwise you would be flooded, and maybe by errors that are not important.

erdems commented 4 years ago

Hey!

Sorry I've completely missed the debug mode. Mailed the output since it's probably way too long (68732 lines) to paste here.

aruhier commented 4 years ago

The error seems to be this one:

DEBUG: netbox_importer: Error when defining interconnections on host xxx-xxx-xx-xxxx: list index out of range

I guess the error is here: https://github.com/aruhier/netbox-netprod-importer/blob/master/netbox_netprod_importer/vendors/juniper/base.py#L148 But sadly it will be difficult for me to debug with having a junOS to debug (with the version you're running). And I'm sorry to say that, but I don't want to push the debug further, as don't want to spend time on this tool anymore (because also of the difficulty to work on it without an infrastructure to target, and because I don't have any need for this tool anymore), and I'm looking for a new maintainer for it.

If you find the issue, however, please feel fry to send me a patch.

erdems commented 4 years ago

Hey there,

That's fair enough; thanks a bunch for the work so far!

Cheers, Erdem

On 16 Mar 2020, at 19:48, Anthony Ruhier notifications@github.com wrote:

The error seems to be this one:

DEBUG: netbox_importer: Error when defining interconnections on host xxx-xxx-xx-xxxx: list index out of range I guess the error is here: https://github.com/aruhier/netbox-netprod-importer/blob/master/netbox_netprod_importer/vendors/juniper/base.py#L148 https://github.com/aruhier/netbox-netprod-importer/blob/master/netbox_netprod_importer/vendors/juniper/base.py#L148 But sadly it will be difficult for me to debug with having a junOS to debug (with the version you're running). And I'm sorry to say that, but I don't want to push the debug further, as don't want to spend time on this tool anymore (because also of the difficulty to work on it without an infrastructure to target, and because I don't have any need for this tool anymore), and I'm looking for a new maintainer for it.

If you find the issue, however, please feel fry to send me a patch.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/aruhier/netbox-netprod-importer/issues/34#issuecomment-599702856, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIAYL5YJ4OLLHJNLQ2WDNLRHZX7HANCNFSM4LKGHYQA.

thefreakquency commented 3 years ago

Bonjour!

I am facing the same issue here. Looking at the 101 600 lines debug output, I realize that at some point, the accessed API URL is missing information and it obtains a 404 page:

DEBUG: ncclient.transport.parser: [host 10.37.230.1 session-id 67931] parsing netconf v1.0
ERROR: netbox_importer: Error when polling device DEVICENAMEHERE: 404 Client Error: Not Found for url: https://FULL-URL.DOMAIN/ipshack/api/dcim/_choices/?limit=50 -- <html lang="en"><head><title>Page Not Found - NetBox</title><link rel="stylesheet" href="/ipshack/static/bootstrap-3.4.1-dist/css/bootstrap.min.css" onerror="window.location='/ipshack/media-failure/?filename=bootstrap-3.4.1-dist/css/bootstrap.min.css'"><link rel="stylesheet" href="/ipshack/static/materialdesignicons-5.4.55/css/materialdesignicons.min.css" onerror="window.location='/ipshack/media-failure/?filename=materialdesignicons-5.4.55/css/materialdesignicons.min.css'"><link rel="stylesheet" href="/ipshack/static/jquery-ui-1.12.1/jquery-ui.css" onerror="window.location='/ipshack/media-failure/?filename=jquery-ui-1.12.1/jquery-ui.css'"><link rel="stylesheet" href="/ipshack/static/select2-4.0.13/dist/css/select2.min.css" onerror="window.location='/ipshack/media-failure/?filename=select2-4.0.13/dist/css/select2.min.css'"><link rel="stylesheet" href="/ipshack/static/select2-bootstrap-0.1.0-beta.10/select2-bootstrap.min.css" onerror="window.location='/ipshack/media-failure/?filename=select2-bootstrap-0.1.0-beta.10/select2-bootstrap.min.css'"><link rel="stylesheet" href="/ipshack/static/flatpickr-4.6.3/themes/light.css" onerror="window.location='/ipshack/media-failure/?filename=flatpickr-4.6.3/themes/light.css'"><link rel="stylesheet" href="/ipshack/static/css/base.css?v2.11.11" onerror="window.location='/ipshack/media-failure/?filename=css/base.css'"><link rel="icon" type="image/png" href="/ipshack/static/img/netbox.ico"><meta charset="UTF-8"><meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"></head><body>
...

This error appears for my 2 devices in scope for this import.

My understanding is that the script should try https://FULL-URL.DOMAIN/ipshack/api/dcim/devices/?name=DEVICENAMEHERE&limit=50 instead of https://FULL-URL.DOMAIN/ipshack/api/dcim/_choices/?limit=50

I simply cannot put my finger on the issue looking at the code as I am not fluent in python :|