@leverege/build-tools 2.54.1 → 2.55.0

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 (27) hide show
  1. package/package.json +4 -4
  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 +139 -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/kubernetes-rules.yaml.off +112 -0
  17. package/src/helm-charts/prom-operator/rules/leverege-rules.yaml +20 -0
  18. package/src/helm-charts/prom-operator/rules/postgres-rules.yaml +190 -0
  19. package/src/helm-charts/prom-operator/rules/prometheus-rules.yaml +79 -0
  20. package/src/helm-charts/prom-operator/rules/prometheus-rules.yaml.off +79 -0
  21. package/src/helm-charts/prom-operator/rules/redis-rules.yaml +90 -0
  22. package/src/helm-charts/prom-operator/rules/traefik-rules.yaml +28 -0
  23. package/src/helm-charts/prom-operator/rules/velero-rules.yaml +28 -0
  24. package/src/helm-charts/prom-operator/stackdriver-exporter.yaml.ovh +52 -0
  25. package/src/helm-charts/redis/redis-local.yaml +3 -0
  26. package/src/helmup.sh +11 -4
  27. 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.0",
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
69
  "inquirer": "^12.0.0",
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 elasticsearch8-exporter stackdriver-exporter prometheus-stack
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,139 @@
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: false # 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
+ #nodeSelector:
41
+ #workload: monitor
42
+
43
+ # default is using kube-dns which is usually sufficient for our needs but
44
+ # can be switched over to CoreDNS if the need arises
45
+ coreDns:
46
+ enabled: false
47
+
48
+ # managed GKE does not provide direct access to the k8s scheduler so we
49
+ # can safely disable this here - see the Stackdrive Monitoring for more
50
+ kubeScheduler:
51
+ enabled: false
52
+
53
+ grafana:
54
+ enabled: true
55
+ service:
56
+ port: 3000
57
+ # -- the grafana admin password
58
+ adminPassword: prom-operator
59
+ defaultDashboardsEnabled: false
60
+ sidecar:
61
+ dashboards:
62
+ enabled: true
63
+ extraObjects:
64
+ - apiVersion: traefik.io/v1alpha1
65
+ kind: IngressRoute
66
+ metadata:
67
+ name: grafana
68
+ namespace: prometheus
69
+ spec:
70
+ entryPoints:
71
+ - websecure
72
+ routes:
73
+ - match: Host(`OVH:<PROJECT_NAME>-monitoring.OVH:<HOST>.com`)
74
+ kind: Rule
75
+ services:
76
+ - name: prometheus-stack-grafana
77
+ port: 3000
78
+
79
+ alertmanager:
80
+ enabled: true
81
+ affinity:
82
+ nodeAffinity:
83
+ requiredDuringSchedulingIgnoredDuringExecution:
84
+ nodeSelectorTerms:
85
+ - matchExpressions:
86
+ - key: target-env
87
+ operator: In
88
+ values:
89
+ - database
90
+ tolerations:
91
+ - key: "database"
92
+ operator: "Equal"
93
+ value: "true"
94
+ effect: "NoSchedule"
95
+
96
+ strategy:
97
+ type: Recreate
98
+
99
+ config:
100
+ receivers:
101
+ - name: slack
102
+ slack_configs:
103
+ - channel: "OVH:<SLACK_CHANNEL>"
104
+ api_url: "OVH:<SLACK_HOOK_URL>"
105
+ username: "OVH:<PROJECT_NAME>"
106
+ fallback: "OVH:<PROJECT_NAME> - {{ .CommonAnnotations.summary }}"
107
+ title: "{{ range .Alerts }}{{ .Annotations.summary }}\n{{ end }}"
108
+ title_link: "https://bitbucket.org/leverege/sre-playbook/src/master/"
109
+ send_resolved: true
110
+ text: |-
111
+ {{ range .Alerts }}
112
+ *Alert:* {{ .Annotations.summary }} - `{{ .Labels.severity }}`
113
+ *Description:* {{ .Annotations.description }}
114
+ *Dashboard:* {{ .Annotations.dashboard }}
115
+ {{ end }}
116
+ - name: opsgenie
117
+ opsgenie_configs:
118
+ - api_key: "OVH:<OPSGENIE_APIKEY>"
119
+ priority: "{{ .CommonLabels.priority }}"
120
+ tags: "{{ range .Alerts }}{{ .Labels.severity }},{{ end }}"
121
+ description: |-
122
+ {{ range .Alerts }}
123
+ *Alert:* {{ .Annotations.summary }} - `{{ .Labels.severity }}`
124
+ *Description:* {{ .Annotations.description }}
125
+ *Dashboard:* {{ .Annotations.dashboard }}
126
+ {{ end }}
127
+
128
+ route:
129
+ group_wait: 30s
130
+ group_interval: 5m
131
+ group_by:
132
+ - alertname
133
+ - cluster
134
+ receiver: slack
135
+ routes:
136
+ - match:
137
+ severity: page
138
+ receiver: opsgenie
139
+ 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"