netbox-community / netbox-docker

🐳 Docker Image of NetBox
https://github.com/netbox-community/netbox-docker/wiki
Apache License 2.0
1.8k stars 822 forks source link

netbox-docker gives 502 bad gateway errors with napalm integration enabled #150

Closed ghost closed 5 years ago

ghost commented 5 years ago

## Current Behavior I clicked on the status tab from the device page, and it gave a 502 Bad Gateway error.

## Expected Behavior I expected that it would give the get_facts and get_environment information from napalm.

## Debug Information The output of docker-compose version: 1.23.2 The output of docker version: 18.09.2 The output of git rev-parse HEAD: ce9158eb0779f1428395a05e195f6066140a1380 The command you used to start the project: docker-compose up

The output of docker-compose logs netbox:

Attaching to netbox-docker_netbox_1
netbox_1         | Operations to perform:
netbox_1         |   Apply all migrations: admin, auth, circuits, contenttypes, dcim, extras, ipam, secrets, sessions, taggit, tenancy, users, virtualization
netbox_1         | Running migrations:
netbox_1         |   No migrations to apply.
netbox_1         | 💡 Username: admin, E-Mail: admin@example.com
netbox_1         | ⚙️ Executing '/opt/netbox/startup_scripts/000_users.py'
netbox_1         | ⚙️ Executing '/opt/netbox/startup_scripts/010_groups.py'
netbox_1         | ⚙️ Executing '/opt/netbox/startup_scripts/020_custom_fields.py'
netbox_1         | ⚙️ Executing '/opt/netbox/startup_scripts/030_regions.py'
netbox_1         | ⚙️ Executing '/opt/netbox/startup_scripts/040_sites.py'
netbox_1         | ⚙️ Executing '/opt/netbox/startup_scripts/050_manufacturers.py'
netbox_1         | ⚙️ Executing '/opt/netbox/startup_scripts/060_device_types.py'
netbox_1         | ⚙️ Executing '/opt/netbox/startup_scripts/070_rack_roles.py'
netbox_1         | ⚙️ Executing '/opt/netbox/startup_scripts/080_racks.py'
netbox_1         | ⚙️ Executing '/opt/netbox/startup_scripts/090_device_roles.py'
netbox_1         | ⚙️ Executing '/opt/netbox/startup_scripts/100_platforms.py'
netbox_1         | ⚙️ Executing '/opt/netbox/startup_scripts/110_devices.py'
netbox_1         |
netbox_1         | 0 static files copied to '/opt/netbox/netbox/static', 344 unmodified.
netbox_1         | ✅ Initialisation is done.
netbox_1         | [2019-07-30 18:10:28 +0000] [1] [DEBUG] Current configuration:
netbox_1         |   config: /etc/netbox/config/gunicorn_config.py
netbox_1         |   bind: ['0.0.0.0:8001']
netbox_1         |   backlog: 2048
netbox_1         |   workers: 3
netbox_1         |   worker_class: sync
netbox_1         |   threads: 1
netbox_1         |   worker_connections: 1000
netbox_1         |   max_requests: 0
netbox_1         |   max_requests_jitter: 0
netbox_1         |   timeout: 30
netbox_1         |   graceful_timeout: 30
netbox_1         |   keepalive: 2
netbox_1         |   limit_request_line: 4094
netbox_1         |   limit_request_fields: 100
netbox_1         |   limit_request_field_size: 8190
netbox_1         |   reload: False
netbox_1         |   reload_engine: auto
netbox_1         |   reload_extra_files: []
netbox_1         |   spew: False
netbox_1         |   check_config: False
netbox_1         |   preload_app: False
netbox_1         |   sendfile: None
netbox_1         |   reuse_port: False
netbox_1         |   chdir: /opt/netbox/netbox
netbox_1         |   daemon: False
netbox_1         |   raw_env: []
netbox_1         |   pidfile: None
netbox_1         |   worker_tmp_dir: None
netbox_1         |   user: 0
netbox_1         |   group: 0
netbox_1         |   umask: 0
netbox_1         |   initgroups: False
netbox_1         |   tmp_upload_dir: None
netbox_1         |   secure_scheme_headers: {'X-FORWARDED-PROTOCOL': 'ssl', 'X-FORWARDED-PROTO': 'https', 'X-FORWARDED-SSL': 'on'}
netbox_1         |   forwarded_allow_ips: ['127.0.0.1']
netbox_1         |   accesslog: -
netbox_1         |   disable_redirect_access_to_syslog: False
netbox_1         |   access_log_format: %(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"
netbox_1         |   errorlog: -
netbox_1         |   loglevel: debug
netbox_1         |   capture_output: True
netbox_1         |   logger_class: gunicorn.glogging.Logger
netbox_1         |   logconfig: None
netbox_1         |   logconfig_dict: {}
netbox_1         |   syslog_addr: udp://localhost:514
netbox_1         |   syslog: False
netbox_1         |   syslog_prefix: None
netbox_1         |   syslog_facility: user
netbox_1         |   enable_stdio_inheritance: False
netbox_1         |   statsd_host: None
netbox_1         |   statsd_prefix:
netbox_1         |   proc_name: None
netbox_1         |   default_proc_name: netbox.wsgi
netbox_1         |   pythonpath: /opt/netbox/netbox
netbox_1         |   paste: None
netbox_1         |   on_starting: <function OnStarting.on_starting at 0x7fc470b55b00>
netbox_1         |   on_reload: <function OnReload.on_reload at 0x7fc470b55c20>
netbox_1         |   when_ready: <function WhenReady.when_ready at 0x7fc470b55d40>
netbox_1         |   pre_fork: <function Prefork.pre_fork at 0x7fc470b55e60>
netbox_1         |   post_fork: <function Postfork.post_fork at 0x7fc470b55f80>
netbox_1         |   post_worker_init: <function PostWorkerInit.post_worker_init at 0x7fc470a4f0e0>
netbox_1         |   worker_int: <function WorkerInt.worker_int at 0x7fc470a4f200>
netbox_1         |   worker_abort: <function WorkerAbort.worker_abort at 0x7fc470a4f320>
netbox_1         |   pre_exec: <function PreExec.pre_exec at 0x7fc470a4f440>
netbox_1         |   pre_request: <function PreRequest.pre_request at 0x7fc470a4f560>
netbox_1         |   post_request: <function PostRequest.post_request at 0x7fc470a4f5f0>
netbox_1         |   child_exit: <function ChildExit.child_exit at 0x7fc470a4f710>
netbox_1         |   worker_exit: <function WorkerExit.worker_exit at 0x7fc470a4f830>
netbox_1         |   nworkers_changed: <function NumWorkersChanged.nworkers_changed at 0x7fc470a4f950>
netbox_1         |   on_exit: <function OnExit.on_exit at 0x7fc470a4fa70>
netbox_1         |   proxy_protocol: False
netbox_1         |   proxy_allow_ips: ['127.0.0.1']
netbox_1         |   keyfile: None
netbox_1         |   certfile: None
netbox_1         |   ssl_version: 2
netbox_1         |   cert_reqs: 0
netbox_1         |   ca_certs: None
netbox_1         |   suppress_ragged_eofs: True
netbox_1         |   do_handshake_on_connect: False
netbox_1         |   ciphers: TLSv1
netbox_1         |   raw_paste_global_conf: []
netbox_1         | [2019-07-30 18:10:28 +0000] [1] [INFO] Starting gunicorn 19.9.0
netbox_1         | [2019-07-30 18:10:28 +0000] [1] [DEBUG] Arbiter booted
netbox_1         | [2019-07-30 18:10:28 +0000] [1] [INFO] Listening at: http://0.0.0.0:8001 (1)
netbox_1         | [2019-07-30 18:10:28 +0000] [1] [INFO] Using worker: sync
netbox_1         | [2019-07-30 18:10:28 +0000] [112] [INFO] Booting worker with pid: 112
netbox_1         | [2019-07-30 18:10:28 +0000] [113] [INFO] Booting worker with pid: 113
netbox_1         | [2019-07-30 18:10:28 +0000] [114] [INFO] Booting worker with pid: 114
netbox_1         | [2019-07-30 18:10:28 +0000] [1] [DEBUG] 3 workers
netbox_1         | [2019-07-30 18:10:30 +0000] [112] [DEBUG] GET /api/dcim/devices/1/napalm/
netbox_1         | [2019-07-30 18:10:35 +0000] [113] [DEBUG] GET /api/dcim/devices/1/napalm/
netbox_1         | [2019-07-30 18:10:52 +0000] [114] [DEBUG] GET /api/dcim/devices/1/napalm/
netbox_1         | [2019-07-30 18:11:01 +0000] [1] [CRITICAL] WORKER TIMEOUT (pid:112)
netbox_1         | [2019-07-30 18:11:01 +0000] [112] [INFO] Worker exiting (pid: 112)
netbox_1         | [2019-07-30 18:11:01 +0000] [151] [INFO] Booting worker with pid: 151
netbox_1         | [2019-07-30 18:11:05 +0000] [1] [CRITICAL] WORKER TIMEOUT (pid:113)
netbox_1         | [2019-07-30 18:11:05 +0000] [113] [INFO] Worker exiting (pid: 113)
netbox_1         | [2019-07-30 18:11:06 +0000] [157] [INFO] Booting worker with pid: 157
netbox_1         | [2019-07-30 18:11:23 +0000] [1] [CRITICAL] WORKER TIMEOUT (pid:114)
netbox_1         | [2019-07-30 18:11:23 +0000] [114] [INFO] Worker exiting (pid: 114)
netbox_1         | [2019-07-30 18:11:23 +0000] [151] [DEBUG] GET /favicon.ico
netbox_1         | [2019-07-30 18:11:23 +0000] [163] [INFO] Booting worker with pid: 163
netbox_1         | 172.18.0.6 - - [30/Jul/2019:18:11:23 +0000] "GET /favicon.ico HTTP/1.0" 404 30385 "http://hostname.masked.com:8080/api/dcim/devices/1/napalm/?method=get_environment" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36"
netbox_1         | [2019-07-30 18:11:49 +0000] [157] [DEBUG] GET /api/dcim/devices/1/napalm
netbox_1         | 172.18.0.6 - - [30/Jul/2019:18:11:50 +0000] "GET /api/dcim/devices/1/napalm HTTP/1.0" 301 0 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36"
netbox_1         | [2019-07-30 18:11:50 +0000] [163] [DEBUG] GET /api/dcim/devices/1/napalm/
netbox_1         | 172.18.0.6 - - [30/Jul/2019:18:11:57 +0000] "GET /api/dcim/devices/1/napalm/ HTTP/1.0" 200 5336 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36"
netbox_1         | [2019-07-30 18:12:17 +0000] [157] [DEBUG] GET /api/dcim/devices/1/napalm/
netbox_1         | [2019-07-30 18:12:48 +0000] [1] [CRITICAL] WORKER TIMEOUT (pid:157)
netbox_1         | [2019-07-30 18:12:48 +0000] [157] [INFO] Worker exiting (pid: 157)
netbox_1         | [2019-07-30 18:12:49 +0000] [183] [INFO] Booting worker with pid: 183
The output of `docker-compose logs nginx`:
nginx_1          | 2019/07/30 18:10:05 [notice] 1#1: using the "epoll" event method
nginx_1          | 2019/07/30 18:10:05 [notice] 1#1: nginx/1.15.12
nginx_1          | 2019/07/30 18:10:05 [notice] 1#1: built by gcc 8.3.0 (Alpine 8.3.0)
nginx_1          | 2019/07/30 18:10:05 [notice] 1#1: OS: Linux 4.9.125-linuxkit
nginx_1          | 2019/07/30 18:10:05 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
nginx_1          | 2019/07/30 18:10:05 [notice] 1#1: start worker processes
nginx_1          | 2019/07/30 18:10:05 [notice] 1#1: start worker process 6
nginx_1          | 2019/07/30 18:10:34 [info] 6#6: *1 epoll_wait() reported that client prematurely closed connection, so upstream connection is closed too while sending request to upstream, client: 172.18.0.1, server: , request: "GET /api/dcim/devices/1/napalm/?method=get_environment HTTP/1.1", upstream: "http://172.18.0.5:8001/api/dcim/devices/1/napalm/?method=get_environment", host: "hostname.masked.com:8080"
nginx_1          | 2019/07/30 18:10:47 [info] 6#6: *3 epoll_wait() reported that client prematurely closed connection, so upstream connection is closed too while sending request to upstream, client: 172.18.0.1, server: , request: "GET /api/dcim/devices/1/napalm/?method=get_environment HTTP/1.1", upstream: "http://172.18.0.5:8001/api/dcim/devices/1/napalm/?method=get_environment", host: "hostname.masked.com:8080"
nginx_1          | 2019/07/30 18:11:23 [error] 6#6: *5 upstream prematurely closed connection while reading response header from upstream, client: 172.18.0.1, server: , request: "GET /api/dcim/devices/1/napalm/?method=get_environment HTTP/1.1", upstream: "http://172.18.0.5:8001/api/dcim/devices/1/napalm/?method=get_environment", host: "hostname.masked.com:8080"
nginx_1          | 2019/07/30 18:12:48 [error] 6#6: *10 upstream prematurely closed connection while reading response header from upstream, client: 172.18.0.1, server: , request: "GET /api/dcim/devices/1/napalm/?method=get_facts HTTP/1.1", upstream: "http://172.18.0.5:8001/api/dcim/devices/1/napalm/?method=get_facts", host: "hostname.masked.com:8080"
ghost commented 5 years ago

PEBKAC error. Had the device listed as using the IOSXR driver, which it should have been able to do. But using the IOS driver for NAPALM, it works fine. Closing issue.