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) last_over_time(ns_topology[1m])) or (last_over_time(ns_topology[1m]) * -1)
+ 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)
labels:
job: osm_prometheus
- record: vnf_status
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
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.
static_configs:
- targets:
- pushgateway-prometheus-pushgateway:9091
-kind: ConfigMap
-metadata:
- name: prom
---
apiVersion: apps/v1
kind: StatefulSet
- 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
- name: prom-db
mountPath: /prometheus
- name: prometheus-config-sidecar
- image: opensourcemano/prometheus:12
+ image: opensourcemano/prometheus:13
env:
- name: MONGODB_URL
value: mongodb://mongodb-k8s:27017/?replicaSet=rs0