Integrate healthcheck in netbox #6189

Closed
opened 2025-12-29 19:37:50 +01:00 by adam · 9 comments
Owner

Originally created by @jcralbino on GitHub (Mar 9, 2022).

Originally assigned to: @arthanson on GitHub.

NetBox version

v3.1.9

Feature type

New functionality

Proposed functionality

In order to improve the monitoring of the netbox infrastructure key components we may be able to leverage the app django-health-check

Using a dedicated url https://netbox.fqdn/healthcheck we will be able to perform health checks in the applications required to run netbox and eventually its monitoring.

We should be able to check:

  • status of DB
  • status of Redis and queues
  • status of nginx

other relevant metrics

Use case

Adding a healthcheck endpoint that is able to validate the status of the database , Nginx service and redis service will provide the necessary information required by admins to confirm that the service is running in good condition

This is of particular relevance within distributed environment like kubernettes

The information provided in this endpoint can be then consumed via api. Relevant values can be

  • dBstatus : can identify that dB is working and replying to queries from the application
  • redisstatus : can identify that redis is operating well and caching is occurring
  • nginx : can identify if service is providing functional

Database changes

No response

External dependencies

_No response_is

Originally created by @jcralbino on GitHub (Mar 9, 2022). Originally assigned to: @arthanson on GitHub. ### NetBox version v3.1.9 ### Feature type New functionality ### Proposed functionality In order to improve the monitoring of the netbox infrastructure key components we may be able to leverage the app [django-health-check](https://github.com/KristianOellegaard/django-health-check) Using a dedicated url <https://netbox.fqdn/healthcheck> we will be able to perform health checks in the applications required to run netbox and eventually its monitoring. We should be able to check: - status of DB - status of Redis and queues - status of nginx other relevant metrics ### Use case Adding a healthcheck endpoint that is able to validate the status of the database , Nginx service and redis service will provide the necessary information required by admins to confirm that the service is running in good condition This is of particular relevance within distributed environment like kubernettes The information provided in this endpoint can be then consumed via api. Relevant values can be - dBstatus : can identify that dB is working and replying to queries from the application - redisstatus : can identify that redis is operating well and caching is occurring - nginx : can identify if service is providing functional ### Database changes _No response_ ### External dependencies _No response_is
adam added the status: acceptedtype: feature labels 2025-12-29 19:37:50 +01:00
adam closed this issue 2025-12-29 19:37:51 +01:00
Author
Owner

@jeremystretch commented on GitHub (Mar 28, 2022):

Improve the monitoring of the environment running netbox

We're going to need a more substantial explanation of the use case here, especially if the proposal is to introduce a new dependency. Please elaborate on the specific features you'd like to see and why.

@jeremystretch commented on GitHub (Mar 28, 2022): > Improve the monitoring of the environment running netbox We're going to need a more substantial explanation of the use case here, especially if the proposal is to introduce a new dependency. Please elaborate on the specific features you'd like to see and why.
Author
Owner

@okamidash commented on GitHub (Mar 28, 2022):

I'm not the original issue creator, but I want to throw my hat into the ring.
Adding a healthcheck endpoint would allow admins using netbox in distributed deployments (such as Kubernetes) to be able to monitor the health and readiness of an application in a more realistic manner.

As it currently stands, there is no way of knowing whether netbox can accept requests, beyond a tcp socket being open. That doesn't inspire much confidence in the application, regardless of it's actual state.

Please implement this, if you have the time :3

@okamidash commented on GitHub (Mar 28, 2022): I'm not the original issue creator, but I want to throw my hat into the ring. Adding a healthcheck endpoint would allow admins using netbox in distributed deployments (such as Kubernetes) to be able to monitor the health and readiness of an application in a more realistic manner. As it currently stands, there is no way of knowing whether netbox can accept requests, beyond a tcp socket being open. That doesn't inspire much confidence in the application, regardless of it's actual state. Please implement this, if you have the time :3
Author
Owner

@jcralbino commented on GitHub (Mar 29, 2022):

Hello
Thanks for looking into this
In our setup that is using a distributed environment where db and redis is running in a separate virtual machine having this endpoint will simplify our monitoring of this service

I have updated the description of the use case

@jcralbino commented on GitHub (Mar 29, 2022): Hello Thanks for looking into this In our setup that is using a distributed environment where db and redis is running in a separate virtual machine having this endpoint will simplify our monitoring of this service I have updated the description of the use case
Author
Owner

@github-actions[bot] commented on GitHub (May 29, 2022):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Please see our contributing guide.

@github-actions[bot] commented on GitHub (May 29, 2022): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Please see our [contributing guide](https://github.com/netbox-community/netbox/blob/develop/CONTRIBUTING.md).
Author
Owner

@riconem commented on GitHub (Aug 19, 2022):

Hey,
is there any progress on this feature?

This feature would be great to monitor the status of the netbox and their dependencies.

In our setup sometimes we have connection issues. But it's hard to say where this issues comes from. With this feature we could simply see if its any failure of the netbox setup or other network elements.

@riconem commented on GitHub (Aug 19, 2022): Hey, is there any progress on this feature? This feature would be great to monitor the status of the netbox and their dependencies. In our setup sometimes we have connection issues. But it's hard to say where this issues comes from. With this feature we could simply see if its any failure of the netbox setup or other network elements.
Author
Owner

@jeremystretch commented on GitHub (Nov 3, 2022):

We discussed this a bit more in today's maintainers meeting, and the consensus was that a plugin would be a slightly better fit. The primary rationale for this decision was that some subset of users inevitably will want to disable the functionality, and our approach to date of providing a toggle in the form of a configuration parameter is something of an anti-pattern.

Packaging this as a plugin (which is now possible in v3.4 per #9880) has the advantage of allowing users to introduce the new functionality as desired. It might also prompt heightened interested versus a core feature, as plugins are much more accessible to the casual contributor.

@arthanson are you still volunteering to own the plugin creation?

@jeremystretch commented on GitHub (Nov 3, 2022): We discussed this a bit more in today's maintainers meeting, and the consensus was that a plugin would be a slightly better fit. The primary rationale for this decision was that some subset of users inevitably will want to disable the functionality, and our approach to date of providing a toggle in the form of a configuration parameter is something of an anti-pattern. Packaging this as a plugin (which is now possible in v3.4 per #9880) has the advantage of allowing users to introduce the new functionality as desired. It might also prompt heightened interested versus a core feature, as plugins are _much_ more accessible to the casual contributor. @arthanson are you still volunteering to own the plugin creation?
Author
Owner

@stavros-k commented on GitHub (Nov 4, 2022):

@jeremystretch Continuing from #10825

I'm working on a helm chart, for TrueNAS Scale catalog.

Healthchecks are needed for:

  • Easy testing on CI when upgrade releases.
  • Make sure pods/containers are healthy, if not restart them (k8s feature).

It does not have to be an http endpoint.
Even a binary or a script in the container that exits with 0 if everything is fine or 1 if not would be enough.

Healthcheck should be available for worker as well.
I guess for the main container you can hit the /login and see if it's up.

For housekeeper, I don't think currently there is a way to health check it.
As it's an infnite loop.
If it crashes, container will exit and k8s will restart it anyway.

@stavros-k commented on GitHub (Nov 4, 2022): @jeremystretch Continuing from #10825 I'm working on a helm chart, for TrueNAS Scale catalog. Healthchecks are needed for: - Easy testing on CI when upgrade releases. - Make sure pods/containers are healthy, if not restart them (k8s feature). It does not have to be an http endpoint. Even a binary or a script in the container that exits with 0 if everything is fine or 1 if not would be enough. Healthcheck should be available for worker as well. I guess for the main container you can hit the `/login` and see if it's up. For housekeeper, I don't think currently there is a way to health check it. As it's an infnite loop. If it crashes, container will exit and k8s will restart it anyway.
Author
Owner

@tobiasge commented on GitHub (Dec 16, 2022):

We added some health checks into the docker-compose.yml in the last release.
Those also work in Openshift were I use the containers. So you can reuse them in the Helm chart.

@tobiasge commented on GitHub (Dec 16, 2022): We added some health checks into the [docker-compose.yml](https://github.com/netbox-community/netbox-docker/blob/release/docker-compose.yml) in the last release. Those also work in Openshift were I use the containers. So you can reuse them in the Helm chart.
Author
Owner

@arthanson commented on GitHub (Feb 17, 2023):

Closing as completed a healthcheck plugin: https://github.com/netbox-community/netbox-healthcheck-plugin please add any feature requests or issues there.

@arthanson commented on GitHub (Feb 17, 2023): Closing as completed a healthcheck plugin: https://github.com/netbox-community/netbox-healthcheck-plugin please add any feature requests or issues there.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#6189