Forráskód Böngészése

closes #3161 - prometheus env var docs and set prometheus to not be enabled by default

John Anderson 6 éve
szülő
commit
ce9f7a8ddc

+ 2 - 0
CHANGELOG.md

@@ -107,6 +107,8 @@ different types of metrics, including:
 
 
 For the exhaustive list of exposed metrics, visit the `/metrics` endpoint on your NetBox instance.
 For the exhaustive list of exposed metrics, visit the `/metrics` endpoint on your NetBox instance.
 
 
+See the documentation for more details on using Prometheus metrics in NetBox.
+
 ## Changes
 ## Changes
 
 
 ### New Dependency: Redis
 ### New Dependency: Redis

+ 12 - 0
docs/additional-features/prometheus-metrics.md

@@ -20,3 +20,15 @@ NetBox makes use of the [django-prometheus](https://github.com/korfuri/django-pr
 - Other Django related metadata metrics
 - Other Django related metadata metrics
 
 
 For the exhaustive list of exposed metrics, visit the `/metrics` endpoint on your NetBox instance.
 For the exhaustive list of exposed metrics, visit the `/metrics` endpoint on your NetBox instance.
+
+## Multi Processing Notes
+
+When deploying NetBox in a multiprocess mannor--such as using Gunicorn as recomented in the installation docs--the Prometheus client library requires the use of shared directory
+to collect metrics from all processes. This can be any arbitrary directory to which the processes have read/write access. This directory is then made available by use of the
+`prometheus_multiproc_dir` environment variable.
+
+This can be setup by first creating a shared directory and then adding this line to the `[program:netbox]` section of the supervisor config file.
+
+```
+environment=prometheus_multiproc_dir=/tmp/prometheus_metrics
+```

+ 1 - 1
docs/configuration/optional-settings.md

@@ -199,7 +199,7 @@ The file path to the location where media files (such as image attachments) are
 
 
 ## METRICS_ENABLED
 ## METRICS_ENABLED
 
 
-Default: True
+Default: False
 
 
 Toggle exposing Prometheus metrics at `/metrics`. See the [Prometheus Metrics](../additional-features/prometheus-metrics/) documentation for more details.
 Toggle exposing Prometheus metrics at `/metrics`. See the [Prometheus Metrics](../additional-features/prometheus-metrics/) documentation for more details.
 
 

+ 1 - 1
netbox/netbox/configuration.example.py

@@ -130,7 +130,7 @@ MAX_PAGE_SIZE = 1000
 # MEDIA_ROOT = '/opt/netbox/netbox/media'
 # MEDIA_ROOT = '/opt/netbox/netbox/media'
 
 
 # Expose Prometheus monitoring metrics at the HTTP endpoint '/metrics'
 # Expose Prometheus monitoring metrics at the HTTP endpoint '/metrics'
-METRICS_ENABLED = True
+METRICS_ENABLED = False
 
 
 # Credentials that NetBox will uses to authenticate to devices when connecting via NAPALM.
 # Credentials that NetBox will uses to authenticate to devices when connecting via NAPALM.
 NAPALM_USERNAME = ''
 NAPALM_USERNAME = ''

+ 2 - 1
netbox/netbox/settings.py

@@ -77,7 +77,7 @@ LOGIN_TIMEOUT = getattr(configuration, 'LOGIN_TIMEOUT', None)
 MAINTENANCE_MODE = getattr(configuration, 'MAINTENANCE_MODE', False)
 MAINTENANCE_MODE = getattr(configuration, 'MAINTENANCE_MODE', False)
 MAX_PAGE_SIZE = getattr(configuration, 'MAX_PAGE_SIZE', 1000)
 MAX_PAGE_SIZE = getattr(configuration, 'MAX_PAGE_SIZE', 1000)
 MEDIA_ROOT = getattr(configuration, 'MEDIA_ROOT', os.path.join(BASE_DIR, 'media')).rstrip('/')
 MEDIA_ROOT = getattr(configuration, 'MEDIA_ROOT', os.path.join(BASE_DIR, 'media')).rstrip('/')
-METRICS_ENABLED = getattr(configuration, 'METRICS_ENABLED', True)
+METRICS_ENABLED = getattr(configuration, 'METRICS_ENABLED', False)
 NAPALM_ARGS = getattr(configuration, 'NAPALM_ARGS', {})
 NAPALM_ARGS = getattr(configuration, 'NAPALM_ARGS', {})
 NAPALM_PASSWORD = getattr(configuration, 'NAPALM_PASSWORD', '')
 NAPALM_PASSWORD = getattr(configuration, 'NAPALM_PASSWORD', '')
 NAPALM_TIMEOUT = getattr(configuration, 'NAPALM_TIMEOUT', 30)
 NAPALM_TIMEOUT = getattr(configuration, 'NAPALM_TIMEOUT', 30)
@@ -377,6 +377,7 @@ CACHEOPS_DEGRADE_ON_FAILURE = True
 #
 #
 # Django Prometheus
 # Django Prometheus
 #
 #
+
 PROMETHEUS_EXPORT_MIGRATIONS = False
 PROMETHEUS_EXPORT_MIGRATIONS = False