blob: 0172aafd8be3450c5eca80a4844b8c716a0cd1d2 [file] [log] [blame]
garciadeblas3a1db652022-09-30 12:00:27 +02001#######################################################################################
2# Copyright ETSI Contributors and Others.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13# implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#######################################################################################
17
18apiVersion: v1
19kind: Service
20metadata:
21 name: prometheus
22spec:
23 ports:
24 - nodePort: 9091
25 port: 9090
26 protocol: TCP
27 targetPort: 9090
28 selector:
29 app: prometheus
30 type: NodePort
31---
32apiVersion: v1
33data:
34 osm_rules.yml: |
35 groups:
36 - name: osm_rules
37 rules:
38 - record: vm_status_extended
aguilardcb7dc672022-11-30 13:00:32 +010039 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)
garciadeblas3a1db652022-09-30 12:00:27 +020040 labels:
41 job: osm_prometheus
42 - record: vnf_status
43 expr: (0 * (count (vm_status_extended==0) by (ns_id, vnf_id)>=0)) or (min by (ns_id, vnf_id) (vm_status_extended))
44 labels:
45 job: osm_prometheus
46 - record: ns_status
47 expr: (0 * (count (vm_status_extended==0) by (ns_id)>=0)) or (min by (ns_id) (vm_status_extended))
48 labels:
49 job: osm_prometheus
50 prometheus.yml: |
51 # Copyright 2018 The Prometheus Authors
52 # Copyright 2018 Whitestack
53 # Copyright 2018 Telefonica Investigacion y Desarrollo, S.A.U.
54 #
55 # Licensed under the Apache License, Version 2.0 (the "License");
56 # you may not use this file except in compliance with the License.
57 # You may obtain a copy of the License at
58 #
59 # http://www.apache.org/licenses/LICENSE-2.0
60 #
61 # Unless required by applicable law or agreed to in writing, software
62 # distributed under the License is distributed on an "AS IS" BASIS,
63 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
64 # See the License for the specific language governing permissions and
65 # limitations under the License.
66
67 # my global config
68 global:
69 scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
70 evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
71 # scrape_timeout is set to the global default (10s).
72
73 # Alertmanager configuration
74 alerting:
75 alertmanagers:
76 - static_configs:
77 - targets:
78 # - alertmanager:9093
79
80 # Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
81 rule_files:
82 - "osm_rules.yml"
83 # - "second_rules.yml"
84
85 # A scrape configuration containing exactly one endpoint to scrape:
86 # Here it's Prometheus itself.
87 scrape_configs:
garciadeblasbef284e2022-11-18 00:55:44 +010088 - job_name: 'mon_exporter'
89 static_configs:
90 - targets: ['mon:8000']
garciadeblas3a1db652022-09-30 12:00:27 +020091 - job_name: pushgateway
92 honor_labels: true
93 scrape_interval: 30s
94 static_configs:
95 - targets:
96 - pushgateway-prometheus-pushgateway:9091
97kind: ConfigMap
98metadata:
99 name: prom
100---
101apiVersion: apps/v1
102kind: StatefulSet
103metadata:
104 name: prometheus
105 labels:
106 app: prometheus
107spec:
108 replicas: 1
109 serviceName: prometheus
110 selector:
111 matchLabels:
112 app: prometheus
113 template:
114 metadata:
115 labels:
116 app: prometheus
117 spec:
118 initContainers:
119 - name: prometheus-init-config
120 image: busybox
121 command: ["/bin/sh", "-c"]
122 args: ['if [ ! -f "/etc/prometheus/prometheus.yml" ]; then cp /config/prometheus.yml /etc/prometheus; fi; cp /config/osm_rules.yml /etc/prometheus']
123 volumeMounts:
124 - name: prom-config
125 mountPath: /etc/prometheus
126 - name: prom-config-base
127 mountPath: /config
128 containers:
129 - name: prometheus
130 image: prom/prometheus:v2.28.1
131 args:
132 - --config.file=/etc/prometheus/prometheus.yml
133 - --web.enable-lifecycle
134 ports:
135 - containerPort: 9090
136 protocol: TCP
137 volumeMounts:
138 - name: prom-config
139 mountPath: /etc/prometheus
140 - name: prom-db
141 mountPath: /prometheus
142 - name: prometheus-config-sidecar
garciadeblas89c5f552022-11-24 20:16:57 +0100143 image: opensourcemano/prometheus:13
garciadeblas3a1db652022-09-30 12:00:27 +0200144 env:
145 - name: MONGODB_URL
146 value: mongodb://mongodb-k8s:27017/?replicaSet=rs0
147 - name: PROMETHEUS_CONFIG_FILE
148 value: /etc/prometheus/prometheus.yml
149 - name: PROMETHEUS_BASE_CONFIG_FILE
150 value: /etc/prometheus_base/prometheus.yml
151 - name: TARGET_DATABASE
152 value: osm
153 - name: PROMETHEUS_URL
154 value: http://prometheus:9090
155 volumeMounts:
156 - name: prom-config
157 mountPath: /etc/prometheus
158 - name: prom-config-base
159 mountPath: /etc/prometheus_base
160 volumes:
161 - name: prom-db
162 emptyDir: {}
163 - name: prom-config
164 emptyDir: {}
165 - name: prom-config-base
166 configMap:
167 name: prom