X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=installers%2Fdocker%2Fosm_pods%2Fng-prometheus.yaml;h=77ccbd1b88fc37de63eb0088a2bf75770f03855e;hb=bae51f695443abcd0e410a92161af05b497ddc7a;hp=0172aafd8be3450c5eca80a4844b8c716a0cd1d2;hpb=9ab64a953b0a46d6e09c16387c851a56c8c809cd;p=osm%2Fdevops.git diff --git a/installers/docker/osm_pods/ng-prometheus.yaml b/installers/docker/osm_pods/ng-prometheus.yaml index 0172aafd..77ccbd1b 100644 --- a/installers/docker/osm_pods/ng-prometheus.yaml +++ b/installers/docker/osm_pods/ng-prometheus.yaml @@ -30,10 +30,13 @@ spec: type: NodePort --- apiVersion: v1 +kind: ConfigMap +metadata: + name: prom data: - osm_rules.yml: | + osm_metric_rules.yml: | groups: - - name: osm_rules + - name: osm_metric_rules rules: - record: vm_status_extended expr: (last_over_time(vm_status[1m]) * on (vm_id, vim_id) group_left(ns_id, vnf_id, vdu_id, project_id, job, vdu_name, vnf_member_index) last_over_time(ns_topology[1m])) or (last_over_time(ns_topology[1m]) * -1) @@ -47,6 +50,16 @@ data: expr: (0 * (count (vm_status_extended==0) by (ns_id)>=0)) or (min by (ns_id) (vm_status_extended)) labels: job: osm_prometheus + osm_alert_rules.yml: | + groups: + - name: osm_alert_rules + rules: + - alert: vdu_down + expr: vm_status_extended != 1 + for: 3m + annotations: + summary: "VDU {{ $labels.vm_id }} in VIM {{ $labels.vim_id }} is down" + description: "VDU {{ $labels.vm_id }} in VIM {{ $labels.vim_id }} has been down for more than 3 minutes. NS instance id is {{ $labels.ns_id }}" prometheus.yml: | # Copyright 2018 The Prometheus Authors # Copyright 2018 Whitestack @@ -75,12 +88,12 @@ data: alertmanagers: - static_configs: - targets: - # - alertmanager:9093 + - alertmanager:9093 # Load rules once and periodically evaluate them according to the global 'evaluation_interval'. rule_files: - - "osm_rules.yml" - # - "second_rules.yml" + - "osm_metric_rules.yml" + - "osm_alert_rules.yml" # A scrape configuration containing exactly one endpoint to scrape: # Here it's Prometheus itself. @@ -94,9 +107,6 @@ data: static_configs: - targets: - pushgateway-prometheus-pushgateway:9091 -kind: ConfigMap -metadata: - name: prom --- apiVersion: apps/v1 kind: StatefulSet @@ -119,7 +129,7 @@ spec: - name: prometheus-init-config image: busybox command: ["/bin/sh", "-c"] - args: ['if [ ! -f "/etc/prometheus/prometheus.yml" ]; then cp /config/prometheus.yml /etc/prometheus; fi; cp /config/osm_rules.yml /etc/prometheus'] + args: ['if [ ! -f "/etc/prometheus/prometheus.yml" ]; then cp /config/prometheus.yml /etc/prometheus; fi; cp /config/osm_metric_rules.yml /config/osm_alert_rules.yml /etc/prometheus'] volumeMounts: - name: prom-config mountPath: /etc/prometheus