Add alerta to prometheus
Change-Id: I0349936dc683475e18155cf5f8ca750d06482cfb
This commit is contained in:
parent
229fda3fc4
commit
38242186dd
5 changed files with 66 additions and 0 deletions
9
metadata/service/alerta/init.yml
Normal file
9
metadata/service/alerta/init.yml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
applications:
|
||||||
|
- prometheus
|
||||||
|
classes:
|
||||||
|
- service.prometheus.support
|
||||||
|
parameters:
|
||||||
|
prometheus:
|
||||||
|
alerta:
|
||||||
|
enabled: true
|
||||||
|
config_dir: /srv/volumes/local/alerta
|
21
prometheus/alerta.sls
Normal file
21
prometheus/alerta.sls
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
{% from "prometheus/map.jinja" import alerta with context %}
|
||||||
|
{%- if alerta.enabled %}
|
||||||
|
|
||||||
|
alerta_config_dir:
|
||||||
|
file.directory:
|
||||||
|
- name: {{ alerta.config_dir }}
|
||||||
|
- makedirs: True
|
||||||
|
- mode: 755
|
||||||
|
|
||||||
|
|
||||||
|
alerta_config_file:
|
||||||
|
file.managed:
|
||||||
|
- name: {{ alerta.config_dir }}/alerta.conf
|
||||||
|
- source: salt://prometheus/files/alerta/alerta.conf
|
||||||
|
- makedirs: True
|
||||||
|
- mode: 755
|
||||||
|
- template: jinja
|
||||||
|
- require:
|
||||||
|
- file: alerta_config_dir
|
||||||
|
|
||||||
|
{%- endif %}
|
26
prometheus/files/alerta/alerta.conf
Normal file
26
prometheus/files/alerta/alerta.conf
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
{%- from "prometheus/map.jinja" import alerta with context %}
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('config', [])
|
||||||
|
.constant('config', {
|
||||||
|
'endpoint' : "/api",
|
||||||
|
'provider' : "basic",
|
||||||
|
'colors' : {
|
||||||
|
'severity': {
|
||||||
|
'critical' : '{{ alerta.get("colors", {}).get("critical", "#D8122A") }}',
|
||||||
|
'major' : '{{ alerta.get("colors", {}).get("major", "#EA680F") }}',
|
||||||
|
'minor' : '{{ alerta.get("colors", {}).get("minor", "#FFBE1E") }}',
|
||||||
|
'warning' : '{{ alerta.get("colors", {}).get("warning", "#BA2222") }}',
|
||||||
|
'indeterminate': '{{ alerta.get("colors", {}).get("indeterminate", "#A6ACA8") }}',
|
||||||
|
'cleared' : '{{ alerta.get("colors", {}).get("cleared", "#00AA5A") }}',
|
||||||
|
'normal' : '{{ alerta.get("colors", {}).get("normal", "#00AA5A") }}',
|
||||||
|
'ok' : '{{ alerta.get("colors", {}).get("ok", "#00AA5A") }}',
|
||||||
|
'informational': '{{ alerta.get("colors", {}).get("informational", "#00A1BC") }}',
|
||||||
|
'debug' : '{{ alerta.get("colors", {}).get("debug", "#9D006D") }}',
|
||||||
|
'security' : '{{ alerta.get("colors", {}).get("security", "#333333") }}',
|
||||||
|
'unknown' : '{{ alerta.get("colors", {}).get("unknown", "#A6ACA8") }}'
|
||||||
|
},
|
||||||
|
'text': 'white',
|
||||||
|
'highlight': 'lightgray'
|
||||||
|
}
|
||||||
|
});
|
|
@ -1,5 +1,6 @@
|
||||||
{%- if pillar.prometheus.get('server', {}).get('enabled', False) or
|
{%- if pillar.prometheus.get('server', {}).get('enabled', False) or
|
||||||
pillar.prometheus.get('relay', {}).get('enabled', False) or
|
pillar.prometheus.get('relay', {}).get('enabled', False) or
|
||||||
|
pillar.prometheus.get('alerta', {}).get('enabled', False) or
|
||||||
pillar.prometheus.alertmanager is defined or
|
pillar.prometheus.alertmanager is defined or
|
||||||
pillar.prometheus.exporters is defined %}
|
pillar.prometheus.exporters is defined %}
|
||||||
include:
|
include:
|
||||||
|
@ -9,6 +10,9 @@ include:
|
||||||
{%- if pillar.prometheus.get('relay', {}).get('enabled', False) %}
|
{%- if pillar.prometheus.get('relay', {}).get('enabled', False) %}
|
||||||
- prometheus.relay
|
- prometheus.relay
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
{%- if pillar.prometheus.get('alerta', {}).get('enabled', False) %}
|
||||||
|
- prometheus.alerta
|
||||||
|
{%- endif %}
|
||||||
{%- if pillar.prometheus.alertmanager is defined %}
|
{%- if pillar.prometheus.alertmanager is defined %}
|
||||||
- prometheus.alertmanager
|
- prometheus.alertmanager
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
|
@ -45,3 +45,9 @@
|
||||||
'default': {
|
'default': {
|
||||||
},
|
},
|
||||||
}, merge=salt['pillar.get']('prometheus:remote_storage_adapter')) %}
|
}, merge=salt['pillar.get']('prometheus:remote_storage_adapter')) %}
|
||||||
|
|
||||||
|
{% set alerta = salt['grains.filter_by']({
|
||||||
|
'default': {
|
||||||
|
'config_dir': '/srv/volumes/local/alerta',
|
||||||
|
},
|
||||||
|
}, merge=salt['pillar.get']('prometheus:alerta')) %}}
|
||||||
|
|
Loading…
Reference in a new issue