summaryrefslogtreecommitdiffstats
path: root/src/health/schema.d/health:alert:prototype.json
blob: 115b3c2f9da30e99f0f71476d7c8f7cda9dd9aa1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
{
  "jsonSchema": {
    "$schema": "http://json-schema.org/draft-07/schema#",
    "definitions": {
      "matchInstanceLabels": {
        "type": "string",
        "default": "*",
        "title": "Only for instances with these labels"
      },
      "matchHostLabels": {
        "type": "string",
        "default": "*",
        "title": "Only for nodes with these host labels"
      },
      "matchInstance": {
        "type": "object",
        "title": "Apply this rule to a single instance",
        "description": "This is a single alert rule that will be applied to the specific instance on all nodes hosted on this Netdata.",
        "properties": {
          "on": {
            "type": "string",
            "default": "",
            "title": "The instance this rule should be applied to.",
            "description": "You can find the instance names on all charts at the instances drop down menu. Do not include the host name in this field."
          },
          "host_labels": { "$ref": "#/definitions/matchHostLabels" },
          "instance_labels": { "$ref": "#/definitions/matchInstanceLabels" }
        },
        "required": [
          "on",
          "host_labels",
          "instance_labels"
        ]
      },
      "matchTemplate": {
        "type": "object",
        "title": "Apply this rule to all instances of a context",
        "description": "This rule defines a template, that will apply this alert to all instances (e.g. disks, network interfaces, nginx servers, etc) on all nodes hosted on this Netdata.",
        "properties": {
          "on": {
            "type": "string",
            "default": "",
            "title": "The context of the instances this rule should be applied to.",
            "description": "The context is the code-name of each chart on the dashboard, that appears at the chart title bar, between the chart title and its unit of measurement, like: system.cpu, disk.io, etc."
          },
          "host_labels": { "$ref": "#/definitions/matchHostLabels" },
          "instance_labels": { "$ref": "#/definitions/matchInstanceLabels" }
        },
        "required": [
          "on",
          "host_labels",
          "instance_labels"
        ]
      },
      "configSummary": {
        "type": "string",
        "title": "Short description of the alert",
        "description": "This field is used in notification as a short description of the alert. Variables, like ${label:key}, are replaced with the value of instance label called 'key'."
      },
      "configInfo": {
        "type": "string",
        "title": "Long description of the alert",
        "description": "This field is used to provide enough information about the type and nature of the alert. Variables, like ${label:key}, are replaced with the value of instance label called 'key'."
      },
      "configType": {
        "type": "string",
        "title": "Alert Type",
        "description": "Use categories like: 'System', 'Containers', 'Web Servers', 'Message Brokers', etc."
      },
      "configComponent": {
        "type": "string",
        "title": "Alert Component",
        "description": "Component is a sub-type of Alert Type. Examples: 'CPU', 'Memory', 'Network', 'Disk', 'Hardware', 'nginx', 'redis', 'postgresql', etc."
      },
      "configClassification": {
        "type": "string",
        "title": "Classification",
        "description": "Use 'Workload', 'Utilization', 'Latency', 'Availability', 'Errors', etc."
      },
      "configValue": {
        "type": "object",
        "title": "",
        "description": "Each alert has a value. This section defines how this value is calculated.",
        "properties": {
          "database_lookup": {
            "type": "object",
            "title": "Database Query to Get Value",
            "description": "The database query to be executed to calculate the value of the alert. When set, the query is executed before any other calculations. The result of the query will be available as $this in further calculations.",
            "properties": {
              "data_source": {
                "type": "string",
                "oneOf": [
                  { "const": "samples", "title": "Samples", "description": "Use the time-series values for each dimension" },
                  { "const": "percentages", "title": "Percentages", "description": "Use the percentage of each dimension vs the sum of all dimensions" },
                  { "const": "anomalies", "title": "Anomalies", "description": "Use the anomaly rate of each dimension" }
                ],
                "default": "samples",
                "title": " ",
                "description": ""
              },
              "time_group": {
                "type": "string",
                "oneOf": [
                  { "const": "average", "title": "Average" },
                  { "const": "median", "title": "Median" },
                  { "const": "min", "title": "Minimum" },
                  { "const": "max", "title": "Maximum" },
                  { "const": "sum", "title": "Sum" },
                  { "const": "incremental_sum", "title": "Incremental Sum" },
                  { "const": "stddev", "title": "Standard Deviation" },
                  { "const": "cv", "title": "Coefficient of Variation" },
                  { "const": "trimmed-mean", "title": "Trimmed Mean" },
                  { "const": "trimmed-median", "title": "Trimmed Median" },
                  { "const": "percentile", "title": "Percentile" },
                  { "const": "ses", "title": "Simple Exponential Smoothing" },
                  { "const": "des", "title": "Double Exponential Smoothing" },
                  { "const": "countif", "title": "Count If" }
                ],
                "default": "average",
                "title": "Time Aggregation",
                "description": ""
              },
              "after": {
                "type": "integer",
                "default": -600,
                "title": "From",
                "description": "Relative to 'To'"
              },
              "before": {
                "type": "integer",
                "default": 0,
                "title": "To",
                "description": "Ending timestamp"
              },
              "dims_group": {
                "type": "string",
                "oneOf": [
                  { "const": "average", "title": "Average", "description": "The average of all dimensions" },
                  { "const": "min", "title": "Minimum", "description": "The minimum of all dimensions" },
                  { "const": "max", "title": "Maximum", "description": "The maximum of all dimensions" },
                  { "const": "sum", "title": "Sum", "description": "The sum of all dimensions" },
                  { "const": "min2max", "title": "Min-to-Max", "description": "The delta between the minimum of the maximum of the dimensions" }
                ],
                "default": "sum",
                "title": "Dims Aggregation",
                "description": "on dimensions"
              },
              "dimensions": {
                "type": "string",
                "title": "Dimensions",
                "description": "Simple pattern",
                "default": "*"
              },
              "options": {
                "type": "array",
                "title": "Time-Series Query options",
                "description": "Options affecting the way the value is calculated",
                "uniqueItems": true,
                "items": {
                  "oneOf": [
                    { "const":  "unaligned", "title": "Do not shift the time-frame for visual presentation" },
                    { "const":  "abs", "title": "Make all values positive before using them" },
                    { "const":  "null2zero", "title": "Treat gaps in the time-series as a zero value" },
                    { "const":  "match_ids", "title": "Match only dimension IDs, not Names" },
                    { "const":  "match_names", "title": "Match only dimension Names, not IDs" }
                  ]
                },
                "default": [ "unaligned" ]
              }
            },
            "allOf": [
              {
                "if": {
                  "properties": {
                    "time_group": {
                      "enum": ["trimmed-mean"]
                    }
                  }
                },
                "then": {
                  "properties": {
                    "time_group_value": {
                      "type": "integer",
                      "default": 1,
                      "title": "Trim %",
                      "description": ""
                    }
                  },
                  "required": ["time_group_value"]
                }
              },
              {
                "if": {
                  "properties": {
                    "time_group": {
                      "enum": ["trimmed-median"]
                    }
                  }
                },
                "then": {
                  "properties": {
                    "time_group_value": {
                      "type": "integer",
                      "default": 1,
                      "title": "Trim %",
                      "description": ""
                    }
                  },
                  "required": ["time_group_value"]
                }
              },
              {
                "if": {
                  "properties": {
                    "time_group": {
                      "enum": ["percentile"]
                    }
                  }
                },
                "then": {
                  "properties": {
                    "time_group_value": {
                      "type": "integer",
                      "default": 95,
                      "title": "Percentage",
                      "description": ""
                    }
                  },
                  "required": ["time_group_value"]
                }
              },
              {
                "if": {
                  "properties": {
                    "time_group": {
                      "const": "countif"
                    }
                  }
                },
                "then": {
                  "properties": {
                    "time_group_condition": {
                      "type": "string",
                      "oneOf": [
                        { "const": "!=", "title": "!=" },
                        { "const": "=", "title": "==" },
                        { "const": ">=", "title": ">=" },
                        { "const": ">", "title": ">" },
                        { "const": "<=", "title": "<=" },
                        { "const": "<", "title": "<" }
                      ],
                      "default": "equal",
                      "title": "Condition",
                      "description": ""
                    },
                    "time_group_value": {
                      "type": "number",
                      "default": 1,
                      "title": "Value to match",
                      "description": ""
                    }
                  },
                  "required": ["time_group_condition", "time_group_value"]
                }
              }
            ]
          },
          "calculation": {
            "type": "string",
            "title": "Calculation",
            "description": "An expression to transform the value"
          },
          "units": {
            "type": "string",
            "title": "Unit",
            "description": "of measurement"
          }
        }
      },
      "configConditions": {
        "type": "object",
        "title": "",
        "properties": {
          "warning_condition": {
            "type": "string",
            "title": "Warning Expression",
            "description": "The alert value is available as '$this'. If this expression evaluates to a non-zero value, the alert is considered to be in warning level."
          },
          "critical_condition": {
            "type": "string",
            "title": "Critical Expression",
            "description": "The alert value is available as '$this'. If this expression evaluates to a non-zero value, the alert is considered to be in critical level."
          }
        }
      },
      "configAction": {
        "type": "object",
        "title": "",
        "description": "The action the alert should take when it transitions states",
        "properties": {
          "execute": {
            "type": "string",
            "title": "Command to execute when the alert transitions states"
          },
          "recipient": {
            "type": "string",
            "title": "Recipient(s)"
          },
          "options": {
            "type": "array",
            "title": "Action Options",
            "uniqueItems": true,
            "items": {
              "oneOf": [
                { "const":  "no-clear-notification", "title": "Do not perform any action when the alert is cleared"}
              ]
            },
            "default": []
          },
          "delay": {
            "type": "object",
            "title": "Delay the action (notification)",
            "description": "Rules to postpone the action, to avoid multiple notifications on flapping alerts.",
            "properties": {
              "up": {
                "type": "integer",
                "title": "Delay when raising"
              },
              "down": {
                "type": "integer",
                "title": "Delay when going Down"
              },
              "multiplier": {
                "type": "number",
                "title": "Back-Off"
              },
              "max": {
                "type": "integer",
                "title": "Max"
              }
            }
          },
          "repeat": {
            "type": "object",
            "title": "Auto-Repeat Action",
            "description": "Repeat the action while the alert is raised.",
            "properties": {
              "enabled": {
                "type": "boolean"
              },
              "warning": {
                "type": "integer",
                "title": "Repeat on Warning"
              },
              "critical": {
                "type": "integer",
                "title": "Repeat on Critical"
              }
            }
          }
        }
      },
      "configInstance": {
        "type": "object",
        "title": "Alert Configuration",
        "description": "The properties that control the value the alert will get, the conditions it will trigger, the back-off for notifications, the auto-repeating of notifications, etc.",
        "properties": {
          "match": { "$ref": "#/definitions/matchInstance" },
          "summary": { "$ref": "#/definitions/configSummary" },
          "info": { "$ref": "#/definitions/configInfo" },
          "type": { "$ref": "#/definitions/configType" },
          "component": { "$ref": "#/definitions/configComponent" },
          "classification": { "$ref": "#/definitions/configClassification" },
          "value": { "$ref": "#/definitions/configValue" },
          "conditions": { "$ref": "#/definitions/configConditions" },
          "actions": { "$ref": "#/definitions/configAction" }
        },
        "required": []
      },
      "configTemplate": {
        "type": "object",
        "title": "Alert Configuration",
        "description": "The properties that control the value the alert will get, the conditions it will trigger, the back-off for notifications, the auto-repeating of notifications, etc.",
        "properties": {
          "match": { "$ref": "#/definitions/matchTemplate" },
          "summary": { "$ref": "#/definitions/configSummary" },
          "info": { "$ref": "#/definitions/configInfo" },
          "type": { "$ref": "#/definitions/configType" },
          "component": { "$ref": "#/definitions/configComponent" },
          "classification": { "$ref": "#/definitions/configClassification" },
          "value": { "$ref": "#/definitions/configValue" },
          "conditions": { "$ref": "#/definitions/configConditions" },
          "action": { "$ref": "#/definitions/configAction" }
        },
        "required": []
      }
    },
    "type": "object",
    "properties": {
      "name": {
        "type": "string"
      },
      "format_version": {
        "type": "integer",
        "default": 1
      },
      "rules": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "enabled": {
              "type": "boolean",
              "default": true,
              "title": "Enabled",
              "description": ""
            },
            "type": {
              "type": "string",
              "oneOf": [
                { "const":  "instance" , "title": "A specific Instance" },
                { "const":  "template" , "title": "Each of the Instances" }
              ],
              "default": "template",
              "title": "Apply this rule to:",
              "description": ""
            }
          },
          "required": [ "type", "enabled" ],
          "if": {
            "properties": {
              "type": { "const": "instance" }
            }
          },
          "then": {
            "properties": {
              "config": { "$ref": "#/definitions/configInstance" }
            }
          },
          "else": {
            "properties": {
              "config": { "$ref": "#/definitions/configTemplate" }
            }
          }
        }
      }
    },
    "required": [
      "rules"
    ]
  },
  "uiSchema": {
    "uiOptions": {
      "fullPage": true
    },
    "format_version": {
      "ui:widget": "hidden"
    },
    "name": {
      "ui:widget": "hidden"
    },
    "rules": {
      "items": {
        "ui:classNames": "dyncfg-grid dyncfg-grid-col-6",
        "enabled": {
          "ui:classNames": "dyncfg-grid-col-span-1-2",
          "ui:widget": "checkbox"
        },
        "type": {
          "ui:classNames": "dyncfg-grid-col-span-5-2",
          "ui:help": "Rules can be configured to match a specific instance (like a specific disk), or match all the instances (like all the disks). All rules are always checked against all nodes streamed to this Netdata, so the matching rules include patterns to match both instances and nodes.",
          "ui:widget": "radio",
          "ui:options": {
            "flavour": "buttonGroup"
          }
        },
        "config": {
          "ui:classNames": "dyncfg-grid dyncfg-grid-col-6 dyncfg-grid-col-span-1-6",
          "ui:flavour": "tabs",
          "ui:options": {
            "tabs": [
              {
                "title": "Match",
                "fields": [
                  "match"
                ]
              },
              {
                "title": "Value",
                "fields": [
                  "value"
                ]
              },
              {
                "title": "Triggers",
                "fields": [
                  "conditions"
                ]
              },
              {
                "title": "Action",
                "fields": [
                  "action"
                ]
              },
              {
                "title": "Description",
                "fields": [
                  "summary",
                  "info",
                  "type",
                  "component",
                  "classification"
                ]
              }
            ]
          },
          "match": {
            "ui:classNames": "dyncfg-grid dyncfg-grid-col-6 dyncfg-grid-col-span-1-6",
            "on": {
              "ui:classNames": "dyncfg-grid-col-span-1-6"
            },
            "host_labels": {
              "ui:help": "A simple pattern to match the node labels of the nodes this rule is to be applied to. A space separated list of label=value pairs is accepted. Asterisks can be placed anywhere, including the label key. The label keys and their values are available at the labels filter of the charts on the dashboard.",
              "ui:classNames": "dyncfg-grid-col-span-1-3"
            },
            "instance_labels": {
              "ui:classNames": "dyncfg-grid-col-span-4-3",
              "ui:help": "A simple pattern to match the instance labels of the instances this rule is to be applied to. A space separated list of label=value pairs is accepted. Asterisks can be placed anywhere, including the label key. The label keys and their values are available at the labels filter of the charts on the dashboard."
            }
          },
          "summary": {
            "ui:classNames": "dyncfg-grid-col-span-1-3"
          },
          "info": {
            "ui:classNames": "dyncfg-grid-col-span-4-3"
          },
          "type": {
            "ui:classNames": "dyncfg-grid-col-span-1-2"
          },
          "component": {
            "ui:classNames": "dyncfg-grid-col-span-3-2"
          },
          "classification": {
            "ui:classNames": "dyncfg-grid-col-span-5-2"
          },
          "value": {
            "ui:classNames": "dyncfg-grid dyncfg-grid-col-6 dyncfg-grid-col-span-1-6",
            "database_lookup": {
              "ui:order": ["data_source", "time_group", "time_group_condition", "time_group_value", "after", "before", "dims_group", "dimensions", "options"],
              "ui:classNames": "dyncfg-grid dyncfg-grid-col-6 dyncfg-grid-col-span-1-6",
              "ui:collapsible": true,
              "ui:initiallyExpanded": true,
              "data_source": {
                "ui:widget": "radio",
                "ui:options": {
                  "flavour": "buttonGroup"
                },
                "ui:classNames": "dyncfg-grid-col-span-1-6"
              },
              "time_group": {
                "ui:help": "When querying time-series data we need to come up with a single value. This function is used to aggregate all the values of the time-series data to a single value.",
                "ui:classNames": "dyncfg-grid-col-span-1-2"
              },
              "time_group_condition": {
                "ui:classNames": "dyncfg-grid-col-span-3-1"
              },
              "time_group_value": {
                "ui:classNames": "dyncfg-grid-col-span-4-1"
              },
              "after": {
                "ui:help": "The oldest timestamp of the time-series data to be included in the query. Negative values define a duration in seconds in the past of 'To' (so, -60 means a minute ago from 'To').",
                "ui:classNames": "dyncfg-grid-col-span-1-1"
              },
              "before": {
                "ui:help": "The newest timestamp of the time-series data to be included in the query. Negative value define a duration in seconds in the past (so, -60 means a minute ago). Zero means now.",
                "ui:classNames": "dyncfg-grid-col-span-2-1"
              },
              "dims_group": {
                "ui:help": "After each dimension has a single computed value, use this algorithm to derive the final value.",
                "ui:classNames": "dyncfg-grid-col-span-3-2"
              },
              "dimensions": {
                "ui:help": "A simple pattern to match the dimensions that should be included in the query",
                "ui:classNames": "dyncfg-grid-col-span-5-2"
              },
              "options": {
                "ui:classNames": "dyncfg-grid-col-span-1-6"
              }
            },
            "calculation": {
              "ui:help": "The database value is available as '$this'. This expression can utilize variables to transform the value of the alert.",
              "ui:classNames": "dyncfg-grid-col-span-1-5",
              "ui:placeholder": "$this * 1"
            },
            "units": {
              "ui:help": "The unit of measurement the alert value is expressed with. If unset, the units of the instance the alert is attached to will be used.",
              "ui:classNames": "dyncfg-grid-col-span-6-1"
            }
          },
          "conditions": {
            "ui:classNames": "dyncfg-grid dyncfg-grid-col-6 dyncfg-grid-col-span-1-6",
            "warning_condition": {
              "ui:classNames": "dyncfg-grid-col-span-1-6"
            },
            "critical_condition": {
              "ui:classNames": "dyncfg-grid-col-span-1-6"
            }
          },
          "action": {
            "ui:classNames": "dyncfg-grid dyncfg-grid-col-6 dyncfg-grid-col-span-1-6",
            "execute": {
              "ui:classNames": "dyncfg-grid-col-span-1-3",
              "ui:help": "Leave this empty to get the default alert notification"
            },
            "recipient": {
              "ui:classNames": "dyncfg-grid-col-span-4-1",
              "ui:help": "A space separated list of the recipients of the alert notifications. The special recipient 'silent' prevents this alert from taking any action (i.e. sending notifications)."
            },
            "options": {
              "ui:classNames": "dyncfg-grid-col-span-5-2",
              "ui:help": "Options related to the actions this alert will take."
            },
            "delay": {
              "ui:collapsible": true,
              "ui:initiallyExpanded": false,
              "ui:classNames": "dyncfg-grid dyncfg-grid-col-6 dyncfg-grid-col-span-1-6",
              "up": {
                "ui:classNames": "dyncfg-grid-col-span-1-2",
                "ui:help": "Delay the action (notification) that many seconds, when the alert is rising."
              },
              "down": {
                "ui:classNames": "dyncfg-grid-col-span-3-2",
                "ui:help": "Delay the action (notification) that many seconds, when the alert is recovering."
              },
              "multiplier": {
                "ui:classNames": "dyncfg-grid-col-span-5-1",
                "ui:help": "Multiply the delay by this number, every time the alert transitions to a new state, while the action (notification) is being delayed."
              },
              "max": {
                "ui:classNames": "dyncfg-grid-col-span-6-1",
                "ui:help": "The maximum acceptable delay in seconds, for taking the action (notification)."
              }
            },
            "repeat": {
              "ui:collapsible": true,
              "ui:initiallyExpanded": false,
              "ui:classNames": "dyncfg-grid dyncfg-grid-col-6 dyncfg-grid-col-span-1-6",
              "enabled": {
                "ui:classNames": "dyncfg-grid-col-span-1-2"
              },
              "warning": {
                "ui:classNames": "dyncfg-grid-col-span-3-2",
                "ui:help": "The number of seconds to repeat the action while the alert is in warning state"
              },
              "critical": {
                "ui:classNames": "dyncfg-grid-col-span-5-2",
                "ui:help": "The number of seconds to repeat the action while the alert is in critical state"
              }
            }
          },
          "hash": {
            "ui:widget": "hidden"
          },
          "source_type": {
            "ui:widget": "hidden"
          },
          "source": {
            "ui:widget": "hidden"
          }
        }
      }
    }
  }
}