scaleway / netbox-netprod-importer

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

Error polling device for driver not being used #46

Open cvinje opened 4 years ago

cvinje commented 4 years ago

I am getting the following error.

DEBUG: netmiko: write_channel: b'exit\n' ERROR: netbox_importer: Error when polling device XXXX-XX-XXXX: No module named 'pynxos'

The device is set up to use the ios driver however it appears to be using nx-os. Verbose output shows connectivity to the device and looks to complete.

netbox-netprod-importer==0.3.3

Thanks

cvinje commented 4 years ago

I was able to get this fixed by installing the pynxos module. I am now receiving the following.

ERROR: netbox_importer: Error when polling device XXX-XXX-XXX: HTTPSConnectionPool(host='xxx.xxx.com', port=443): Max retries exceeded with url: /api/dcim/devices/?name=XXX-XXX-XXX&limit=50 (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)'),))

disable_ssl_warnings is set to true in the config

The certificate is self signed and connecting directly in a python console using urllib3 is not throwing any errors.

boomsfib commented 4 years ago

I was having these exact same issues. Just like you, I was able to resolve by installing the pynxos module and then started to get the SSL Error. I went and changed my /etc/nginx/sites-available/netbox file to the below

server { listen 80;

server_name 10.10.10.1;

client_max_body_size 25m;

location /static/ {
    alias /opt/netbox/netbox/static/;
}

location / {
    proxy_pass http://127.0.0.1:8001;
    proxy_set_header X-Forwarded-Host $server_name;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-Proto $scheme;
    add_header P3P 'CP="ALL DSP COR PSAa PSDa OUR NOR ONL UNI COM NAV"';
}

}

This fixed the SSL error (I know, not secure, but this is a lab) but now I am receiving the following error

ERROR: netbox_importer: Error when polling device switch1.mydomain.com: 404 Client Error: Not Found for url: http://XXX.XXX.XXX.XXX/api/dcim/_choices/?limit=50 --

chadhump commented 4 years ago

I experienced the same issue with the pynxos and resolved that by installing it. I'm running Apache installed of nginx and can't seem to resolve the SSL issue with httpd using the above configuration for nginx. What lines above were specifically added to resolve this in nginx?

boomsfib commented 4 years ago

The original configuration looked like this

server {
    listen 443 ssl;

    # CHANGE THIS TO YOUR SERVER'S NAME
    server_name 10.10.10.1;

    ssl_certificate /etc/ssl/certs/netbox.crt;
    ssl_certificate_key /etc/ssl/private/netbox.key;

    client_max_body_size 25m;

    location /static/ {
        alias /opt/netbox/netbox/static/;
    }

    location / {
        proxy_pass http://127.0.0.1:8001;
        proxy_set_header X-Forwarded-Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

server {
    # Redirect HTTP traffic to HTTPS
    listen 80;
    server_name _;
    return 301 https://$host$request_uri;
}

I changed it to look like this

server {
listen 80;

server_name 10.10.10.1;

client_max_body_size 25m;

location /static/ {
    alias /opt/netbox/netbox/static/;
}

location / {
    proxy_pass http://127.0.0.1:8001;
    proxy_set_header X-Forwarded-Host $server_name;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-Proto $scheme;
    add_header P3P 'CP="ALL DSP COR PSAa PSDa OUR NOR ONL UNI COM NAV"';
}

}

and that fixed the SSL error, but not "ERROR: netbox_importer: Error when polling device switch1.mydomain.com: 404 Client Error: Not Found for url: http://XXX.XXX.XXX.XXX/api/dcim/_choices/?limit=50 --".

Turns out a change was made in Netbox between version 2.5 and 2.8 that broke netbox_netprod_importer. I haven't checked lately to see if they have made the adjustments to get it working again.