From 546010acad2fd18bf3fd463f53ec7cc4ead1ea5f Mon Sep 17 00:00:00 2001 From: Emmanuel Vasilakis <mrzammler@mm.st> Date: Tue, 24 May 2022 13:35:46 +0300 Subject: [PATCH] Return rc->last_update from alarms_values api (#12968) * add rc last_update as when in alarms values api * rename when to last_updated * update swagger --- health/health_json.c | 4 ++++ web/api/netdata-swagger.json | 6 +++++- web/api/netdata-swagger.yaml | 5 ++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/health/health_json.c b/health/health_json.c index 8d08407b98..d5285c11e7 100644 --- a/health/health_json.c +++ b/health/health_json.c @@ -165,6 +165,10 @@ static inline void health_rrdcalc_values2json_nolock(RRDHOST *host, BUFFER *wb, buffer_rrd_value(wb, rc->value); buffer_strcat(wb, ",\n"); + buffer_strcat(wb, "\t\t\t\"last_updated\":"); + buffer_sprintf(wb, "%lu", (unsigned long)rc->last_updated); + buffer_strcat(wb, ",\n"); + buffer_sprintf(wb, "\t\t\t\"status\": \"%s\"\n" , rrdcalc_status2string(rc->status)); diff --git a/web/api/netdata-swagger.json b/web/api/netdata-swagger.json index b647fd7f12..97427d3237 100644 --- a/web/api/netdata-swagger.json +++ b/web/api/netdata-swagger.json @@ -908,7 +908,7 @@ "/alarms_values": { "get": { "summary": "Get a list of active or raised alarms on the server", - "description": "The alarms_values endpoint returns the list of all raised or enabled alarms on the netdata server. Called without any parameters, the raised alarms in state WARNING or CRITICAL are returned. By passing \"?all\", all the enabled alarms are returned. This option output differs from `/alarms` in the number of variables delivered. This endpoint gives to user `id`, `value` and alarm `status`.", + "description": "The alarms_values endpoint returns the list of all raised or enabled alarms on the netdata server. Called without any parameters, the raised alarms in state WARNING or CRITICAL are returned. By passing \"?all\", all the enabled alarms are returned. This option output differs from `/alarms` in the number of variables delivered. This endpoint gives to user `id`, `value`, `last_updated` time and alarm `status`.", "parameters": [ { "name": "all", @@ -2109,6 +2109,10 @@ "value": { "type": "integer" }, + "last_updated": { + "type": "integer", + "format": "int32" + }, "status": { "type": "string", "enum": [ diff --git a/web/api/netdata-swagger.yaml b/web/api/netdata-swagger.yaml index b90624ef02..96920375e1 100644 --- a/web/api/netdata-swagger.yaml +++ b/web/api/netdata-swagger.yaml @@ -745,7 +745,7 @@ paths: state WARNING or CRITICAL are returned. By passing "?all", all the enabled alarms are returned. This option output differs from `/alarms` in the number of variables delivered. This endpoint gives - to user `id`, `value` and alarm `status`. + to user `id`, `value`, `last_updated` time, and alarm `status`. parameters: - name: all in: query @@ -1650,6 +1650,9 @@ components: type: integer value: type: integer + last_updated: + type: integer + format: int32 status: type: string enum: