Feature 8170: deploy OSM services with a helm chart
[osm/devops.git] / installers / helm / osm / templates / prometheus / prometheus-prom-configmap.yaml
diff --git a/installers/helm/osm/templates/prometheus/prometheus-prom-configmap.yaml b/installers/helm/osm/templates/prometheus/prometheus-prom-configmap.yaml
new file mode 100644 (file)
index 0000000..18fef22
--- /dev/null
@@ -0,0 +1,87 @@
+{{- if .Values.prometheus.enabled -}}
+#######################################################################################
+# Copyright ETSI Contributors and Others.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#######################################################################################
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: {{ include "osm.fullname" . }}-prometheus-prom-configmap
+  labels:
+    {{- include "osm.labels" . | nindent 4 }}
+data:
+  prometheus.yml: |
+    # Copyright 2018 The Prometheus Authors
+    # Copyright 2018 Whitestack
+    # Copyright 2018 Telefonica Investigacion y Desarrollo, S.A.U.
+    #
+    # Licensed under the Apache License, Version 2.0 (the "License");
+    # you may not use this file except in compliance with the License.
+    # You may obtain a copy of the License at
+    #
+    # http://www.apache.org/licenses/LICENSE-2.0
+    #
+    # Unless required by applicable law or agreed to in writing, software
+    # distributed under the License is distributed on an "AS IS" BASIS,
+    # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    # See the License for the specific language governing permissions and
+    # limitations under the License.
+
+    # my global config
+    global:
+      scrape_interval:     15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
+      evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
+      # scrape_timeout is set to the global default (10s).
+
+    # Alertmanager configuration
+    alerting:
+      alertmanagers:
+      - static_configs:
+        - targets:
+{{- if .Values.global.oldServiceAssurance }}
+          # - alertmanager:9093
+{{- else }}
+          - alertmanager:9093
+{{- end }}
+    # Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
+{{- if .Values.global.oldServiceAssurance }}
+    rule_files:
+      # - "first_rules.yml"
+      # - "second_rules.yml"
+{{- else }}
+    rule_files:
+      - "osm_metric_rules.yml"
+      - "osm_alert_rules.yml"
+{{- end }}
+    # A scrape configuration containing exactly one endpoint to scrape:
+    # Here it's Prometheus itself.
+    scrape_configs:
+      - job_name: 'mon_exporter'
+        static_configs:
+        - targets: ['mon:8000']
+{{- if .Values.global.oldServiceAssurance }}
+      # Add here other external targets, e.g. a pushgateway
+      # - job_name: 'pushgateway'
+      #   static_configs:
+      #   - targets: ['prometheus-pushgateway:9091']
+{{- else }}
+      - job_name: pushgateway
+        honor_labels: true
+        scrape_interval: 30s
+        static_configs:
+        - targets:
+          - pushgateway-prometheus-pushgateway:9091
+{{- end }}
+{{- end }}
\ No newline at end of file