diff --git a/CHANGELOG.md b/CHANGELOG.md index 1afc5d260..57093ad74 100644 --- a/CHANGELOG.md +++ b/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. +See the documentation for more details on using Prometheus metrics in NetBox. + ## Changes ### New Dependency: Redis diff --git a/docs/additional-features/prometheus-metrics.md b/docs/additional-features/prometheus-metrics.md index a472dc7a9..840b7b51e 100644 --- a/docs/additional-features/prometheus-metrics.md +++ b/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 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 +``` diff --git a/docs/configuration/optional-settings.md b/docs/configuration/optional-settings.md index b5cf79749..efa753d7b 100644 --- a/docs/configuration/optional-settings.md +++ b/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 -Default: True +Default: False Toggle exposing Prometheus metrics at `/metrics`. See the [Prometheus Metrics](../additional-features/prometheus-metrics/) documentation for more details. diff --git a/netbox/netbox/configuration.example.py b/netbox/netbox/configuration.example.py index 6eda8a666..0de3e199e 100644 --- a/netbox/netbox/configuration.example.py +++ b/netbox/netbox/configuration.example.py @@ -130,7 +130,7 @@ MAX_PAGE_SIZE = 1000 # MEDIA_ROOT = '/opt/netbox/netbox/media' # 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. NAPALM_USERNAME = '' diff --git a/netbox/netbox/settings.py b/netbox/netbox/settings.py index 199cd906e..b29e70701 100644 --- a/netbox/netbox/settings.py +++ b/netbox/netbox/settings.py @@ -77,7 +77,7 @@ LOGIN_TIMEOUT = getattr(configuration, 'LOGIN_TIMEOUT', None) MAINTENANCE_MODE = getattr(configuration, 'MAINTENANCE_MODE', False) MAX_PAGE_SIZE = getattr(configuration, 'MAX_PAGE_SIZE', 1000) 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_PASSWORD = getattr(configuration, 'NAPALM_PASSWORD', '') NAPALM_TIMEOUT = getattr(configuration, 'NAPALM_TIMEOUT', 30) @@ -377,6 +377,7 @@ CACHEOPS_DEGRADE_ON_FAILURE = True # # Django Prometheus # + PROMETHEUS_EXPORT_MIGRATIONS = False