@cryptotaxi247 / netdata-1 / commits / 16b6ad2e4

Adjust alarm labels (#7600)

* adjust_alarm_labels: variable rename This commit renames the variables inside health * adjust_alarm_labels: Doc Changes documentation for the labels * adjust_alarm_labels: Fix typo this commit brings the fix for the documentation * adjust_alarm_labels: Table align Fix table align on documentation * adjust_alarm_labels: Table align Fix link * adjust_alarm_labels: Link * adjust_alarm_labels: Link * adjust_alarm_labels: Remove contradiction The previous documentation had a contradiction removed with this commit * adjust_alarm_labels: Missing conversion This commit brings the latest change to text

thiagoftsm committed Jan 2, 2020 at 21:35 UTC 16b6ad2e48449c3afe92f458ace9a67868a4db2c
2 files changed +11 -18
health/REFERENCE.md
+6 -13
@@ -68,7 +68,7 @@ Netdata parses the following lines. Beneath the table is an in-depth explanation
68 | [`delay`](#alarm-line-delay) | no | Optional hysteresis settings to prevent floods of notifications. |
69 | [`repeat`](#alarm-line-repeat) | no | The interval for sending notifications when an alarm is in WARNING or CRITICAL mode. |
70 | [`option`](#alarm-line-option) | no | Add an option to not clear alarms. |
71 -| [`label`](#alarm-line-label) | no | List of labels present on a host. |
71 +| [`host labels`](#alarm-line-host-labels) | no | List of labels present on a host. |
72
73 The `alarm` or `template` line must be the first line of any entity.
74
@@ -371,9 +371,9 @@ increasing. Eventually, the comparison will find the averages in the two time-fr
371 However, the issue was not resolved, it's just a matter of the newer data "polluting" the old. For such alarms, it's a
372 good idea to tell Netdata to not clear the notification, by using the `no-clear-notification` option.
373
374 -#### Alarm line `label`
374 +#### Alarm line `host labels`
375
376 -Defines the list of labels expected on a host. For example, let's suppose that `netdata.conf` is configured with the
376 +Defines the list of labels present on a host. For example, let's suppose that `netdata.conf` is configured with the
377 following labels:
378
379 ```yaml
@@ -394,21 +394,14 @@ By defining labels inside of `netdata.conf`, you can now apply labels to alarms.
394 line to any alarms you'd like to apply to hosts that have the label `room = server`.
395
396 ```yaml
397 -label: room = server
397 +host labels: room = server
398 ```
399
400 -You can also combine labels when applying them to alarms. For example, if you want to raise a specific alarm only for hosts
401 -inside a room that were installed at a specific time, you can write the following label line:
402 -
403 -```yaml
404 -label: room = workstation AND installed = 201705
405 -```
406 -
407 -The `label` is a space-separated list that accepts simple patterns. For example, you can create an alarm
400 +The `host labels` is a space-separated list that accepts simple patterns. For example, you can create an alarm
401 that will be applied to all hosts installed in the last decade with the following line:
402
403 ```yaml
411 -label: installed = 201*
404 +host labels: installed = 201*
405 ```
406
407 See our [simple patterns docs](../libnetdata/simple_pattern/) for more examples.
health/health_config.c
+5 -5
@@ -24,7 +24,7 @@
24 #define HEALTH_DELAY_KEY "delay"
25 #define HEALTH_OPTIONS_KEY "options"
26 #define HEALTH_REPEAT_KEY "repeat"
27 -#define HEALTH_LABEL_KEY "label"
27 +#define HEALTH_HOST_LABEL_KEY "host labels"
28
29 static inline int rrdcalc_add_alarm_from_config(RRDHOST *host, RRDCALC *rc) {
30 if(!rc->chart) {
@@ -499,7 +499,7 @@ static int health_readfile(const char *filename, void *data) {
499 hash_delay = 0,
500 hash_options = 0,
501 hash_repeat = 0,
502 - hash_label = 0;
502 + hash_host_label = 0;
503
504 char buffer[HEALTH_CONF_MAX_LINE + 1];
505
@@ -524,7 +524,7 @@ static int health_readfile(const char *filename, void *data) {
524 hash_delay = simple_uhash(HEALTH_DELAY_KEY);
525 hash_options = simple_uhash(HEALTH_OPTIONS_KEY);
526 hash_repeat = simple_uhash(HEALTH_REPEAT_KEY);
527 - hash_label = simple_uhash(HEALTH_LABEL_KEY);
527 + hash_host_label = simple_uhash(HEALTH_HOST_LABEL_KEY);
528 }
529
530 FILE *fp = fopen(filename, "r");
@@ -798,7 +798,7 @@ static int health_readfile(const char *filename, void *data) {
798 &rc->warn_repeat_every,
799 &rc->crit_repeat_every);
800 }
801 - else if(hash == hash_label && !strcasecmp(key, HEALTH_LABEL_KEY)) {
801 + else if(hash == hash_host_label && !strcasecmp(key, HEALTH_HOST_LABEL_KEY)) {
802 if(rc->labels) {
803 if(strcmp(rc->labels, value) != 0)
804 error("Health configuration at line %zu of file '%s' for alarm '%s' has key '%s' twice, once with value '%s' and later with value '%s'.",
@@ -943,7 +943,7 @@ static int health_readfile(const char *filename, void *data) {
943 &rt->warn_repeat_every,
944 &rt->crit_repeat_every);
945 }
946 - else if(hash == hash_label && !strcasecmp(key, HEALTH_LABEL_KEY)) {
946 + else if(hash == hash_host_label && !strcasecmp(key, HEALTH_HOST_LABEL_KEY)) {
947 if(rt->labels) {
948 if(strcmp(rt->labels, value) != 0)
949 error("Health configuration at line %zu of file '%s' for template '%s' has key '%s' twice, once with value '%s' and later with value '%s'. Using ('%s').",