diff --git a/base_requirements.txt b/base_requirements.txt index 4032bc26e..3a6333d19 100644 --- a/base_requirements.txt +++ b/base_requirements.txt @@ -22,6 +22,10 @@ django-filter # https://github.com/flavors/django-graphiql-debug-toolbar/ django-graphiql-debug-toolbar +# Runs health check on installed applications +# https://github.com/revsys/django-health-check +django-health-check + # Modified Preorder Tree Traversal (recursive nesting of objects) # https://github.com/django-mptt/django-mptt django-mptt diff --git a/docs/integrations/health-check.md b/docs/integrations/health-check.md new file mode 100644 index 000000000..a8bb572dd --- /dev/null +++ b/docs/integrations/health-check.md @@ -0,0 +1,10 @@ +# Health Check + +NetBox provides health check monitors that can be queried to make sure that the service is running in good condition. + +NetBox exposes metrics at the `/healthcheck` HTTP endpoint, e.g. `https://netbox.local/healthcheck`. It allows monitor conditions via HTTP(S), with responses available in HTML and JSON formats. + + +## Setting up Monitoring + +NetBox makes use of the [django-health-check](https://github.com/revsys/django-health-check) library, more information on setting up monitors can be found at [Setting up Monitoring](https://django-health-check.readthedocs.io/en/latest/readme.html#setting-up-monitoring): diff --git a/mkdocs.yml b/mkdocs.yml index 011d4414f..6985b1b88 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -117,6 +117,7 @@ nav: - Webhooks: 'integrations/webhooks.md' - NAPALM: 'integrations/napalm.md' - Prometheus Metrics: 'integrations/prometheus-metrics.md' + - Health Checks: 'integrations/health-check.md' - Plugins: - Using Plugins: 'plugins/index.md' - Developing Plugins: diff --git a/netbox/netbox/settings.py b/netbox/netbox/settings.py index 1046812e8..bbfe14753 100644 --- a/netbox/netbox/settings.py +++ b/netbox/netbox/settings.py @@ -314,6 +314,10 @@ INSTALLED_APPS = [ 'django_tables2', 'django_prometheus', 'graphene_django', + 'health_check', + 'health_check.db', + 'health_check.contrib.migrations', + 'health_check.contrib.redis', 'mptt', 'rest_framework', 'social_django', diff --git a/netbox/netbox/urls.py b/netbox/netbox/urls.py index e8ee4b7b6..889581321 100644 --- a/netbox/netbox/urls.py +++ b/netbox/netbox/urls.py @@ -81,6 +81,7 @@ _patterns = [ path('admin/background-tasks/', include('django_rq.urls')), path('admin/plugins/', include(plugin_admin_patterns)), path('admin/', admin_site.urls), + path('healthcheck/', include('health_check.urls')), ] diff --git a/requirements.txt b/requirements.txt index 8d748cb82..13546d68c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,6 +4,7 @@ django-cors-headers==3.13.0 django-debug-toolbar==3.7.0 django-filter==22.1 django-graphiql-debug-toolbar==0.2.0 +django-health-check==3.17.0 django-mptt==0.14 django-pglocks==1.0.4 django-prometheus==2.2.0