Skip to content

Commit

Permalink
Modify mapping alerts
Browse files Browse the repository at this point in the history
It implements (openrca#86).

Signed-off-by: Aleksandra Galara <a.galara@samsung.com>
  • Loading branch information
aleksandra-galara committed Jun 12, 2020
1 parent c202619 commit b741f8b
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 43 deletions.
133 changes: 94 additions & 39 deletions helm/orca/config/alerts-mapping.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -699,42 +699,6 @@ elastalert:

zabbix:
mappings:
- name: "Load average is too high (per CPU load over {$LOAD_AVG_PER_CPU.MAX.WARN} for 5m)"
source_mapping:
origin: kubernetes
kind: node
properties:
name: node
- name: 'Interface eth0: Link down'
source_mapping:
origin: kubernetes
kind: node
properties:
name: node
- name: 'Interface tunl0: Link down'
source_mapping:
origin: kubernetes
kind: node
properties:
name: node
- name: '/etc/hostname: Running out of free inodes (free < {$VFS.FS.INODE.PFREE.MIN.CRIT:/etc/hostname}%)'
source_mapping:
origin: kubernetes
kind: node
properties:
name: node
- name: '/etc/hosts: Running out of free inodes (free < {$VFS.FS.INODE.PFREE.MIN.CRIT:/etc/hosts}%)'
source_mapping:
origin: kubernetes
kind: node
properties:
name: node
- name: 'Zabbix agent is not available (for {$AGENT.TIMEOUT})'
source_mapping:
origin: kubernetes
kind: node
properties:
name: node
- name: 'Zabbix alerter processes more than 75% busy'
source_mapping:
origin: kubernetes
Expand Down Expand Up @@ -933,19 +897,110 @@ zabbix:
kind: node
properties:
name: node
- name: "Temperature is above warning threshold: >{$TEMP_WARN:}"
regex_mappings:
- name: ".*Problem with FAN.*"
source_mapping:
origin: kubernetes
kind: node
properties:
name: node
- name: ".*Overall System Status Error.*"
source_mapping:
origin: kubernetes
kind: node
properties:
name: node
- name: ".*RAID Controller Error.*"
source_mapping:
origin: kubernetes
kind: node
properties:
name: node
- name: ".*Error on PSU.*"
source_mapping:
origin: kubernetes
kind: node
properties:
name: node
- name: ".*Problem with Temperature.*"
source_mapping:
origin: kubernetes
kind: node
properties:
name: node
- name: ".*Error on Voltage Sensor.*"
source_mapping:
origin: kubernetes
kind: node
properties:
name: node
- name: ".*Problem with FAN.*"
source_mapping:
origin: kubernetes
kind: node
properties:
name: node
- name: ".*Error on Processor.*"
source_mapping:
origin: kubernetes
kind: node
properties:
name: node
- name: ".*Error on NIC.*"
source_mapping:
origin: kubernetes
kind: node
properties:
name: node
- name: ".*Running out of free inodes.*"
source_mapping:
origin: kubernetes
kind: node
properties:
name: node
- name: ".*Disk read/write request responses are too high.*"
source_mapping:
origin: kubernetes
kind: node
properties:
name: node
- name: ".*Temperature is above critical threshold.*"
source_mapping:
origin: kubernetes
kind: node
properties:
name: node
- name: ".*Temperature is above warning threshold.*"
source_mapping:
origin: kubernetes
kind: node
properties:
name: node
- name: ".*Fan.* Critical.*"
source_mapping:
origin: kubernetes
kind: node
properties:
name: node
- name: "Interface .*: Link down"
source_mapping:
origin: kubernetes
kind: node
properties:
name: node
- name: "Interface .*: High error rate .*"
source_mapping:
origin: kubernetes
kind: node
properties:
name: node
- name: "Temperature is above critical threshold: >{$TEMP_CRIT:}"
- name: "Interface .*: Ethernet has changed to lower speed than it was before"
source_mapping:
origin: kubernetes
kind: node
properties:
name: node
- name: "Temperature is too low: <{$TEMP_CRIT_LOW:}"
- name: "Zabbix agent is not available.*"
source_mapping:
origin: kubernetes
kind: node
Expand Down
20 changes: 16 additions & 4 deletions orca/topology/alerts/extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

import abc
import re

from orca import exceptions
from orca.common import config, file_utils, logger
Expand Down Expand Up @@ -88,9 +89,13 @@ def _mapping(self):
return self.__mapping

def map(self, name, labels):
mapping = self._mapping.get(name)
mapping = self._mapping['plain'].get(name)
if not mapping:
raise exceptions.MappingNotFound(key=name)
try:
key = [regex for regex in self._mapping['regex'].keys() if re.compile(regex).match(name)][0]
mapping = self._mapping['regex'].get(key)
except:
raise exceptions.MappingNotFound(key=name)
origin = mapping['origin']
kind = mapping['kind']
properties = {}
Expand All @@ -110,11 +115,18 @@ def _load_mapping(self):
if not blacklist_values:
blacklist_values = []
mappings = mapping_spec['mappings']
regex_mappings = mapping_spec['regex_mappings']
lookup = {}
lookup['plain'] = {}
lookup['regex'] = {}
for mapping in mappings:
name = mapping['name']
lookup[name] = mapping['source_mapping']
lookup[name].setdefault('blacklist_values', blacklist_values)
lookup['plain'][name] = mapping['source_mapping']
lookup['plain'][name].setdefault('blacklist_values', blacklist_values)
for regex_mapping in regex_mappings:
name = regex_mapping['name']
lookup['regex'][name] = regex_mapping['source_mapping']
lookup['regex'][name].setdefault('blacklist_values', blacklist_values)
return lookup

def _load_mapping_spec(self):
Expand Down
1 change: 1 addition & 0 deletions orca/topology/alerts/zabbix/upstream.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def __init__(self, client):

def get_all(self):
all = self._client.trigger.get(
expandDescription=1,
only_true=1,
active=1,
output='extend',
Expand Down

0 comments on commit b741f8b

Please sign in to comment.