| bravof | c973b57 | 2020-10-21 16:58:50 -0300 | [diff] [blame] | 1 | # Copyright 2021 Whitestack, LLC |
| 2 | # ************************************************************* |
| 3 | |
| 4 | # This file is part of OSM Monitoring module |
| 5 | # All Rights Reserved to Whitestack, LLC |
| 6 | |
| 7 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 8 | # not use this file except in compliance with the License. You may obtain |
| 9 | # a copy of the License at |
| 10 | |
| 11 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | |
| 13 | # Unless required by applicable law or agreed to in writing, software |
| 14 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 15 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 16 | # License for the specific language governing permissions and limitations |
| 17 | # under the License. |
| 18 | |
| 19 | # For those usages not covered by the Apache License, Version 2.0 please |
| 20 | # contact: fbravo@whitestack.com or glavado@whitestack.com |
| 21 | ## |
| 22 | |
| vijaynag | 8339ed2 | 2019-07-25 17:10:58 +0530 | [diff] [blame] | 23 | apiVersion: v1 |
| 24 | kind: Service |
| 25 | metadata: |
| 26 | name: prometheus |
| 27 | spec: |
| 28 | ports: |
| 29 | - nodePort: 9091 |
| 30 | port: 9090 |
| 31 | protocol: TCP |
| 32 | targetPort: 9090 |
| 33 | selector: |
| 34 | app: prometheus |
| 35 | type: NodePort |
| 36 | --- |
| 37 | apiVersion: v1 |
| 38 | data: |
| 39 | prometheus.yml: | |
| 40 | # Copyright 2018 The Prometheus Authors |
| 41 | # Copyright 2018 Whitestack |
| 42 | # Copyright 2018 Telefonica Investigacion y Desarrollo, S.A.U. |
| 43 | # |
| 44 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 45 | # you may not use this file except in compliance with the License. |
| 46 | # You may obtain a copy of the License at |
| 47 | # |
| 48 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 49 | # |
| 50 | # Unless required by applicable law or agreed to in writing, software |
| 51 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 52 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 53 | # See the License for the specific language governing permissions and |
| 54 | # limitations under the License. |
| 55 | |
| 56 | # my global config |
| 57 | global: |
| 58 | scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute. |
| 59 | evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute. |
| 60 | # scrape_timeout is set to the global default (10s). |
| 61 | |
| 62 | # Alertmanager configuration |
| 63 | alerting: |
| 64 | alertmanagers: |
| 65 | - static_configs: |
| 66 | - targets: |
| 67 | # - alertmanager:9093 |
| 68 | |
| 69 | # Load rules once and periodically evaluate them according to the global 'evaluation_interval'. |
| 70 | rule_files: |
| 71 | # - "first_rules.yml" |
| 72 | # - "second_rules.yml" |
| 73 | |
| 74 | # A scrape configuration containing exactly one endpoint to scrape: |
| 75 | # Here it's Prometheus itself. |
| garciadeblas | bef284e | 2022-11-18 00:55:44 +0100 | [diff] [blame] | 76 | scrape_configs: |
| 77 | - job_name: 'mon_exporter' |
| 78 | static_configs: |
| 79 | - targets: ['mon:8000'] |
| garciadeblas | 09eaa92 | 2022-09-07 22:57:53 +0200 | [diff] [blame] | 80 | # Add here other external targets, e.g. a pushgateway |
| 81 | # - job_name: 'pushgateway' |
| 82 | # static_configs: |
| 83 | # - targets: ['prometheus-pushgateway:9091'] |
| vijaynag | 8339ed2 | 2019-07-25 17:10:58 +0530 | [diff] [blame] | 84 | kind: ConfigMap |
| 85 | metadata: |
| 86 | name: prom |
| 87 | --- |
| 88 | apiVersion: apps/v1 |
| 89 | kind: StatefulSet |
| 90 | metadata: |
| 91 | name: prometheus |
| 92 | labels: |
| 93 | app: prometheus |
| 94 | spec: |
| 95 | replicas: 1 |
| 96 | serviceName: prometheus |
| 97 | selector: |
| 98 | matchLabels: |
| 99 | app: prometheus |
| 100 | template: |
| 101 | metadata: |
| 102 | labels: |
| 103 | app: prometheus |
| 104 | spec: |
| bravof | 1e0297e | 2020-07-01 15:11:57 -0400 | [diff] [blame] | 105 | initContainers: |
| 106 | - name: prometheus-init-config |
| 107 | image: busybox |
| 108 | command: ["/bin/sh", "-c"] |
| garciadeblas | 09eaa92 | 2022-09-07 22:57:53 +0200 | [diff] [blame] | 109 | args: ['if [ ! -f "/etc/prometheus/prometheus.yml" ]; then cp /config/prometheus.yml /etc/prometheus; fi'] |
| bravof | 1e0297e | 2020-07-01 15:11:57 -0400 | [diff] [blame] | 110 | volumeMounts: |
| 111 | - name: prom-config |
| 112 | mountPath: /etc/prometheus |
| garciadeblas | 09eaa92 | 2022-09-07 22:57:53 +0200 | [diff] [blame] | 113 | - name: prom-config-base |
| 114 | mountPath: /config |
| vijaynag | 8339ed2 | 2019-07-25 17:10:58 +0530 | [diff] [blame] | 115 | containers: |
| 116 | - name: prometheus |
| garciadeblas | 0ab1661 | 2022-02-22 14:23:57 +0100 | [diff] [blame] | 117 | image: prom/prometheus:v2.28.1 |
| lavado | 7190648 | 2020-04-13 17:02:00 -0500 | [diff] [blame] | 118 | args: |
| 119 | - --config.file=/etc/prometheus/prometheus.yml |
| 120 | - --web.enable-lifecycle |
| vijaynag | 8339ed2 | 2019-07-25 17:10:58 +0530 | [diff] [blame] | 121 | ports: |
| 122 | - containerPort: 9090 |
| 123 | protocol: TCP |
| 124 | volumeMounts: |
| 125 | - name: prom-config |
| bravof | 1e0297e | 2020-07-01 15:11:57 -0400 | [diff] [blame] | 126 | mountPath: /etc/prometheus |
| vijaynag | 8339ed2 | 2019-07-25 17:10:58 +0530 | [diff] [blame] | 127 | - name: prom-db |
| 128 | mountPath: /prometheus |
| bravof | c973b57 | 2020-10-21 16:58:50 -0300 | [diff] [blame] | 129 | - name: prometheus-config-sidecar |
| garciadeblas | 89c5f55 | 2022-11-24 20:16:57 +0100 | [diff] [blame] | 130 | image: opensourcemano/prometheus:13 |
| bravof | c973b57 | 2020-10-21 16:58:50 -0300 | [diff] [blame] | 131 | env: |
| 132 | - name: MONGODB_URL |
| 133 | value: mongodb://mongodb-k8s:27017/?replicaSet=rs0 |
| 134 | - name: PROMETHEUS_CONFIG_FILE |
| 135 | value: /etc/prometheus/prometheus.yml |
| garciadeblas | 09eaa92 | 2022-09-07 22:57:53 +0200 | [diff] [blame] | 136 | - name: PROMETHEUS_BASE_CONFIG_FILE |
| 137 | value: /etc/prometheus_base/prometheus.yml |
| bravof | c973b57 | 2020-10-21 16:58:50 -0300 | [diff] [blame] | 138 | - name: TARGET_DATABASE |
| 139 | value: osm |
| 140 | - name: PROMETHEUS_URL |
| 141 | value: http://prometheus:9090 |
| 142 | volumeMounts: |
| 143 | - name: prom-config |
| 144 | mountPath: /etc/prometheus |
| garciadeblas | 09eaa92 | 2022-09-07 22:57:53 +0200 | [diff] [blame] | 145 | - name: prom-config-base |
| 146 | mountPath: /etc/prometheus_base |
| vijaynag | 8339ed2 | 2019-07-25 17:10:58 +0530 | [diff] [blame] | 147 | volumes: |
| garciadeblas | 09eaa92 | 2022-09-07 22:57:53 +0200 | [diff] [blame] | 148 | - name: prom-db |
| 149 | emptyDir: {} |
| bravof | 1e0297e | 2020-07-01 15:11:57 -0400 | [diff] [blame] | 150 | - name: prom-config |
| bravof | c973b57 | 2020-10-21 16:58:50 -0300 | [diff] [blame] | 151 | emptyDir: {} |
| garciadeblas | 09eaa92 | 2022-09-07 22:57:53 +0200 | [diff] [blame] | 152 | - name: prom-config-base |
| bravof | 9d2556f | 2020-07-03 10:01:42 -0400 | [diff] [blame] | 153 | configMap: |
| 154 | name: prom |