Skip to content

Commit 669ff86

Browse files
sfc-gh-jmckulkajmckulk
authored andcommitted
Update monitoring installer in postgres-operator
1 parent c7d3e8c commit 669ff86

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+10528
-0
lines changed

config/monitoring/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
To deploy monitoring:
2+
3+
> **_NOTE:_** For more detailed instructions on deploying, see the [documentation on installing Monitoring](https://access.crunchydata.com/documentation/postgres-operator/latest/tutorials/day-two/monitoring).
4+
5+
1. verify the namespace is correct in kustomization.yaml
6+
2. If you are deploying in openshift, comment out the fsGroup line under securityContext in the following files:
7+
- `alertmanager/deployment.yaml`
8+
- `grafana/deployment.yaml`
9+
- `prometheus/deployment.yaml`
10+
3. kubectl apply -k .
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
###
2+
#
3+
# Copyright © 2017-2025 Crunchy Data Solutions, Inc. All Rights Reserved.
4+
#
5+
###
6+
7+
# Based on upstream example file found here: https://github.com/prometheus/alertmanager/blob/master/doc/examples/simple.yml
8+
global:
9+
smtp_smarthost: 'localhost: 25'
10+
smtp_require_tls: false
11+
smtp_from: 'Alertmanager <[email protected]>'
12+
# smtp_smarthost: 'smtp.example.com:587'
13+
# smtp_from: 'Alertmanager <[email protected]>'
14+
# smtp_auth_username: '<username>'
15+
# smtp_auth_password: '<password>'
16+
17+
# templates:
18+
# - '/etc/alertmanager/template/*.tmpl'
19+
20+
inhibit_rules:
21+
# Apply inhibition of warning if the alertname for the same system and service is already critical
22+
- source_match:
23+
severity: 'critical'
24+
target_match:
25+
severity: 'warning'
26+
equal: ['alertname', 'job', 'service']
27+
28+
receivers:
29+
- name: 'default-receiver'
30+
email_configs:
31+
32+
send_resolved: true
33+
34+
## Examples of alternative alert receivers. See documentation for more info on how to configure these fully
35+
#- name: 'pagerduty-dba'
36+
# pagerduty_configs:
37+
# - service_key: <RANDOMKEYSTUFF>
38+
39+
#- name: 'pagerduty-sre'
40+
# pagerduty_configs:
41+
# - service_key: <RANDOMKEYSTUFF>
42+
43+
#- name: 'dba-team'
44+
# email_configs:
45+
46+
# send_resolved: true
47+
48+
#- name: 'sre-team'
49+
# email_configs:
50+
51+
# send_resolved: true
52+
53+
route:
54+
receiver: default-receiver
55+
group_by: [severity, service, job, alertname]
56+
group_wait: 30s
57+
group_interval: 5m
58+
repeat_interval: 24h
59+
60+
## Example routes to show how to route outgoing alerts based on the content of that alert
61+
# routes:
62+
# - match_re:
63+
# service: ^(postgresql|mysql|oracle)$
64+
# receiver: dba-team
65+
# # sub route to send critical dba alerts to pagerduty
66+
# routes:
67+
# - match:
68+
# severity: critical
69+
# receiver: pagerduty-dba
70+
#
71+
# - match:
72+
# service: system
73+
# receiver: sre-team
74+
# # sub route to send critical sre alerts to pagerduty
75+
# routes:
76+
# - match:
77+
# severity: critical
78+
# receiver: pagerduty-sre
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: crunchy-alertmanager
5+
spec:
6+
selector: {}
7+
template:
8+
spec:
9+
containers:
10+
- name: alertmanager
11+
image: prom/alertmanager:v0.28.1
12+
args:
13+
- --config.file=/etc/alertmanager/alertmanager.yml
14+
- --storage.path=/alertmanager
15+
- --log.level=info
16+
- --cluster.advertise-address=0.0.0.0:9093
17+
livenessProbe:
18+
httpGet:
19+
path: /-/healthy
20+
port: 9093
21+
initialDelaySeconds: 25
22+
periodSeconds: 20
23+
ports:
24+
- containerPort: 9093
25+
readinessProbe:
26+
httpGet:
27+
path: /-/ready
28+
port: 9093
29+
volumeMounts:
30+
- mountPath: /etc/alertmanager
31+
name: alertmanagerconf
32+
- mountPath: /alertmanager
33+
name: alertmanagerdata
34+
securityContext:
35+
fsGroup: 26
36+
# supplementalGroups:
37+
# - 65534
38+
serviceAccountName: alertmanager
39+
volumes:
40+
- name: alertmanagerdata
41+
persistentVolumeClaim:
42+
claimName: alertmanagerdata
43+
- name: alertmanagerconf
44+
configMap:
45+
defaultMode: 420
46+
name: alertmanager-config
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
4+
labels:
5+
- includeSelectors: true
6+
pairs:
7+
app.kubernetes.io/component: crunchy-alertmanager
8+
9+
resources:
10+
- deployment.yaml
11+
- pvc.yaml
12+
- service.yaml
13+
- serviceaccount.yaml
14+
15+
configMapGenerator:
16+
- name: alertmanager-config
17+
files:
18+
- config/alertmanager.yml
19+
20+
generatorOptions:
21+
disableNameSuffixHash: true
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: v1
2+
kind: PersistentVolumeClaim
3+
metadata:
4+
name: alertmanagerdata
5+
spec:
6+
accessModes:
7+
- ReadWriteOnce
8+
resources:
9+
requests:
10+
storage: 5Gi
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: crunchy-alertmanager
5+
spec:
6+
type: ClusterIP
7+
ports:
8+
- name: alertmanager
9+
port: 9093
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: v1
2+
kind: ServiceAccount
3+
metadata:
4+
name: alertmanager
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
###
2+
#
3+
# Copyright © 2017-2025 Crunchy Data Solutions, Inc. All Rights Reserved.
4+
#
5+
###
6+
7+
# config file version
8+
apiVersion: 1
9+
10+
datasources:
11+
- name: PROMETHEUS
12+
type: prometheus
13+
access: proxy
14+
url: http://$PROM_HOST:$PROM_PORT
15+
isDefault: True
16+
editable: False
17+
orgId: 1
18+
version: 1
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
###
2+
#
3+
# Copyright © 2017-2025 Crunchy Data Solutions, Inc. All Rights Reserved.
4+
#
5+
###
6+
apiVersion: 1
7+
8+
providers:
9+
- name: 'crunchy_dashboards'
10+
orgId: 1
11+
folder: ''
12+
type: file
13+
disableDeletion: false
14+
updateIntervalSeconds: 3 #how often Grafana will scan for changed dashboards
15+
options:
16+
path: /etc/grafana/provisioning/dashboards
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
4+
# We must break the files up into two ConfigMaps as the total size
5+
# is too large for one ConfigMap
6+
configMapGenerator:
7+
- name: grafana-dashboards-1
8+
files:
9+
- pgbackrest.json
10+
- pgbouncer_direct.json
11+
- pod_details.json
12+
- postgresql_details.json
13+
- postgresql_overview.json
14+
- postgresql_service_health.json
15+
- prometheus_alerts.json
16+
- name: grafana-dashboards-2
17+
files:
18+
- crunchy_grafana_dashboards.yml
19+
- query_statistics.json
20+
21+
generatorOptions:
22+
disableNameSuffixHash: true

0 commit comments

Comments
 (0)