From b2e266d8d3fa061556023ede254d0220d5be4557 Mon Sep 17 00:00:00 2001 From: Dorna Raj Gyawali Date: Wed, 25 Feb 2026 11:24:18 +0545 Subject: [PATCH 1/3] feat: added api health endpoint in GB Signed-off-by: Dorna Raj Gyawali --- docs/GreedyBear/Api-docs.md | 3 +++ docs/GreedyBear/Usage.md | 44 +++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/docs/GreedyBear/Api-docs.md b/docs/GreedyBear/Api-docs.md index 1fb25de5..e947eb10 100644 --- a/docs/GreedyBear/Api-docs.md +++ b/docs/GreedyBear/Api-docs.md @@ -29,6 +29,9 @@ ### `Statistics` :::docs.Submodules.GreedyBear.api.views.statistics.StatisticsViewSet +### `Health` +:::docs.Submodules.GreedyBear.api.views.health.health_view + ## Serializers ### `EnrichmentSerializer` diff --git a/docs/GreedyBear/Usage.md b/docs/GreedyBear/Usage.md index 5afea107..7f119cc3 100644 --- a/docs/GreedyBear/Usage.md +++ b/docs/GreedyBear/Usage.md @@ -164,6 +164,50 @@ This API is protected through authentication. Please reach out [Matteo Lodi](htt - Response (404): Not Found - No matching sessions found +## Health API +_Available from version >= X.X.X_ + +GreedyBear provides a Health API endpoint that allows administrators to monitor the system status and retrieve aggregated statistics. + +The endpoint is reachable through the following URL: + +``` +https:///api/health/ +``` + +### Authentication +This API is accessible **only to admin users**. + +### System Status +The response includes a `system` section with: + +* `database`: `up`, `down`, or `degraded` +* `qcluster`: `up`, `idle`, or `down` +* `elasticsearch`: `up`, `down`, or `not configured` +* `uptime_seconds`: total application uptime in seconds + +### Overview +If the database is operational, the response also includes an `overview` section containing: + +* `iocs`: total and new (last 24h) IOCs +* `sessions`: total and last 24h Cowrie sessions +* `honeypots`: total and active honeypots +* `threat_lists`: counts of firehol, mass scanners, and tor exit nodes +* `jobs`: scheduled jobs and job statistics from Django-Q + +If the database is `down` or `degraded`, the `overview` section will be empty. + +### Responses +* **Response (200)**: JSON object containing: + + * `system` (object): System health information + * `overview` (object): Aggregated statistics (empty if DB is down/degraded) + +* **Response (401)**: Unauthorized – Authentication required + +* **Response (403)**: Forbidden – Admin privileges required + + ### Examples #### Example 1: Query an IP Address with Credentials From 0f4b9288886cd06f524f1b4ad994bfdd15b581db Mon Sep 17 00:00:00 2001 From: Dorna Raj Gyawali Date: Wed, 25 Feb 2026 11:39:44 +0545 Subject: [PATCH 2/3] added version number Signed-off-by: Dorna Raj Gyawali --- docs/GreedyBear/Usage.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/GreedyBear/Usage.md b/docs/GreedyBear/Usage.md index 7f119cc3..856aee11 100644 --- a/docs/GreedyBear/Usage.md +++ b/docs/GreedyBear/Usage.md @@ -165,7 +165,7 @@ This API is protected through authentication. Please reach out [Matteo Lodi](htt ## Health API -_Available from version >= X.X.X_ +_Available from version >= 3.1.0_ GreedyBear provides a Health API endpoint that allows administrators to monitor the system status and retrieve aggregated statistics. From 6ccc27006e4b2c3bec897f4af2970a2106b22de7 Mon Sep 17 00:00:00 2001 From: Dorna Raj Gyawali Date: Wed, 25 Feb 2026 14:33:52 +0545 Subject: [PATCH 3/3] added 3.2.0 version Signed-off-by: Dorna Raj Gyawali --- docs/GreedyBear/Usage.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/GreedyBear/Usage.md b/docs/GreedyBear/Usage.md index 856aee11..7e8b9855 100644 --- a/docs/GreedyBear/Usage.md +++ b/docs/GreedyBear/Usage.md @@ -165,7 +165,7 @@ This API is protected through authentication. Please reach out [Matteo Lodi](htt ## Health API -_Available from version >= 3.1.0_ +_Available from version >= 3.2.0_ GreedyBear provides a Health API endpoint that allows administrators to monitor the system status and retrieve aggregated statistics.