Skip to content

Commit

Permalink
added netbox healthcheck plugin (https://github.com/netbox-community/…
Browse files Browse the repository at this point in the history
  • Loading branch information
mmguero committed Nov 4, 2024
1 parent 60b0128 commit b9750d7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Dockerfiles/netbox.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ ENV SUPERCRONIC_CRONTAB "/etc/crontab"

ENV NETBOX_INITIALIZERS_VERSION "50d077d"
ENV NETBOX_TOPOLOGY_VERSION "4.0.1"
ENV NETBOX_HEALTHCHECK_VERSION "0.2.0"

ENV YQ_VERSION "4.44.3"
ENV YQ_URL "https://github.com/mikefarah/yq/releases/download/v${YQ_VERSION}/yq_linux_"
Expand Down Expand Up @@ -86,6 +87,7 @@ RUN export BINARCH=$(uname -m | sed 's/x86_64/amd64/' | sed 's/aarch64/arm64/')
"${NETBOX_PATH}/venv/bin/python" -m pip install --break-system-packages --no-compile --no-cache-dir \
"git+https://github.com/tobiasge/netbox-initializers@${NETBOX_INITIALIZERS_VERSION}" \
"git+https://github.com/netbox-community/netbox-topology-views@v${NETBOX_TOPOLOGY_VERSION}" \
"git+https://github.com/netbox-community/netbox-healthcheck-plugin@v${NETBOX_HEALTHCHECK_VERSION}" \
psycopg2 \
pynetbox \
python-magic \
Expand Down
11 changes: 11 additions & 0 deletions netbox/scripts/netbox_install_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,17 @@ def main():
netboxVenvPy = os.path.join(os.path.join(os.path.join(args.netboxDir, 'venv'), 'bin'), 'python')
manageScript = os.path.join(os.path.join(args.netboxDir, 'netbox'), 'manage.py')

# set a variable in local_settings.py for netbox-helathcheck-plugin
# see https://github.com/netbox-community/netbox-healthcheck-plugin/issues/12#issuecomment-2451665212
netboxSettingsPyDir = os.path.join(args.netboxDir, os.path.join('netbox', 'netbox'))
if os.path.isdir(netboxSettingsPyDir):
try:
localSettingsPyContents = "import os\n\nREDIS_URL = f\"redis://{os.environ.get('REDIS_USERNAME', '')}:{os.environ.get('REDIS_PASSWORD', '')}@{os.environ.get('REDIS_HOST', 'netbox-redis')}:{os.environ.get('REDIS_PORT', '6379')}/{os.environ.get('REDIS_DATABASE', '0')}\"\n"
with open(f"{netboxSettingsPyDir}/local_settings.py", 'w') as f:
f.write(localSettingsPyContents)
except Exception as e:
logging.error(f"{type(e).__name__} writing local_settings.py: {e}")

if os.path.isdir(args.customPluginsDir) and os.path.isfile(os.path.join(args.netboxConfigDir, 'plugins.py')):

# get a list of what packages/plugins already installed (package names and versions in a dict)
Expand Down

0 comments on commit b9750d7

Please sign in to comment.