@leverege/build-tools 2.54.1 → 2.55.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/package.json +5 -5
  2. package/registry-compass.yaml +20 -0
  3. package/src/chart-compass.mjs +96 -0
  4. package/src/helm-charts/elasticsearch8/helmup.plugin +2 -21
  5. package/src/helm-charts/prom-operator/.nohelm +0 -0
  6. package/src/helm-charts/prom-operator/.nohelmdn +0 -0
  7. package/src/helm-charts/prom-operator/apply-rules +13 -0
  8. package/src/helm-charts/prom-operator/elasticsearch-exporter.yaml +20 -0
  9. package/src/helm-charts/prom-operator/gitignore +2 -0
  10. package/src/helm-charts/prom-operator/helmdn.plugin +17 -0
  11. package/src/helm-charts/prom-operator/helmup.plugin +27 -0
  12. package/src/helm-charts/prom-operator/prometheus-stack.yaml.ovh +137 -0
  13. package/src/helm-charts/prom-operator/rules/elasticsearch-rules.yaml +111 -0
  14. package/src/helm-charts/prom-operator/rules/gcp-rules.yaml +47 -0
  15. package/src/helm-charts/prom-operator/rules/kubernetes-rules.yaml +112 -0
  16. package/src/helm-charts/prom-operator/rules/leverege-rules.yaml +20 -0
  17. package/src/helm-charts/prom-operator/rules/postgres-rules.yaml +190 -0
  18. package/src/helm-charts/prom-operator/rules/prometheus-rules.yaml +79 -0
  19. package/src/helm-charts/prom-operator/rules/redis-rules.yaml +90 -0
  20. package/src/helm-charts/prom-operator/rules/test-alert.yaml +18 -0
  21. package/src/helm-charts/prom-operator/rules/traefik-rules.yaml +28 -0
  22. package/src/helm-charts/prom-operator/rules/velero-rules.yaml +28 -0
  23. package/src/helm-charts/prom-operator/stackdriver-exporter.yaml.ovh +57 -0
  24. package/src/helm-charts/redis/helmup.plugin +1 -1
  25. package/src/helm-charts/redis/redis-local.yaml +8 -0
  26. package/src/helm-charts/traefik/helmup.plugin +2 -2
  27. package/src/helmup.sh +11 -4
  28. package/src/overwhelm.mjs +8 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leverege/build-tools",
3
- "version": "2.54.1",
3
+ "version": "2.55.1",
4
4
  "description": "A collection of build / support tools for Leverege developers",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -63,13 +63,13 @@
63
63
  "command-line-usage": "^7.0.3",
64
64
  "deepmerge": "^4.3.1",
65
65
  "enquirer": "^2.4.1",
66
- "execa": "^9.4.0",
66
+ "execa": "^9.4.1",
67
67
  "glob": "^11.0.0",
68
68
  "handlebars": "^4.7.8",
69
- "inquirer": "^12.0.0",
69
+ "inquirer": "^12.0.1",
70
70
  "js-yaml": "^4.1.0",
71
71
  "ms": "^2.1.3",
72
- "npm-registry-fetch": "^18.0.1",
72
+ "npm-registry-fetch": "^18.0.2",
73
73
  "package-up": "^5.0.0",
74
74
  "parse-gitignore": "^2.0.0",
75
75
  "read-pkg": "^9.0.1",
@@ -82,4 +82,4 @@
82
82
  "@leverege/eslint-config-leverege": "^4.2.0",
83
83
  "npm": "^10.9.0"
84
84
  }
85
- }
85
+ }
@@ -0,0 +1,20 @@
1
+ registry:
2
+ - root: us-docker.pkg.dev
3
+ - repositories:
4
+ - name: stack
5
+ charts:
6
+ - api-server
7
+ - authz-server
8
+ - emailer
9
+ - message-processor
10
+ - name: leverege
11
+ charts:
12
+ - pubsub-pulse
13
+ - pusher
14
+ - overdose
15
+ - name: cox-health
16
+ charts:
17
+ - actions-server
18
+ - analytics-server
19
+ - centrak-healthz
20
+ - centrak-ingestor
@@ -0,0 +1,96 @@
1
+ #!/usr/bin/env node
2
+ /*
3
+ * chart-to-registry will...
4
+ */
5
+ import fs from 'node:fs'
6
+
7
+ import chalk from 'chalk'
8
+ import commandLineArgs from 'command-line-args'
9
+ import commandLineUsage from 'command-line-usage'
10
+ import { lt as semverLt } from 'semver'
11
+ import YAML from 'js-yaml'
12
+
13
+ import {
14
+ condir,
15
+ debug,
16
+ errorExit,
17
+ log,
18
+ warning,
19
+ getGitRootDirectory,
20
+ parsePackageJson,
21
+ parseHelmChart,
22
+ shellCmd } from './Utils.mjs'
23
+
24
+ const commandLineOptions = [ // Use commandLineOptions to tie into the Usage statements
25
+ /* eslint-disable max-len */
26
+ {
27
+ name : 'location',
28
+ type : String,
29
+ description : '{green the location of the artifact registry the chart will be pushed to (default us-docker.pkg.dev)}',
30
+ },
31
+ {
32
+ name : 'project',
33
+ type : String,
34
+ description : '{green the name of the google project containing the npmrc and slack config secrets (default leverege-registry)}',
35
+ },
36
+ {
37
+ name : 'repository',
38
+ type : String,
39
+ description : '{green the target repository to receive the pushed chart}',
40
+ },
41
+ {
42
+ name : 'dry-run',
43
+ type : Boolean,
44
+ description : '{yellow perform everything except the actual chart push}',
45
+ },
46
+ {
47
+ name : 'help',
48
+ type : Boolean,
49
+ description : '{green display this help screen}',
50
+ },
51
+ /* eslint-enable max-len */
52
+ ]
53
+
54
+ const sections = [
55
+ {
56
+ header : 'Leverege Helm Chart Compass (for helmup)',
57
+ content : `{green This tool helps helmup navigate the helm charts stored in the
58
+ artifact-registries.}`
59
+ },
60
+ { header : 'Options',
61
+ optionList : commandLineOptions,
62
+ },
63
+ ]
64
+
65
+ const args = commandLineArgs( commandLineOptions, { camelCase : true, partial : true } )
66
+ const usage = commandLineUsage( sections )
67
+
68
+ if ( args.help ) {
69
+ log( usage )
70
+ process.exit( 0 )
71
+ }
72
+
73
+ /* eslint-disable no-underscore-dangle */
74
+ if ( args._unknown ) {
75
+ log( usage )
76
+ log( `\nUnrecognized argument [${chalk.bold.red( args._unknown )}]\n` )
77
+ process.exit( 1 )
78
+ }
79
+ /* eslint-enable no-underscore-dangle */
80
+
81
+ const minNodejsVersion = '18.0.0'
82
+ if ( semverLt( process.version, minNodejsVersion ) ) {
83
+ errorExit( `\n***ERROR: must be running at least node ${minNodejsVersion}\n` )
84
+ }
85
+
86
+ // First of all, fail if we are not in a git repository
87
+ let gitRoot
88
+ try {
89
+ gitRoot = await getGitRootDirectory()
90
+ } catch ( error ) {
91
+ errorExit( chalk.red.bold( error ), { errorCode : 5 } )
92
+ }
93
+
94
+ const chartCompass = YAML.load( fs.readFileSync( './registry-compass.yaml', 'utf8' ) )
95
+
96
+ condir( { chartCompass }, '<==Navigation' )
@@ -15,24 +15,5 @@ helm upgrade --install elasticsearch8 $OCI_CHART \
15
15
  --values $LOCAL_ES_VALUES \
16
16
  --version $ELASTIC_CHART_VERSION $HELM_WHAT
17
17
 
18
- ## Installing ES8 exporter
19
- addHelmRepo prometheus-community https://prometheus-community.github.io/helm-charts
20
- helm upgrade --install elasticsearch8-exporter prometheus-community/prometheus-elasticsearch-exporter \
21
- --namespace monitoring --create-namespace \
22
- --version 6 \
23
- -f - <<ELASTIC8_EXPORTER_CHART_MOD
24
- fullnameOverride: elasticsearch8-exporter
25
-
26
- service:
27
- annotations:
28
- prometheus.io/port: "9108"
29
- prometheus.io/scrape: "true"
30
- es:
31
- uri: http://elasticsearch8.elastic.svc.cluster.local:9200
32
-
33
- resources:
34
- requests:
35
- cpu: 50m
36
- memory: 32Mi
37
- ELASTIC8_EXPORTER_CHART_MOD
38
- removeHelmRepo prometheus-community
18
+ ## Installing ES8 exporter into monitoring namespace
19
+ installElasticsearchExporter
File without changes
File without changes
@@ -0,0 +1,13 @@
1
+ #!/bin/bash
2
+ #
3
+ # Load the standard helper functions
4
+ . `build-tools --bashfun`
5
+
6
+ RULES_DIR="prom-operator/rules"
7
+
8
+ [ ! -d "$RULES_DIR" ] && errorExit "Missing rules directory [$RULES_DIR]"
9
+
10
+ for ruleset in $RULES_DIR/*.yaml; do
11
+ printf " Applying rules => `color g $ruleset`\n"
12
+ kubectl apply -n prometheus -f $ruleset
13
+ done
@@ -0,0 +1,20 @@
1
+ # https://artifacthub.io/packages/helm/prometheus-community/prometheus-elasticsearch-exporter?modal=values
2
+ #
3
+ fullnameOverride: prometheus-stack-elasticsearch8-metrics
4
+
5
+ service:
6
+ annotations:
7
+ prometheus.io/port: "9108"
8
+ prometheus.io/scrape: "true"
9
+ es:
10
+ uri: http://elasticsearch8.elastic.svc.cluster.local:9200
11
+
12
+ resources:
13
+ requests:
14
+ cpu: 50m
15
+ memory: 32Mi
16
+
17
+ serviceMonitor:
18
+ enabled: true
19
+ namespace: prometheus
20
+ interval: 30s
@@ -0,0 +1,2 @@
1
+ prometheus-stack.yaml
2
+ stackdriver-exporter.yaml
@@ -0,0 +1,17 @@
1
+ #!/bin/bash
2
+ #
3
+ # This will uninstall of the the operator components...
4
+ helm uninstall -n prometheus prometheus-stack elasticsearch8-exporter stackdriver-exporter
5
+
6
+ # including all CRDs and configs
7
+ kubectl delete crd \
8
+ alertmanagerconfigs.monitoring.coreos.com \
9
+ alertmanagers.monitoring.coreos.com \
10
+ podmonitors.monitoring.coreos.com \
11
+ probes.monitoring.coreos.com \
12
+ prometheusagents.monitoring.coreos.com \
13
+ prometheuses.monitoring.coreos.com \
14
+ prometheusrules.monitoring.coreos.com \
15
+ scrapeconfigs.monitoring.coreos.com \
16
+ servicemonitors.monitoring.coreos.com \
17
+ thanosrulers.monitoring.coreos.com
@@ -0,0 +1,27 @@
1
+ #!/bin/bash
2
+ #
3
+ showInstalling "The Prometheus Operator and Components"
4
+ addHelmRepo prometheus-community https://prometheus-community.github.io/helm-charts
5
+
6
+ showInstalling "The Prometheus Operator (kube-prometheus-stack)"
7
+ [ -z "$PROMETHEUS_STACK_CHART_VERSION" ] && PROMETHEUS_STACK_CHART_VERSION="65"
8
+ helm upgrade --install prometheus-stack prometheus-community/kube-prometheus-stack \
9
+ --namespace prometheus --create-namespace \
10
+ --values prom-operator/prometheus-stack.yaml \
11
+ --version $PROMETHEUS_STACK_CHART_VERSION $HELM_WHAT
12
+
13
+ showInstalling "The Elasticsearch Exporter (prom-operator)"
14
+ [ -z "$ELASTICSEARCH_EXPORTER_CHART_VERSION" ] && ELASTICSEARCH_EXPORTER_CHART_VERSION="4"
15
+ helm upgrade --install elasticsearch8-exporter prometheus-community/prometheus-elasticsearch-exporter \
16
+ --namespace prometheus --create-namespace \
17
+ --values prom-operator/elasticsearch-exporter.yaml \
18
+ --version $ELASTICSEARCH_EXPORTER_CHART_VERSION $HELM_WHAT
19
+
20
+ showInstalling "The Stackdriver Exporter (prom-operator)"
21
+ [ -z "$STACKDRIVER_EXPORTER_CHART_VERSION" ] && STACKDRIVER_EXPORTER_CHART_VERSION="4"
22
+ helm upgrade --install stackdriver-exporter prometheus-community/prometheus-stackdriver-exporter \
23
+ --namespace prometheus --create-namespace \
24
+ --values prom-operator/stackdriver-exporter.yaml \
25
+ --version $STACKDRIVER_EXPORTER_CHART_VERSION $HELM_WHAT
26
+
27
+ removeHelmRepo prometheus-community
@@ -0,0 +1,137 @@
1
+ enabled: true
2
+ kubeControllerManager:
3
+ enabled: false
4
+ nodeExporter:
5
+ enabled: false
6
+ defaultRules:
7
+ create: true
8
+ rules:
9
+ alertmanager: false
10
+ etcd: false
11
+ configReloaders: false
12
+ general: true
13
+ k8s: true
14
+ kubeApiserver: true # GPT Keep an eye on API server availability
15
+ kubeApiserverAvailability: false
16
+ kubeApiserverSlos: false
17
+ kubelet: true # GPT Consider monitoring kubelet status, especially on scaled nodes
18
+ kubeProxy: false
19
+ kubePrometheusGeneral: false
20
+ kubePrometheusNodeRecording: false
21
+ kubernetesApps: false
22
+ kubernetesResources: false
23
+ kubernetesStorage: false
24
+ kubernetesSystem: false
25
+ kubeScheduler: false
26
+ kubeStateMetrics: true
27
+ network: false
28
+ node: false
29
+ nodeExporterAlerting: false
30
+ nodeExporterRecording: false
31
+ prometheus: false
32
+ prometheusOperator: false
33
+
34
+ prometheus:
35
+ prometheusSpec:
36
+ podMonitorSelectorNilUsesHelmValues: false
37
+ ruleSelectorNilUsesHelmValues: false
38
+ serviceMonitorSelectorNilUsesHelmValues: false
39
+ probeSelectorNilUsesHelmValues: false
40
+
41
+ # default is using kube-dns which is usually sufficient for our needs but
42
+ # can be switched over to CoreDNS if the need arises
43
+ coreDns:
44
+ enabled: false
45
+
46
+ # managed GKE does not provide direct access to the k8s scheduler so we
47
+ # can safely disable this here - see the Stackdrive Monitoring for more
48
+ kubeScheduler:
49
+ enabled: false
50
+
51
+ grafana:
52
+ enabled: true
53
+ service:
54
+ port: 3000
55
+ # -- the grafana admin password
56
+ adminPassword: prom-operator
57
+ defaultDashboardsEnabled: false
58
+ sidecar:
59
+ dashboards:
60
+ enabled: true
61
+ extraObjects:
62
+ - apiVersion: traefik.io/v1alpha1
63
+ kind: IngressRoute
64
+ metadata:
65
+ name: grafana
66
+ namespace: prometheus
67
+ spec:
68
+ entryPoints:
69
+ - websecure
70
+ routes:
71
+ - match: Host(`OVH:<PROJECT_NAME>-monitoring.OVH:<HOST>.com`)
72
+ kind: Rule
73
+ services:
74
+ - name: prometheus-stack-grafana
75
+ port: 3000
76
+
77
+ alertmanager:
78
+ enabled: true
79
+ affinity:
80
+ nodeAffinity:
81
+ requiredDuringSchedulingIgnoredDuringExecution:
82
+ nodeSelectorTerms:
83
+ - matchExpressions:
84
+ - key: target-env
85
+ operator: In
86
+ values:
87
+ - database
88
+ tolerations:
89
+ - key: "database"
90
+ operator: "Equal"
91
+ value: "true"
92
+ effect: "NoSchedule"
93
+
94
+ strategy:
95
+ type: Recreate
96
+
97
+ config:
98
+ receivers:
99
+ - name: slack
100
+ slack_configs:
101
+ - channel: "OVH:<SLACK_CHANNEL>"
102
+ api_url: "OVH:<SLACK_HOOK_URL>"
103
+ username: "OVH:<PROJECT_NAME>"
104
+ fallback: "OVH:<PROJECT_NAME> - {{ .CommonAnnotations.summary }}"
105
+ title: "{{ range .Alerts }}{{ .Annotations.summary }}\n{{ end }}"
106
+ title_link: "https://bitbucket.org/leverege/sre-playbook/src/master/"
107
+ send_resolved: true
108
+ text: |-
109
+ {{ range .Alerts }}
110
+ *Alert:* {{ .Annotations.summary }} - `{{ .Labels.severity }}`
111
+ *Description:* {{ .Annotations.description }}
112
+ *Dashboard:* {{ .Annotations.dashboard }}
113
+ {{ end }}
114
+ - name: opsgenie
115
+ opsgenie_configs:
116
+ - api_key: "OVH:<OPSGENIE_APIKEY>"
117
+ priority: "{{ .CommonLabels.priority }}"
118
+ tags: "{{ range .Alerts }}{{ .Labels.severity }},{{ end }}"
119
+ description: |-
120
+ {{ range .Alerts }}
121
+ *Alert:* {{ .Annotations.summary }} - `{{ .Labels.severity }}`
122
+ *Description:* {{ .Annotations.description }}
123
+ *Dashboard:* {{ .Annotations.dashboard }}
124
+ {{ end }}
125
+
126
+ route:
127
+ group_wait: 30s
128
+ group_interval: 5m
129
+ group_by:
130
+ - alertname
131
+ - cluster
132
+ receiver: slack
133
+ routes:
134
+ - match:
135
+ severity: page
136
+ receiver: opsgenie
137
+ repeat_interval: 6h
@@ -0,0 +1,111 @@
1
+ apiVersion: monitoring.coreos.com/v1
2
+ kind: PrometheusRule
3
+ metadata:
4
+ name: elasticsearch-rules
5
+ namespace: prometheus
6
+
7
+ spec:
8
+ groups:
9
+ - name: Elasticsearch Alerts
10
+ rules:
11
+ - alert: ElasticsearchHeapUsageTooHigh
12
+ expr: (elasticsearch_jvm_memory_used_bytes{area="heap"} / elasticsearch_jvm_memory_max_bytes{area="heap"}) * 100 > 90
13
+ for: 5m
14
+ labels:
15
+ severity: page
16
+ priority: P3
17
+ annotations:
18
+ summary: "Elasticsearch Heap Usage Too High (instance {{ $labels.instance }})"
19
+ description: "The heap usage is over 90% for 5m (currently at {{ $value }}% )"
20
+ dashboard: "OVH:<MONITORING>/elasticsearch"
21
+
22
+ - alert: ElasticsearchHeapUsageWarning
23
+ expr: (elasticsearch_jvm_memory_used_bytes{area="heap"} / elasticsearch_jvm_memory_max_bytes{area="heap"}) * 100 > 80
24
+ for: 5m
25
+ labels:
26
+ severity: warning
27
+ annotations:
28
+ summary: "Elasticsearch Heap Usage warning (instance {{ $labels.instance }})"
29
+ description: "The heap usage is over 80% for 5m (currently at {{ $value }}% )"
30
+ dashboard: "OVH:<MONITORING>/elasticsearch"
31
+
32
+ - alert: ElasticsearchDiskSpaceLow
33
+ expr: elasticsearch_filesystem_data_available_bytes / elasticsearch_filesystem_data_size_bytes * 100 < 20
34
+ for: 5m
35
+ labels:
36
+ severity: warning
37
+ annotations:
38
+ summary: "Elasticsearch disk space low (instance {{ $labels.instance }})"
39
+ description: "The disk usage is over 80% (currently at {{ $value }}% )"
40
+ dashboard: "OVH:<MONITORING>/elasticsearch"
41
+
42
+ - alert: ElasticsearchDiskOutOfSpace
43
+ expr: elasticsearch_filesystem_data_available_bytes / elasticsearch_filesystem_data_size_bytes * 100 < 10
44
+ for: 5m
45
+ labels:
46
+ severity: page
47
+ priority: P3
48
+ annotations:
49
+ summary: "Elasticsearch disk out of space (instance {{ $labels.instance }})"
50
+ description: "The disk usage is over 90% (currently at {{ $value }}% )"
51
+ dashboard: "OVH:<MONITORING>/elasticsearch"
52
+
53
+ - alert: ElasticsearchClusterRed
54
+ expr: elasticsearch_cluster_health_status{color="red"} == 1
55
+ for: 5m
56
+ labels:
57
+ severity: error
58
+ annotations:
59
+ summary: "Elasticsearch Cluster Red (instance {{ $labels.instance }})"
60
+ description: "Elastic Cluster is in an unhealthy state"
61
+ dashboard: "OVH:<MONITORING>/elasticsearch"
62
+
63
+ - alert: ElasticsearchClusterYellow
64
+ expr: elasticsearch_cluster_health_status{color="yellow"} == 1
65
+ for: 5m
66
+ labels:
67
+ severity: warning
68
+ annotations:
69
+ summary: "Elasticsearch Cluster Yellow (instance {{ $labels.instance }})"
70
+ description: "Elastic Cluster is in an unhealthy state"
71
+ dashboard: "OVH:<MONITORING>/elasticsearch"
72
+
73
+ - alert: ElasticsearchRelocationShards
74
+ expr: elasticsearch_cluster_health_relocating_shards > 0
75
+ for: 5m
76
+ labels:
77
+ severity: error
78
+ annotations:
79
+ summary: "Elasticsearch relocation shards (instance {{ $labels.instance }})"
80
+ description: "Number of relocation shards for 20 min is {{ $value }}"
81
+ dashboard: "OVH:<MONITORING>/elasticsearch"
82
+
83
+ - alert: ElasticsearchInitializingShards
84
+ expr: elasticsearch_cluster_health_initializing_shards > 0
85
+ for: 5m
86
+ labels:
87
+ severity: warning
88
+ annotations:
89
+ summary: "Elasticsearch initializing shards (instance {{ $labels.instance }})"
90
+ description: "Number of initializing shards for 10 min is {{ $value }}"
91
+ dashboard: "OVH:<MONITORING>/elasticsearch"
92
+
93
+ - alert: ElasticsearchUnassignedShards
94
+ expr: elasticsearch_cluster_health_unassigned_shards > 0
95
+ for: 5m
96
+ labels:
97
+ severity: error
98
+ annotations:
99
+ summary: "Elasticsearch unassigned shards (instance {{ $labels.instance }})"
100
+ description: "Number of unassigned shards for 2 min is {{ $value }}"
101
+ dashboard: "OVH:<MONITORING>/elasticsearch"
102
+
103
+ - alert: ElasticsearchPendingTasks
104
+ expr: elasticsearch_cluster_health_number_of_pending_tasks > 0
105
+ for: 5m
106
+ labels:
107
+ severity: warning
108
+ annotations:
109
+ summary: "Elasticsearch pending tasks (instance {{ $labels.instance }})"
110
+ description: "Number of pending tasks for 10 min is {{ $value }}. Cluster is working slowly."
111
+ dashboard: "OVH:<MONITORING>/elasticsearch"
@@ -0,0 +1,47 @@
1
+ apiVersion: monitoring.coreos.com/v1
2
+ kind: PrometheusRule
3
+ metadata:
4
+ name: gcp-rules
5
+ namespace: prometheus
6
+
7
+ spec:
8
+ groups:
9
+ - name: GCP
10
+ rules:
11
+ - alert: StackdriverFailedScrape
12
+ expr: absent(stackdriver_pubsub_topic_pubsub_googleapis_com_topic_message_sizes_count) == 1
13
+ for: 10m
14
+ labels:
15
+ severity: warning
16
+ annotations:
17
+ summary: "Stackdriver metrics unavailable"
18
+ description: "Prometheus failed to scrape Stackdriver metrics"
19
+ dashboard: "Use Stackdriver Monitoring on GCP UI"
20
+ - alert: HighFirebaseLoad
21
+ expr: stackdriver_firebase_namespace_firebasedatabase_googleapis_com_io_database_load > 0.9
22
+ for: 5m
23
+ labels:
24
+ severity: warning
25
+ annotations:
26
+ summary: "High Firebase load detected"
27
+ description: "Firebase load is above 90% (current value is: {{ $value | humanize }}%)"
28
+ dashboard: "OVH:<MONITORING>/firebase"
29
+ - alert: PubSubUndeliveredMessages
30
+ expr: sum(stackdriver_pubsub_subscription_pubsub_googleapis_com_subscription_num_undelivered_messages) by (subscription_id) > 1000
31
+ for: 5m
32
+ labels:
33
+ severity: page
34
+ priority: P3
35
+ annotations:
36
+ summary: "High Number of Undelivered Messages on PubSub"
37
+ description: "Undelivered message count on topic {{$labels.subscription_id}} is greater than 1000"
38
+ dashboard: "OVH:<MONITORING>/stackdriver"
39
+ - alert: PubSubOldUnackedMessages
40
+ expr: stackdriver_pubsub_subscription_pubsub_googleapis_com_subscription_oldest_unacked_message_age > 900
41
+ for: 5m
42
+ labels:
43
+ severity: warning
44
+ annotations:
45
+ summary: "Old messages left unacked on PubSub"
46
+ description: "Messages on {{$labels.subscription_id}} has been unacked for more than 15m"
47
+ dashboard: "OVH:<MONITORING>/stackdriver"
@@ -0,0 +1,112 @@
1
+ apiVersion: monitoring.coreos.com/v1
2
+ kind: PrometheusRule
3
+ metadata:
4
+ name: kubernetes-rules
5
+ namespace: prometheus
6
+
7
+ spec:
8
+ groups:
9
+ - name: Kubernetes
10
+ rules:
11
+ - alert: KubernetesNodeNotReady
12
+ expr: kube_node_status_condition{condition="Ready",status="true"} == 0
13
+ for: 5m
14
+ labels:
15
+ severity: page
16
+ priority: P3
17
+ annotations:
18
+ summary: "Kubernetes Node is not ready"
19
+ description: "Node {{ $labels.node }} is stuck in unready state for more than 5m"
20
+ dashboard: "Check GKE or EKS node status"
21
+
22
+ - alert: KubernetesMemoryPressure
23
+ expr: kube_node_status_condition{condition="MemoryPressure",status="true"} == 1
24
+ for: 5m
25
+ labels:
26
+ severity: error
27
+ annotations:
28
+ summary: "Kubernetes memory pressure"
29
+ description: "{{ $labels.node }} has a MemoryPressure condition"
30
+ dashboard: "Check GKE or EKS node status"
31
+
32
+ - alert: KubernetesDiskPressure
33
+ expr: kube_node_status_condition{condition="DiskPressure",status="true"} == 1
34
+ for: 5m
35
+ labels:
36
+ severity: error
37
+ annotations:
38
+ summary: "Kubernetes disk pressure"
39
+ description: "{{ $labels.node }} has DiskPressure condition"
40
+ dashboard: "Check GKE or EKS node status"
41
+
42
+ - alert: KubernetesOutOfDisk
43
+ expr: kube_node_status_condition{condition="OutOfDisk",status="true"} == 1
44
+ for: 5m
45
+ labels:
46
+ severity: error
47
+ annotations:
48
+ summary: "Kubernetes out of disk"
49
+ description: "{{ $labels.node }} has is out of disk space"
50
+ dashboard: "Check GKE or EKS node status"
51
+
52
+ - alert: KubernetesVolumeOutOfDiskSpace
53
+ expr: kubelet_volume_stats_available_bytes / kubelet_volume_stats_capacity_bytes * 100 < 10
54
+ for: 5m
55
+ labels:
56
+ severity: error
57
+ priority: P2
58
+ annotations:
59
+ summary: "Kubernetes PVC Free Space < 10%"
60
+ description: "PVC volume {{ $labels.persistentvolumeclaim }} is almost full - down to {{ $value | humanize }}% available"
61
+ dashboard: "OVH:<MONITORING>/k8s-pvc/pvc-usage?var-volume={{ $labels.persistentvolumeclaim }}"
62
+
63
+ # - alert: KubernetesVolumeFullInFourDays
64
+ # expr: predict_linear(kubelet_volume_stats_available_bytes[6h], 4 * 24 * 3600) < 0
65
+ # for: 5m
66
+ # labels:
67
+ # severity: error
68
+ # annotations:
69
+ # summary: "Kubernetes Volume full in four days "
70
+ # description: "{{ $labels.namespace }}/{{ $labels.persistentvolumeclaim }} is expected to fill up within four days. Currently {{ $value | humanize }}% is available."
71
+ # dashboard: "OVH:<MONITORING>/pvc"
72
+
73
+ - alert: KubernetesPersistentvolumeError
74
+ expr: kube_persistentvolume_status_phase{phase=~"Failed|Pending",job="kube-state-metrics"} > 0
75
+ for: 5m
76
+ labels:
77
+ severity: error
78
+ annotations:
79
+ summary: "Kubernetes PersistentVolume error "
80
+ description: "PersistentVolumeClaim {{ $labels.namespace }}/{{ $labels.persistentvolumeclaim }} is stuck pending"
81
+ dashboard: "Check GKE or EKS PVC/storage status"
82
+
83
+ - alert: KubernetesHpaScaleCapability
84
+ expr: kube_hpa_status_desired_replicas >= kube_hpa_spec_max_replicas
85
+ for: 15m
86
+ labels:
87
+ severity: warning
88
+ annotations:
89
+ summary: "Kubernetes HPA scale capability"
90
+ description: "Kubernetes has scaled {{ $labels.hpa }} to max number of scaled pods."
91
+ dashboard: "OVH:<MONITORING>/k8-deployment"
92
+
93
+ - alert: KubernetesPodNotHealthy
94
+ expr: kube_pod_status_phase{phase=~"Pending|Unknown|Failed"} == 1
95
+ for: 20m
96
+ labels:
97
+ severity: error
98
+ annotations:
99
+ summary: "Kubernetes Pod not healthy"
100
+ description: "Pod {{ $labels.pod }} has been in a non-ready state for longer than 20 minutes."
101
+ dashboard: "Check the pod status using the Kubernetes UI"
102
+
103
+ - alert: KubernetesPodCrashLooping
104
+ expr: rate(kube_pod_container_status_restarts_total[15m]) * 60 * 5 > 5
105
+ for: 5m
106
+ labels:
107
+ severity: page
108
+ priority: P2
109
+ annotations:
110
+ summary: "Kubernetes pod crash looping"
111
+ description: "{{ $labels.pod }} is in a crash loop"
112
+ dashboard: "Check the pod status using the Kubernetes UI"
@@ -0,0 +1,20 @@
1
+ apiVersion: monitoring.coreos.com/v1
2
+ kind: PrometheusRule
3
+ metadata:
4
+ name: leverege-rules
5
+ namespace: prometheus
6
+
7
+ spec:
8
+ groups:
9
+ - name: Leverege
10
+ rules:
11
+ - alert: frequent_app_restarts
12
+ expr: rate(nodejs_app_exit_count[15m]) * 60 * 5 > 5
13
+ for: 1m
14
+ labels:
15
+ severity: page
16
+ priority: P2
17
+ annotations:
18
+ summary: Apps are restarting frequently
19
+ description: "{{ $labels.app }} is in a crash loop"
20
+ dashboard: "OVH:<MONITORING>/stackdriver"
@@ -0,0 +1,190 @@
1
+ apiVersion: monitoring.coreos.com/v1
2
+ kind: PrometheusRule
3
+ metadata:
4
+ name: postgres-rules
5
+ namespace: prometheus
6
+
7
+ spec:
8
+ groups:
9
+ - name: Postgres
10
+ rules:
11
+ - alert: PostgresqlDown
12
+ expr: pg_up == 0
13
+ for: 5m
14
+ labels:
15
+ severity: page
16
+ priority: P3
17
+ annotations:
18
+ summary: "Postgresql down"
19
+ description: "Postgresql instance is down: check {{ $labels.release }}"
20
+ dashboard: "OVH:<MONITORING>/postgres"
21
+
22
+ - alert: PostgresqlRestarted
23
+ expr: time() - pg_postmaster_start_time_seconds < 60
24
+ for: 5m
25
+ labels:
26
+ severity: error
27
+ annotations:
28
+ summary: "Postgresql restarted"
29
+ description: "Postgresql restarted: check {{ $labels.release }}"
30
+ dashboard: "OVH:<MONITORING>/postgres"
31
+
32
+ - alert: PostgresqlExporterError
33
+ expr: pg_exporter_last_scrape_error > 0
34
+ for: 5m
35
+ labels:
36
+ severity: warning
37
+ annotations:
38
+ summary: "Postgresql exporter error for {{ $labels.release }}"
39
+ description: "Postgresql exporter is showing errors. Metrics may be outdated"
40
+ dashboard: "OVH:<MONITORING>/postgres"
41
+
42
+ - alert: PostgresqlReplicationLag
43
+ expr: (pg_replication_lag > 10) and ON(instance) (pg_replication_is_replica == 1)
44
+ for: 5m
45
+ labels:
46
+ severity: warning
47
+ annotations:
48
+ summary: "Postgresql replication lag"
49
+ description: "PostgreSQL replication lag is going up (> 10s): check {{ $labels.release }}"
50
+ dashboard: "OVH:<MONITORING>/postgres"
51
+
52
+ - alert: PostgresqlTableNotVacuumed
53
+ expr: (pg_stat_user_tables_last_autovacuum > 0) and (time() - pg_stat_user_tables_last_autovacuum > 60 * 60 * 24)
54
+ for: 5m
55
+ labels:
56
+ severity: warning
57
+ annotations:
58
+ summary: "Postgresql table not vacuumed"
59
+ description: "Table has not been vacuum for 24 hours: check {{ $labels.instance }}"
60
+ dashboard: "OVH:<MONITORING>/postgres"
61
+
62
+ - alert: PostgresqlTableNotAutoAnalyzed
63
+ expr: (pg_stat_user_tables_last_autoanalyze > 0) and (time() - pg_stat_user_tables_last_autoanalyze > 60 * 60 * 24)
64
+ for: 5m
65
+ labels:
66
+ severity: warning
67
+ annotations:
68
+ summary: "Postgresql table not analyzed (instance {{ $labels.instance }})"
69
+ description: "Table {{ $labels.relname }} has not been analyzed for 24 hours: check {{ $labels.release }} - {{ $labels.datname }}"
70
+ dashboard: "OVH:<MONITORING>/postgres"
71
+
72
+ - alert: PostgresqlDeadLocks
73
+ expr: rate(pg_stat_database_deadlocks{datname!~"template.*|postgres"}[1m]) > 0
74
+ for: 5m
75
+ labels:
76
+ severity: warning
77
+ annotations:
78
+ summary: "Postgresql dead locks"
79
+ description: "PostgreSQL has dead-locks: check {{ $labels.release }} - {{ $labels.datname }}"
80
+ dashboard: "OVH:<MONITORING>/postgres"
81
+
82
+ - alert: PostgresqlSlowQueries
83
+ expr: pg_slow_queries > 0
84
+ for: 5m
85
+ labels:
86
+ severity: warning
87
+ annotations:
88
+ summary: "Postgresql slow queries"
89
+ description: "PostgreSQL executing slow queries"
90
+ dashboard: "OVH:<MONITORING>/postgres"
91
+
92
+ - alert: PostgresqlHighRollbackRate
93
+ expr: rate(pg_stat_database_xact_rollback{datname!~"template.*"}[3m]) / rate(pg_stat_database_xact_commit{datname!~"template.*"}[3m]) > 0.02
94
+ for: 5m
95
+ labels:
96
+ severity: warning
97
+ annotations:
98
+ summary: "Postgresql high rollback rate on {{ $labels.release }} - {{ $labels.datname }}"
99
+ description: "Ratio of transactions being aborted compared to committed is > 2 %"
100
+ dashboard: "OVH:<MONITORING>/postgres"
101
+
102
+ - alert: PostgresqlCommitRateLow
103
+ expr: rate(pg_stat_database_xact_commit[1m]) < 10
104
+ for: 5m
105
+ labels:
106
+ severity: error
107
+ annotations:
108
+ summary: "Postgresql commit rate low on {{ $labels.release }} - {{ $labels.datname }}"
109
+ description: "Postgres seems to be processing very few transactions"
110
+ dashboard: "OVH:<MONITORING>/postgres"
111
+
112
+ - alert: PostgresqlLowXidConsumption
113
+ expr: rate(pg_txid_current[1m]) < 5
114
+ for: 5m
115
+ labels:
116
+ severity: warning
117
+ annotations:
118
+ summary: "Postgresql low XID consumption on {{ $labels.release }} - {{ $labels.datname }}"
119
+ description: "Postgresql seems to be consuming transaction IDs very slowly"
120
+ dashboard: "OVH:<MONITORING>/postgres"
121
+
122
+ - alert: PostgresqllowXlogConsumption
123
+ expr: rate(pg_xlog_position_bytes[1m]) < 100
124
+ for: 5m
125
+ labels:
126
+ severity: warning
127
+ annotations:
128
+ summary: "Postgresqllow XLOG consumption on {{ $labels.release }} - {{ $labels.datname }}"
129
+ description: "Postgres seems to be consuming XLOG very slowly"
130
+ dashboard: "OVH:<MONITORING>/postgres"
131
+
132
+ - alert: PostgresqlWaleReplicationStopped
133
+ expr: rate(pg_xlog_position_bytes[1m]) == 0
134
+ for: 5m
135
+ labels:
136
+ severity: error
137
+ annotations:
138
+ summary: "Postgresql WAL-E replication stopped on {{ $labels.release }} - {{ $labels.datname }}"
139
+ description: "WAL-E replication seems to be stopped"
140
+ dashboard: "OVH:<MONITORING>/postgres"
141
+
142
+ - alert: PostgresqlHighRateStatementTimeout
143
+ expr: rate(postgresql_errors_total{type="statement_timeout"}[5m]) > 3
144
+ for: 5m
145
+ labels:
146
+ severity: error
147
+ annotations:
148
+ summary: "Postgresql high rate statement timeout"
149
+ description: "Postgres transactions showing high rate of statement timeouts on {{ $labels.release }} - {{ $labels.datname }}"
150
+ dashboard: "OVH:<MONITORING>/postgres"
151
+
152
+ - alert: PostgresqlHighRateDeadlock
153
+ expr: rate(postgresql_errors_total{type="deadlock_detected"}[1m]) * 60 > 1
154
+ for: 5m
155
+ labels:
156
+ severity: error
157
+ annotations:
158
+ summary: "Postgresql high rate deadlock"
159
+ description: "Postgres detected deadlocks on {{ $labels.release }} - {{ $labels.datname }}"
160
+ dashboard: "OVH:<MONITORING>/postgres"
161
+
162
+ - alert: PostgresqlReplicationLabBytes
163
+ expr: (pg_xlog_position_bytes and pg_replication_is_replica == 0) - on (environment) group_right(instance) (pg_xlog_position_bytes and pg_replication_is_replica == 1) > 1e+09
164
+ for: 5m
165
+ labels:
166
+ severity: error
167
+ annotations:
168
+ summary: "Postgresql replication lab bytes"
169
+ description: "Postgres Replication lag (in bytes) is high on {{ $labels.release }} - {{ $labels.datname }}"
170
+ dashboard: "OVH:<MONITORING>/postgres"
171
+
172
+ - alert: PostgresqlTooManyDeadTuples
173
+ expr: ((pg_stat_user_tables_n_dead_tup > 10000) / (pg_stat_user_tables_n_live_tup + pg_stat_user_tables_n_dead_tup)) >= 0.1 unless ON(instance) (pg_replication_is_replica == 1)
174
+ for: 5m
175
+ labels:
176
+ severity: warning
177
+ annotations:
178
+ summary: "Postgresql too many dead tuples"
179
+ description: "PostgreSQL dead tuples is too large ( {{ $value }} dead tuples) on {{ $labels.release }} - {{ $labels.datname }}"
180
+ dashboard: "OVH:<MONITORING>/postgres"
181
+
182
+ - alert: PostgresqlTooManyLocksAcquired
183
+ expr: ((sum (pg_locks_count)) / (pg_settings_max_locks_per_transaction * pg_settings_max_connections)) > 0.20
184
+ for: 5m
185
+ labels:
186
+ severity: error
187
+ annotations:
188
+ summary: "Postgresql too many locks acquired on {{ $labels.statefulset.kubernetes.io_pod_name }}"
189
+ description: "Too many locks acquired on the database. If this alert happens frequently, we may need to increase the postgres setting max_locks_per_transaction."
190
+ dashboard: "OVH:<MONITORING>/postgres"
@@ -0,0 +1,79 @@
1
+ apiVersion: monitoring.coreos.com/v1
2
+ kind: PrometheusRule
3
+ metadata:
4
+ name: prometheus-rules
5
+ namespace: prometheus
6
+
7
+ spec:
8
+ groups:
9
+ - name: Prometheus
10
+ rules:
11
+ - alert: targets_down
12
+ expr: up{target_env!="preemptibles"} == 0
13
+ for: 10m
14
+ labels:
15
+ severity: warning
16
+ annotations:
17
+ summary: Prometheus target missing
18
+ description: "Prometheus failed to scrape {{ $labels.app }}"
19
+ dashboard: "See prometheus.md in SRE Playbook"
20
+
21
+ - alert: PrometheusConfigurationReloadFailure
22
+ expr: prometheus_config_last_reload_successful != 1
23
+ for: 5m
24
+ labels:
25
+ severity: warning
26
+ annotations:
27
+ summary: "Prometheus server configuration reload failure"
28
+ description: "Prometheus server failed to reload server configs (e.g. alerts, rules)"
29
+ dashboard: "See prometheus.md in SRE Playbook"
30
+
31
+ - alert: PrometheusAlertmanagerConfigurationReloadFailure
32
+ expr: alertmanager_config_last_reload_successful != 1
33
+ for: 5m
34
+ labels:
35
+ severity: warning
36
+ annotations:
37
+ summary: "Prometheus AlertManager configuration reload failure"
38
+ description: "AlertManager failed to reload alert configs (e.g. slack, opsgenie)"
39
+ dashboard: "See prometheus.md in SRE Playbook"
40
+
41
+ - alert: PrometheusTooManyRestarts
42
+ expr: changes(process_start_time_seconds{job=~"prometheus|alertmanager"}[15m]) > 2
43
+ for: 5m
44
+ labels:
45
+ severity: warning
46
+ annotations:
47
+ summary: "Prometheus is in a crash loop"
48
+ description: "Prometheus {{ $labels.component }} has restarted more than twice in the last 15 minutes. It might be crashlooping."
49
+ dashboard: "See prometheus.md in SRE Playbook"
50
+
51
+ - alert: PrometheusNotConnectedToAlertmanager
52
+ expr: prometheus_notifications_alertmanagers_discovered < 1
53
+ for: 5m
54
+ labels:
55
+ severity: error
56
+ annotations:
57
+ summary: "Prometheus not connected to alertmanager"
58
+ description: "Prometheus cannot connect the alertmanager - new alerts may not be detected"
59
+ dashboard: "See prometheus.md in SRE Playbook"
60
+
61
+ - alert: PrometheusNotificationsBacklog
62
+ expr: min_over_time(prometheus_notifications_queue_length[10m]) > 0
63
+ for: 5m
64
+ labels:
65
+ severity: warning
66
+ annotations:
67
+ summary: "Prometheus notifications backlog"
68
+ description: "The Prometheus notification queue has not been empty for 10 minutes"
69
+ dashboard: "See prometheus.md in SRE Playbook"
70
+
71
+ - alert: PrometheusAlertmanagerNotificationFailing
72
+ expr: rate(alertmanager_notifications_failed_total[1m]) > 0
73
+ for: 5m
74
+ labels:
75
+ severity: error
76
+ annotations:
77
+ summary: "Prometheus AlertManager notification failing"
78
+ description: "Alertmanager is failing to send notifications"
79
+ dashboard: "See prometheus.md in SRE Playbook"
@@ -0,0 +1,90 @@
1
+ apiVersion: monitoring.coreos.com/v1
2
+ kind: PrometheusRule
3
+ metadata:
4
+ name: redis-rules
5
+ namespace: prometheus
6
+
7
+ spec:
8
+ groups:
9
+ - name: Redis
10
+ rules:
11
+ - alert: RedisDown
12
+ expr: redis_up == 0
13
+ for: 5m
14
+ labels:
15
+ severity: error
16
+ annotations:
17
+ summary: "Redis down (instance {{ $labels.instance }})"
18
+ description: "Redis instance is down"
19
+ dashboard: "OVH:<MONITORING>/redis"
20
+
21
+ - alert: RedisMissingMaster
22
+ expr: count(redis_instance_info{role="master"}) == 0
23
+ for: 5m
24
+ labels:
25
+ severity: error
26
+ annotations:
27
+ summary: "Redis missing master (instance {{ $labels.instance }})"
28
+ description: "Redis cluster has no node marked as master."
29
+ dashboard: "OVH:<MONITORING>/redis"
30
+
31
+ - alert: RedisTooManyMasters
32
+ expr: count(redis_instance_info{role="master"}) > 1
33
+ for: 5m
34
+ labels:
35
+ severity: error
36
+ annotations:
37
+ summary: "Redis too many masters (instance {{ $labels.instance }})"
38
+ description: "Redis cluster has too many nodes marked as master."
39
+ dashboard: "OVH:<MONITORING>/redis"
40
+
41
+ - alert: RedisDisconnectedSlaves
42
+ expr: count without (instance, job) (redis_connected_slaves) - sum without (instance, job) (redis_connected_slaves) - 1 > 1
43
+ for: 5m
44
+ labels:
45
+ severity: warning
46
+ annotations:
47
+ summary: "Redis disconnected slaves (instance {{ $labels.instance }})"
48
+ description: "Redis not replicating for all slaves. Consider reviewing the redis replication status."
49
+ dashboard: "OVH:<MONITORING>/redis"
50
+
51
+ - alert: RedisReplicationBroken
52
+ expr: delta(redis_connected_slaves[1m]) < 0
53
+ for: 5m
54
+ labels:
55
+ severity: warning
56
+ annotations:
57
+ summary: "Redis replication broken (instance {{ $labels.instance }})"
58
+ description: "Redis instance lost a slave"
59
+ dashboard: "OVH:<MONITORING>/redis"
60
+
61
+ - alert: RedisClusterFlapping
62
+ expr: changes(redis_connected_slaves[5m]) > 2
63
+ for: 5m
64
+ labels:
65
+ severity: error
66
+ annotations:
67
+ summary: "Redis cluster flapping (instance {{ $labels.instance }})"
68
+ description: "Changes have been detected in Redis replica connection. This can occur when replica nodes lose connection to the master and reconnect (a.k.a flapping)."
69
+ dashboard: "OVH:<MONITORING>/redis"
70
+
71
+ - alert: RedisOutOfMemory
72
+ expr: redis_memory_used_bytes / redis_total_system_memory_bytes * 100 > 90
73
+ for: 5m
74
+ labels:
75
+ severity: warning
76
+ annotations:
77
+ summary: "Redis out of memory (instance {{ $labels.instance }})"
78
+ description: "Redis is running out of memory ( {{ $value }}% )"
79
+ dashboard: "OVH:<MONITORING>/redis"
80
+
81
+ - alert: RedisRejectedConnections
82
+ expr: increase(redis_rejected_connections_total[1m]) > 0
83
+ for: 5m
84
+ labels:
85
+ severity: warning
86
+ annotations:
87
+ summary: "Redis rejected connections (instance {{ $labels.instance }})"
88
+ description: "Some connections to Redis has been rejected. Please check {{ $labels.app }}"
89
+ dashboard: "OVH:<MONITORING>/redis"
90
+
@@ -0,0 +1,18 @@
1
+ apiVersion: monitoring.coreos.com/v1
2
+ kind: PrometheusRule
3
+ metadata:
4
+ name: test-alert
5
+ namespace: prometheus # Ensure this matches your Prometheus namespace
6
+ spec:
7
+ groups:
8
+ - name: test.rules
9
+ rules:
10
+ - alert: TestAlert
11
+ expr: vector(1) # This will always be true, triggering the alert
12
+ for: 1m # Alert if condition is true for 1 minute
13
+ labels:
14
+ severity: warning
15
+ annotations:
16
+ summary: "Test Alert for Slack"
17
+ description: "This is a test alert to verify the Slack receiver configuration."
18
+
@@ -0,0 +1,28 @@
1
+ apiVersion: monitoring.coreos.com/v1
2
+ kind: PrometheusRule
3
+ metadata:
4
+ name: traefik-rules
5
+ namespace: prometheus
6
+
7
+ spec:
8
+ groups:
9
+ - name: Traefik Alerts
10
+ rules:
11
+ - alert: TraefikConfigReloadFailed
12
+ expr: traefik_config_last_reload_failure > 0
13
+ for: 1m
14
+ labels:
15
+ severity: warning
16
+ annotations:
17
+ summary: "Traefik config failed to reload"
18
+ description: "New config file for Traefik is invalid or Traefik encountered an error"
19
+
20
+ # - alert: TraefikHighHttp4xxError
21
+ # expr: sum(rate(traefik_service_requests_total{code=~"4.*"}[3m])) by (service) / sum(rate(traefik_service_requests_total[3m])) by (service) * 100 > 10
22
+ # for: 5m
23
+ # labels:
24
+ # severity: error
25
+ # annotations:
26
+ # summary: "Traefik high HTTP 4xx error rate on {{ $labels.service }}"
27
+ # description: "Traefik backend 4xx error rate is above 10% (currently at {{ $value }}%)"
28
+ # dashboard: "OVH:<MONITORING>/traefik"
@@ -0,0 +1,28 @@
1
+ apiVersion: monitoring.coreos.com/v1
2
+ kind: PrometheusRule
3
+ metadata:
4
+ name: velero-rules
5
+ namespace: prometheus
6
+
7
+ spec:
8
+ groups:
9
+ - name: Velero
10
+ rules:
11
+ - alert: VeleroBackupFailure
12
+ expr: (time() - velero_backup_last_successful_timestamp{schedule_version=~"2.[0]"} > 108000) and (velero_backup_success_total{schedule!=""} != 0)
13
+ for: 5m
14
+ labels:
15
+ severity: warning
16
+ annotations:
17
+ summary: "Velero schedule {{ $labels.schedule }} backup failed to execute properly"
18
+ description: "It has been over 30 hours since the last successful backup"
19
+ dashboard: "OVH:<MONITORING>/velero"
20
+ - alert: NoVeleroBackups
21
+ expr: velero_backup_success_total{schedule!=""} == 0
22
+ for: 30h
23
+ labels:
24
+ severity: warning
25
+ annotations:
26
+ summary: "Velero has not made any backups yet"
27
+ description: "No backups have successfully been made since velero was initialized (or restarted), go check it out ASAP"
28
+ dashboard: "OVH:<MONITORING>/velero"
@@ -0,0 +1,57 @@
1
+ #
2
+ # to force a reinstall of this service simply remove or rename this
3
+ # stackdriver-exporter subdirectory and rerun helmup stackdriver-exporter
4
+ #
5
+ fullnameOverride: "prometheus-stack-stackdriver-metrics"
6
+
7
+ stackdriver:
8
+ projectId: "OVH:<PROJECT_NAME>"
9
+ metrics:
10
+ typePrefixes: "pubsub.googleapis.com/subscription/oldest_unacked_message_age,pubsub.googleapis.com/subscription/num_undelivered_messages,pubsub.googleapis.com/subscription/pull_ack_request_count,pubsub.googleapis.com/subscription/streaming_pull_ack_request_count,pubsub.googleapis.com/topic/message_sizes,pubsub.googleapis.com/topic/send_request_count,firebasedatabase.googleapis.com/io/database_load,firebasedatabase.googleapis.com/network/sent_bytes_count,firebasedatabase.googleapis.com/network/active_connections"
11
+
12
+ # https://artifacthub.io/packages/helm/prometheus-community/prometheus-stackdriver-exporter?modal=values&path=serviceMonitor
13
+ serviceMonitor:
14
+ enabled: true
15
+ namespace: prometheus
16
+ interval: "30s"
17
+ relabelings:
18
+ - action: labelmap
19
+ regex: __meta_kubernetes_pod_label_(.+)
20
+ - action: labelmap
21
+ regex: __meta_kubernetes_service_label_(.+)
22
+
23
+ annotations:
24
+ prometheus.io/port: "9255"
25
+ prometheus.io/scrape: "true" # this is a string annotation - so quoted!
26
+
27
+ tolerations:
28
+ - key: "preemptible"
29
+ operator: "Equal"
30
+ value: "true"
31
+ effect: "NoSchedule"
32
+
33
+ affinity:
34
+ nodeAffinity:
35
+ requiredDuringSchedulingIgnoredDuringExecution:
36
+ nodeSelectorTerms:
37
+ - matchExpressions:
38
+ - key: target-env
39
+ operator: In
40
+ values:
41
+ - preemptible
42
+
43
+ resources:
44
+ requests:
45
+ cpu: 50m
46
+ memory: 32Mi
47
+
48
+ # NOTE to future selves - the exporter's helm chart does not have a clue
49
+ # regarding workload identity, which means the gcloud and k8s service
50
+ # accounts have to be managed outside of the chart by helmup. In order to get
51
+ # the linkages from the SA to the service we specify the SA name here, but
52
+ # disable the creation of the SA since it will have already have been created
53
+ # and bound by the helmup installStackdriverExporterEnvironment function.
54
+ #
55
+ serviceAccount:
56
+ create : false # this is a flag to helm - so unquoted ... da F?!
57
+ name: "stackdriver-exporter"
@@ -4,7 +4,7 @@ showInstalling "Redis"
4
4
 
5
5
  OCI_CHART="oci://registry-1.docker.io/bitnamicharts/redis"
6
6
 
7
- [ -z "$REDIS_CHART_VERSION" ] && REDIS_CHART_VERSION="20.1.7"
7
+ [ -z "$REDIS_CHART_VERSION" ] && REDIS_CHART_VERSION="20.2.1"
8
8
 
9
9
  helm upgrade --install redis $OCI_CHART \
10
10
  --values redis/redis-local.yaml \
@@ -70,3 +70,11 @@ networkPolicy:
70
70
 
71
71
  metrics:
72
72
  enabled: true
73
+ serviceMonitor:
74
+ enabled: false # set to true for prometheus operator
75
+ namespace: "prometheus"
76
+ relabelings:
77
+ - action: labelmap
78
+ regex: __meta_kubernetes_pod_label_(.+)
79
+ - action: labelmap
80
+ regex: __meta_kubernetes_service_label_(.+)
@@ -11,13 +11,13 @@
11
11
  # kubectl apply --namespace traefik --server-side \
12
12
  # --force-conflicts -k https://github.com/traefik/traefik-helm-chart/traefik/crds/\?ref\=v27
13
13
  #
14
- showInstalling "Traefik Load Balancer / Router"
14
+ showInstalling "Traefik v3 Load Balancer / Router"
15
15
 
16
16
  TRAEFIK_NAMESPACE="traefik"
17
17
 
18
18
  addHelmRepo traefik https://helm.traefik.io/traefik
19
19
 
20
- [ -z "$TRAEFIK_CHART_VERSION" ] && TRAEFIK_CHART_VERSION="27"
20
+ [ -z "$TRAEFIK_CHART_VERSION" ] && TRAEFIK_CHART_VERSION="32"
21
21
  helm upgrade --install traefik traefik/traefik \
22
22
  --namespace $TRAEFIK_NAMESPACE --create-namespace \
23
23
  --values traefik/traefik-local.yaml \
package/src/helmup.sh CHANGED
@@ -296,7 +296,7 @@ function installStackdriverExporterEnvironment() {
296
296
  # Add necessary helm repositories - note that stable is deprecated
297
297
  addHelmRepo prometheus-community https://prometheus-community.github.io/helm-charts
298
298
 
299
- local SDEXP_NS="monitoring"
299
+ local SDEXP_NS=${1:-monitoring}
300
300
  local SDEXP_SA="stackdriver-exporter"
301
301
  local SDEXP_EM="$SDEXP_SA@$GCP_PROJECT_ID.iam.gserviceaccount.com"
302
302
 
@@ -306,7 +306,8 @@ function installStackdriverExporterEnvironment() {
306
306
  printf "\n*** Removing the previous $SDEXP_SA installation...\n"
307
307
  helm uninstall -n $SDEXP_NS $SDEXP_SA &> $DEVNULL
308
308
  kubectl delete serviceaccounts -n $SDEXP_NS $SDEXP_SA &> $DEVNULL
309
- gcloud --quiet iam service-accounts delete $SDEXP_EM &> $DEVNULL
309
+ printf "!!! Skipping deletion of the gcloud SA $SDEXP_EM\n"
310
+ # gcloud --quiet iam service-accounts delete $SDEXP_EM &> $DEVNULL
310
311
 
311
312
  # NOTE: The k8s SA != GCP SA - the former is created by the helm chart
312
313
  # that installs the stackdriver-exporter, the latter is handled here in
@@ -321,7 +322,7 @@ function installStackdriverExporterEnvironment() {
321
322
 
322
323
  printf "\n*** Binding IAM role of $SDEXP_NS viewer to $SDEXP_SA in $GCP_PROJECT_ID\n"
323
324
  gcloud projects add-iam-policy-binding "$GCP_PROJECT_ID" \
324
- --role "roles/$SDEXP_NS.viewer" \
325
+ --role "roles/monitoring.viewer" \
325
326
  --member "serviceAccount:$SDEXP_EM" &> $DEVNULL
326
327
  sleep 2 # give the IAM binding a chance to complete before moving on
327
328
 
@@ -1002,7 +1003,13 @@ CATBACKUP
1002
1003
  bootstrapLocalSetup $SERVICE
1003
1004
  ;;
1004
1005
 
1005
- "prometheus"|"prometheus-operator")
1006
+ "prometheus")
1007
+ installStackdriverExporterEnvironment
1008
+ bootstrapLocalSetup $SERVICE
1009
+ ;;
1010
+
1011
+ "prom-operator")
1012
+ installStackdriverExporterEnvironment prometheus
1006
1013
  bootstrapLocalSetup $SERVICE
1007
1014
  ;;
1008
1015
 
package/src/overwhelm.mjs CHANGED
@@ -206,6 +206,13 @@ const doReplacements = ( yamls, replacements ) => {
206
206
  process.exit( 1 )
207
207
  }
208
208
 
209
+ // Eat any doubly double quoted values such that
210
+ // ""<ovh replace>"" -> "<ovh replace>"
211
+ // but
212
+ // someDefault: ""
213
+ // remains unchanged
214
+ replYaml = replYaml.replace( /""([^"]+)""/g, '"$1"' )
215
+
209
216
  return replYaml
210
217
  }
211
218
 
@@ -307,7 +314,7 @@ ahoy.forEach( ( dir ) => {
307
314
  }
308
315
  } )
309
316
 
310
- // we can also apply replaceables to any top level .ovh files to support top level config maps
317
+ // we can also apply replaceables to all .ovh files in the project
311
318
  glob.sync( '**/*.ovh' ).forEach( ( cfgmap ) => {
312
319
  const target = cfgmap.replace( /.ovh$/, '' )
313
320
  let valuesOut = fs.readFileSync( cfgmap, { encoding : 'utf-8' } )