Merge pull request #344 from netbox-community/Prometheus

Prepare for Monitoring with Prometheus
This commit is contained in:
Christian Mäder 2020-10-26 15:58:52 +01:00 committed by GitHub
commit e51f9cbc18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 22 additions and 3 deletions

1
.gitignore vendored
View File

@ -8,3 +8,4 @@ configuration/*
!configuration/extra.py !configuration/extra.py
configuration/ldap/* configuration/ldap/*
!configuration/ldap/ldap_config.py !configuration/ldap/ldap_config.py
prometheus.yml

View File

@ -79,7 +79,7 @@ The default credentials are:
## Documentation ## Documentation
Please refer [to our wiki on Github][netbox-docker-wiki] for further information on how to use this Netbox Docker image properly. Please refer [to our wiki on Github][netbox-docker-wiki] for further information on how to use this Netbox Docker image properly.
It covers advanced topics such as using secret files, deployment to Kubernetes as well as NAPALM and LDAP configuration. It covers advanced topics such as using files for secrets, deployment to Kubernetes, monitoring and configuring NAPALM or LDAP.
[netbox-docker-wiki]: https://github.com/netbox-community/netbox-docker/wiki/ [netbox-docker-wiki]: https://github.com/netbox-community/netbox-docker/wiki/

View File

@ -27,6 +27,8 @@ services:
- /opt/netbox/netbox/manage.py - /opt/netbox/netbox/manage.py
command: command:
- rqworker - rqworker
# nginx
nginx: nginx:
command: nginx -c /etc/netbox-nginx/nginx.conf command: nginx -c /etc/netbox-nginx/nginx.conf
image: nginx:1.19-alpine image: nginx:1.19-alpine
@ -37,11 +39,15 @@ services:
volumes: volumes:
- netbox-static-files:/opt/netbox/netbox/static:ro - netbox-static-files:/opt/netbox/netbox/static:ro
- netbox-nginx-config:/etc/netbox-nginx/:ro - netbox-nginx-config:/etc/netbox-nginx/:ro
# postgres
postgres: postgres:
image: postgres:12-alpine image: postgres:12-alpine
env_file: env/postgres.env env_file: env/postgres.env
volumes: volumes:
- netbox-postgres-data:/var/lib/postgresql/data - netbox-postgres-data:/var/lib/postgresql/data
# redis
redis: redis:
image: redis:6-alpine image: redis:6-alpine
command: command:
@ -58,6 +64,7 @@ services:
- -c # this is to evaluate the $REDIS_PASSWORD from the env - -c # this is to evaluate the $REDIS_PASSWORD from the env
- redis-server --requirepass $$REDIS_PASSWORD ## $$ because of docker-compose - redis-server --requirepass $$REDIS_PASSWORD ## $$ because of docker-compose
env_file: env/redis-cache.env env_file: env/redis-cache.env
volumes: volumes:
netbox-static-files: netbox-static-files:
driver: local driver: local

View File

@ -6,3 +6,4 @@ errorlog = '-'
accesslog = '-' accesslog = '-'
capture_output = False capture_output = False
loglevel = 'info' loglevel = 'info'
raw_env = 'prometheus_multiproc_dir=/tmp/metrics'

View File

@ -32,4 +32,13 @@ http {
add_header P3P 'CP="ALL DSP COR PSAa PSDa OUR NOR ONL UNI COM NAV"'; add_header P3P 'CP="ALL DSP COR PSAa PSDa OUR NOR ONL UNI COM NAV"';
} }
} }
server {
listen 8081;
access_log off;
location = /stub_status {
stub_status;
}
}
} }

5
env/netbox.env vendored
View File

@ -14,11 +14,12 @@ EMAIL_USE_SSL=false
EMAIL_USE_TLS=false EMAIL_USE_TLS=false
EMAIL_SSL_CERTFILE= EMAIL_SSL_CERTFILE=
EMAIL_SSL_KEYFILE= EMAIL_SSL_KEYFILE=
MAX_PAGE_SIZE=1000
MEDIA_ROOT=/opt/netbox/netbox/media MEDIA_ROOT=/opt/netbox/netbox/media
METRICS_ENABLED=false
NAPALM_USERNAME= NAPALM_USERNAME=
NAPALM_PASSWORD= NAPALM_PASSWORD=
NAPALM_TIMEOUT=10 NAPALM_TIMEOUT=10
MAX_PAGE_SIZE=1000
REDIS_HOST=redis REDIS_HOST=redis
REDIS_PASSWORD=H733Kdjndks81 REDIS_PASSWORD=H733Kdjndks81
REDIS_DATABASE=0 REDIS_DATABASE=0
@ -27,6 +28,7 @@ REDIS_CACHE_HOST=redis-cache
REDIS_CACHE_PASSWORD=t4Ph722qJ5QHeQ1qfu36 REDIS_CACHE_PASSWORD=t4Ph722qJ5QHeQ1qfu36
REDIS_CACHE_DATABASE=1 REDIS_CACHE_DATABASE=1
REDIS_CACHE_SSL=false REDIS_CACHE_SSL=false
RELEASE_CHECK_URL=https://api.github.com/repos/netbox-community/netbox/releases
SECRET_KEY=r8OwDznj!!dci#P9ghmRfdu1Ysxm0AiPeDCQhKE+N_rClfWNj SECRET_KEY=r8OwDznj!!dci#P9ghmRfdu1Ysxm0AiPeDCQhKE+N_rClfWNj
SKIP_STARTUP_SCRIPTS=false SKIP_STARTUP_SCRIPTS=false
SKIP_SUPERUSER=false SKIP_SUPERUSER=false
@ -35,4 +37,3 @@ SUPERUSER_EMAIL=admin@example.com
SUPERUSER_PASSWORD=admin SUPERUSER_PASSWORD=admin
SUPERUSER_API_TOKEN=0123456789abcdef0123456789abcdef01234567 SUPERUSER_API_TOKEN=0123456789abcdef0123456789abcdef01234567
WEBHOOKS_ENABLED=true WEBHOOKS_ENABLED=true
RELEASE_CHECK_URL=https://api.github.com/repos/netbox-community/netbox/releases