netbox-community / netbox-healthcheck-plugin

Apache License 2.0
21 stars 8 forks source link

Support the configuration of django-healthcheck #12

Open jsenecal opened 7 months ago

jsenecal commented 7 months ago

NetBox HealthCheck Plugin version

v0.1.4

NetBox version

v3.7.6

Feature type

New functionality

Proposed functionality

It would be great if the plugin would allow for customization of netbox-healthcheck-plugin configuration parameters.

Use case

For instance, not everyone runs Redis at 127.0.0.1 (the default value), and being allowed to configure REDIS_URL or individual HEALTH_CHECK parameters would be appreciated.

External dependencies

Support for additional parameters may have to be supported by the PluginConfig Class and netbox's settings.py.

rizlas commented 1 month ago

To use the Redis healthcheck, please make sure that there is a variable named REDIS_URL on django.conf.settings with the required format to connect to your redis server. For example:

REDIS_URL = "redis://localhost:6370"

From official doc. Indeed a custom setting is necessary.

grimurd commented 3 weeks ago

There is a simple fix that can be done without modifying any netbox files.

Create the file local_settings.py inside the same folder that has settings.py.

Insert the following:

import os

REDIS_URL = f"redis://{os.environ.get('REDIS_HOST', 'localhost')}:{os.environ.get('REDIS_PORT', '6379')}/{os.environ.get('REDIS_DATABASE', '1')}"

Then restart netbox.