summaryrefslogtreecommitdiffstats
path: root/collectors/python.d.plugin/alarms
diff options
context:
space:
mode:
Diffstat (limited to 'collectors/python.d.plugin/alarms')
-rw-r--r--collectors/python.d.plugin/alarms/README.md3
-rw-r--r--collectors/python.d.plugin/alarms/alarms.chart.py6
-rw-r--r--collectors/python.d.plugin/alarms/alarms.conf3
3 files changed, 12 insertions, 0 deletions
diff --git a/collectors/python.d.plugin/alarms/README.md b/collectors/python.d.plugin/alarms/README.md
index ee1e59971..8dc666f5b 100644
--- a/collectors/python.d.plugin/alarms/README.md
+++ b/collectors/python.d.plugin/alarms/README.md
@@ -58,6 +58,9 @@ local:
# a "," separated list of words you want to filter alarm names for. For example 'cpu,load' would filter for only
# alarms with "cpu" or "load" in alarm name. Default includes all.
alarm_contains_words: ''
+ # a "," separated list of words you want to exclude based on alarm name. For example 'cpu,load' would exclude
+ # all alarms with "cpu" or "load" in alarm name. Default excludes None.
+ alarm_excludes_words: ''
```
It will default to pulling all alarms at each time step from the Netdata rest api at `http://127.0.0.1:19999/api/v1/alarms?all`
diff --git a/collectors/python.d.plugin/alarms/alarms.chart.py b/collectors/python.d.plugin/alarms/alarms.chart.py
index 314b0e7a8..d19427358 100644
--- a/collectors/python.d.plugin/alarms/alarms.chart.py
+++ b/collectors/python.d.plugin/alarms/alarms.chart.py
@@ -39,6 +39,7 @@ DEFAULT_URL = 'http://127.0.0.1:19999/api/v1/alarms?all'
DEFAULT_COLLECT_ALARM_VALUES = False
DEFAULT_ALARM_STATUS_CHART_TYPE = 'line'
DEFAULT_ALARM_CONTAINS_WORDS = ''
+DEFAULT_ALARM_EXCLUDES_WORDS = ''
class Service(UrlService):
def __init__(self, configuration=None, name=None):
@@ -51,6 +52,8 @@ class Service(UrlService):
self.collected_dims = {'alarms': set(), 'values': set()}
self.alarm_contains_words = self.configuration.get('alarm_contains_words', DEFAULT_ALARM_CONTAINS_WORDS)
self.alarm_contains_words_list = [alarm_contains_word.lstrip(' ').rstrip(' ') for alarm_contains_word in self.alarm_contains_words.split(',')]
+ self.alarm_excludes_words = self.configuration.get('alarm_excludes_words', DEFAULT_ALARM_EXCLUDES_WORDS)
+ self.alarm_excludes_words_list = [alarm_excludes_word.lstrip(' ').rstrip(' ') for alarm_excludes_word in self.alarm_excludes_words.split(',')]
def _get_data(self):
raw_data = self._get_raw_data()
@@ -62,6 +65,9 @@ class Service(UrlService):
if self.alarm_contains_words != '':
alarms = {alarm_name: alarms[alarm_name] for alarm_name in alarms for alarm_contains_word in
self.alarm_contains_words_list if alarm_contains_word in alarm_name}
+ if self.alarm_excludes_words != '':
+ alarms = {alarm_name: alarms[alarm_name] for alarm_name in alarms for alarm_excludes_word in
+ self.alarm_excludes_words_list if alarm_excludes_word not in alarm_name}
data = {a: self.sm[alarms[a]['status']] for a in alarms if alarms[a]['status'] in self.sm}
self.update_charts('alarms', data)
diff --git a/collectors/python.d.plugin/alarms/alarms.conf b/collectors/python.d.plugin/alarms/alarms.conf
index cd48d4411..06d76c3b3 100644
--- a/collectors/python.d.plugin/alarms/alarms.conf
+++ b/collectors/python.d.plugin/alarms/alarms.conf
@@ -55,3 +55,6 @@ local:
# a "," separated list of words you want to filter alarm names for. For example 'cpu,load' would filter for only
# alarms with "cpu" or "load" in alarm name. Default includes all.
alarm_contains_words: ''
+ # a "," separated list of words you want to exclude based on alarm name. For example 'cpu,load' would exclude
+ # all alarms with "cpu" or "load" in alarm name. Default excludes None.
+ alarm_excludes_words: ''