Browse Source

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 5 years ago
parent
commit
16b6ad2e48
2 changed files with 11 additions and 18 deletions
  1. 6 13
      health/REFERENCE.md
  2. 5 5
      health/health_config.c

+ 6 - 13
health/REFERENCE.md

@@ -68,7 +68,7 @@ Netdata parses the following lines. Beneath the table is an in-depth explanation
 | [`delay`](#alarm-line-delay)                        | no              | Optional hysteresis settings to prevent floods of notifications.                      |
 | [`delay`](#alarm-line-delay)                        | no              | Optional hysteresis settings to prevent floods of notifications.                      |
 | [`repeat`](#alarm-line-repeat)                      | no              | The interval for sending notifications when an alarm is in WARNING or CRITICAL mode.  |
 | [`repeat`](#alarm-line-repeat)                      | no              | The interval for sending notifications when an alarm is in WARNING or CRITICAL mode.  |
 | [`option`](#alarm-line-option)                      | no              | Add an option to not clear alarms.                                                    |
 | [`option`](#alarm-line-option)                      | no              | Add an option to not clear alarms.                                                    |
-| [`label`](#alarm-line-label)                        | no              | List of labels present on a host.                                                     |
+| [`host labels`](#alarm-line-host-labels)            | no              | List of labels present on a host.                                                     |
 
 
 The `alarm` or `template` line must be the first line of any entity.
 The `alarm` or `template` line must be the first line of any entity.
 
 
@@ -371,9 +371,9 @@ increasing. Eventually, the comparison will find the averages in the two time-fr
 However, the issue was not resolved, it's just a matter of the newer data "polluting" the old. For such alarms, it's a
 However, the issue was not resolved, it's just a matter of the newer data "polluting" the old. For such alarms, it's a
 good idea to tell Netdata to not clear the notification, by using the `no-clear-notification` option.
 good idea to tell Netdata to not clear the notification, by using the `no-clear-notification` option.
 
 
-#### Alarm line `label`
+#### Alarm line `host labels`
 
 
-Defines the list of labels expected on a host. For example, let's suppose that `netdata.conf` is configured with the
+Defines the list of labels present on a host. For example, let's suppose that `netdata.conf` is configured with the
 following labels:
 following labels:
 
 
 ```yaml
 ```yaml
@@ -394,21 +394,14 @@ By defining labels inside of `netdata.conf`, you can now apply labels to alarms.
 line to any alarms you'd like to apply to hosts that have the label `room = server`.
 line to any alarms you'd like to apply to hosts that have the label `room = server`.
 
 
 ```yaml
 ```yaml
-label: room = server
+host labels: room = server
 ```
 ```
 
 
-You can also combine labels when applying them to alarms. For example, if you want to raise a specific alarm only for hosts 
-inside a room that were installed at a specific time, you can write the following label line:
-
-```yaml
-label: room = workstation AND installed = 201705
-```
-
-The `label` is a space-separated list that accepts simple patterns. For example, you can create an alarm 
+The `host labels` is a space-separated list that accepts simple patterns. For example, you can create an alarm 
 that will be applied to all hosts installed in the last decade with the following line:
 that will be applied to all hosts installed in the last decade with the following line:
 
 
 ```yaml
 ```yaml
-label: installed = 201*
+host labels: installed = 201*
 ```
 ```
 
 
 See our [simple patterns docs](../libnetdata/simple_pattern/) for more examples.
 See our [simple patterns docs](../libnetdata/simple_pattern/) for more examples.

+ 5 - 5
health/health_config.c

@@ -24,7 +24,7 @@
 #define HEALTH_DELAY_KEY "delay"
 #define HEALTH_DELAY_KEY "delay"
 #define HEALTH_OPTIONS_KEY "options"
 #define HEALTH_OPTIONS_KEY "options"
 #define HEALTH_REPEAT_KEY "repeat"
 #define HEALTH_REPEAT_KEY "repeat"
-#define HEALTH_LABEL_KEY "label"
+#define HEALTH_HOST_LABEL_KEY "host labels"
 
 
 static inline int rrdcalc_add_alarm_from_config(RRDHOST *host, RRDCALC *rc) {
 static inline int rrdcalc_add_alarm_from_config(RRDHOST *host, RRDCALC *rc) {
     if(!rc->chart) {
     if(!rc->chart) {
@@ -499,7 +499,7 @@ static int health_readfile(const char *filename, void *data) {
             hash_delay = 0,
             hash_delay = 0,
             hash_options = 0,
             hash_options = 0,
             hash_repeat = 0,
             hash_repeat = 0,
-            hash_label = 0;
+            hash_host_label = 0;
 
 
     char buffer[HEALTH_CONF_MAX_LINE + 1];
     char buffer[HEALTH_CONF_MAX_LINE + 1];
 
 
@@ -524,7 +524,7 @@ static int health_readfile(const char *filename, void *data) {
         hash_delay = simple_uhash(HEALTH_DELAY_KEY);
         hash_delay = simple_uhash(HEALTH_DELAY_KEY);
         hash_options = simple_uhash(HEALTH_OPTIONS_KEY);
         hash_options = simple_uhash(HEALTH_OPTIONS_KEY);
         hash_repeat = simple_uhash(HEALTH_REPEAT_KEY);
         hash_repeat = simple_uhash(HEALTH_REPEAT_KEY);
-        hash_label = simple_uhash(HEALTH_LABEL_KEY);
+        hash_host_label = simple_uhash(HEALTH_HOST_LABEL_KEY);
     }
     }
 
 
     FILE *fp = fopen(filename, "r");
     FILE *fp = fopen(filename, "r");
@@ -798,7 +798,7 @@ static int health_readfile(const char *filename, void *data) {
                                     &rc->warn_repeat_every,
                                     &rc->warn_repeat_every,
                                     &rc->crit_repeat_every);
                                     &rc->crit_repeat_every);
             }
             }
-            else if(hash == hash_label && !strcasecmp(key, HEALTH_LABEL_KEY)) {
+            else if(hash == hash_host_label && !strcasecmp(key, HEALTH_HOST_LABEL_KEY)) {
                 if(rc->labels) {
                 if(rc->labels) {
                     if(strcmp(rc->labels, value) != 0)
                     if(strcmp(rc->labels, value) != 0)
                         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'.",
                         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) {
                                     &rt->warn_repeat_every,
                                     &rt->warn_repeat_every,
                                     &rt->crit_repeat_every);
                                     &rt->crit_repeat_every);
             }
             }
-            else if(hash == hash_label && !strcasecmp(key, HEALTH_LABEL_KEY)) {
+            else if(hash == hash_host_label && !strcasecmp(key, HEALTH_HOST_LABEL_KEY)) {
                 if(rt->labels) {
                 if(rt->labels) {
                     if(strcmp(rt->labels, value) != 0)
                     if(strcmp(rt->labels, value) != 0)
                         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').",
                         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').",