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
Emmanuel Vasilakis committed
May 24, 2022 at 13:35 UTC
546010acad2fd18bf3fd463f53ec7cc4ead1ea5f
3 files changed
+13
-2
health/health_json.c
+4
@@ -165,6 +165,10 @@ static inline void health_rrdcalc_values2json_nolock(RRDHOST *host, BUFFER *wb,
165
buffer_rrd_value(wb, rc->value);
166
buffer_strcat(wb, ",\n");
167
168
+ buffer_strcat(wb, "\t\t\t\"last_updated\":");
169
+ buffer_sprintf(wb, "%lu", (unsigned long)rc->last_updated);
170
+ buffer_strcat(wb, ",\n");
171
+
172
buffer_sprintf(wb,
173
"\t\t\t\"status\": \"%s\"\n"
174
, rrdcalc_status2string(rc->status));
web/api/netdata-swagger.json
+5
-1
@@ -908,7 +908,7 @@
908
"/alarms_values": {
909
"get": {
910
"summary": "Get a list of active or raised alarms on the server",
911
- "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`.",
911
+ "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`.",
912
"parameters": [
913
{
914
"name": "all",
@@ -2109,6 +2109,10 @@
2109
"value": {
2110
"type": "integer"
2111
},
2112
+ "last_updated": {
2113
+ "type": "integer",
2114
+ "format": "int32"
2115
+ },
2116
"status": {
2117
"type": "string",
2118
"enum": [
web/api/netdata-swagger.yaml
+4
-1
@@ -745,7 +745,7 @@ paths:
745
state WARNING or CRITICAL are returned. By passing "?all", all the
746
enabled alarms are returned.
747
This option output differs from `/alarms` in the number of variables delivered. This endpoint gives
748
- to user `id`, `value` and alarm `status`.
748
+ to user `id`, `value`, `last_updated` time, and alarm `status`.
749
parameters:
750
- name: all
751
in: query
@@ -1650,6 +1650,9 @@ components:
1650
type: integer
1651
value:
1652
type: integer
1653
+ last_updated:
1654
+ type: integer
1655
+ format: int32
1656
status:
1657
type: string
1658
enum: