Skip to content

Commit

Permalink
have mapi/ready use netbox health check api
Browse files Browse the repository at this point in the history
  • Loading branch information
mmguero committed Nov 4, 2024
1 parent b9750d7 commit 9756b44
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions api/project/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1012,7 +1012,7 @@ def ready():
print(f"{type(e).__name__}: {str(e)} getting Logstash lumberjack listener status")

try:
netboxStatus = requests.get(f'{netboxUrl}/api/status').json()
netboxStatus = requests.get(f'{netboxUrl}/plugins/netbox_healthcheck_plugin/healthcheck/?format=json').json()
except Exception as e:
netboxStatus = {}
if debugApi:
Expand Down Expand Up @@ -1062,7 +1062,11 @@ def ready():
pipeline in malcolm_utils.deep_get(logstashStats, ["pipelines"], {})
for pipeline in logstash_default_pipelines
),
netbox=bool(malcolm_utils.deep_get(netboxStatus, ["netbox-version"])),
netbox=bool(
isinstance(netboxStatus, dict)
and netboxStatus
and all(value == "working" for value in netboxStatus.values())
),
opensearch=(malcolm_utils.deep_get(openSearchHealth, ["status"], 'red') != "red"),
pcap_monitor=pcapMonitorStatus,
zeek_extracted_file_logger=zeekExtractedFileLoggerStatus,
Expand Down

0 comments on commit 9756b44

Please sign in to comment.