Skip to content

Commit

Permalink
Merge pull request prometheus-community#44 from frezes/feat/kube-prom…
Browse files Browse the repository at this point in the history
…etheus-stack

[kube-prometheus-stack] fix recording rule bugs
  • Loading branch information
benjaminhuo authored Feb 6, 2024
2 parents 41682fe + 180eaf9 commit 86d31a2
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion charts/kube-prometheus-stack/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ name: kube-prometheus-stack
sources:
- https://github.com/prometheus-community/helm-charts
- https://github.com/prometheus-operator/kube-prometheus
version: 52.1.10
version: 52.1.11
appVersion: v0.68.0
kubeVersion: ">=1.19.0-0"
home: https://github.com/prometheus-operator/kube-prometheus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ spec:
{{- end }}
- expr: |-
sum by (cluster, node, device) (
max by (namespace, pod, instance, device) (
max by (cluster, namespace, pod, instance, device) (
node_filesystem_avail_bytes{device=~"/dev/.*",device!~"/dev/loop\\d+", job="node-exporter"}
)
* on (cluster, namespace, pod) group_left (node)
Expand Down Expand Up @@ -275,12 +275,12 @@ spec:
- expr: |-
count by (cluster, node) (
node_namespace_pod:kube_pod_info:{node!=""}
unless on (pod, namespace, cluster,)
unless on (pod, namespace, cluster)
(kube_pod_status_phase{job="kube-state-metrics",phase="Succeeded"} > 0)
unless on (pod, namespace, cluster,)
unless on (pod, namespace, cluster)
(
(kube_pod_status_ready{condition="true",job="kube-state-metrics"} > 0)
and on (pod, namespace, cluster,)
and on (pod, namespace, cluster)
(kube_pod_status_phase{job="kube-state-metrics",phase="Running"} > 0)
)
unless on (cluster, pod, namespace)
Expand All @@ -289,7 +289,7 @@ spec:
/
count by (cluster, node) (
node_namespace_pod:kube_pod_info:{node!=""}
unless on (pod, namespace, cluster,)
unless on (pod, namespace, cluster)
kube_pod_status_phase{job="kube-state-metrics",phase="Succeeded"} > 0
)
record: node:pod_abnormal_utilisation:ratio
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
record: 'node:node_device_filesystem_available_bytes:sum',
expr: |||
sum by (%(clusterLabel)s, node, device) (
max by (namespace, pod, instance, device) (
max by (%(clusterLabel)s, namespace, %(podLabel)s, instance, device) (
node_filesystem_avail_bytes{%(hostFilesystemDeviceSelector)s, %(nodeExporterSelector)s}
)
* on (%(clusterLabel)s, namespace, %(podLabel)s) group_left (node)
Expand All @@ -170,7 +170,7 @@
record: 'node:node_device_filesystem_bytes_total:sum',
expr: |||
sum by (%(clusterLabel)s, node, device) (
max by (%(clusterLabel)s, namespace, pod, instance, device) (
max by (%(clusterLabel)s, namespace, %(podLabel)s, instance, device) (
node_filesystem_size_bytes{%(hostFilesystemDeviceSelector)s, %(nodeExporterSelector)s}
)
* on (%(clusterLabel)s, namespace, %(podLabel)s) group_left (node)
Expand Down Expand Up @@ -229,21 +229,21 @@
expr: |||
count by (%(clusterLabel)s, node) (
node_namespace_pod:kube_pod_info:{node!=""}
unless on (pod, namespace, %(clusterLabel)s,)
unless on (%(podLabel)s, namespace, %(clusterLabel)s)
(kube_pod_status_phase{job="kube-state-metrics",phase="Succeeded"} > 0)
unless on (pod, namespace, %(clusterLabel)s,)
unless on (%(podLabel)s, namespace, %(clusterLabel)s)
(
(kube_pod_status_ready{condition="true",job="kube-state-metrics"} > 0)
and on (pod, namespace, %(clusterLabel)s,)
and on (%(podLabel)s, namespace, %(clusterLabel)s)
(kube_pod_status_phase{job="kube-state-metrics",phase="Running"} > 0)
)
unless on (%(clusterLabel)s, pod, namespace)
unless on (%(clusterLabel)s, %(podLabel)s, namespace)
kube_pod_container_status_waiting_reason{job="kube-state-metrics",reason="ContainerCreating"} > 0
)
/
count by (%(clusterLabel)s, node) (
node_namespace_pod:kube_pod_info:{node!=""}
unless on (pod, namespace, %(clusterLabel)s,)
unless on (%(podLabel)s, namespace, %(clusterLabel)s)
kube_pod_status_phase{job="kube-state-metrics",phase="Succeeded"} > 0
)
||| % $._config,
Expand Down
10 changes: 5 additions & 5 deletions ks-prometheus/manifests/whizard-telemetry-prometheusRule.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ spec:
record: node:node_device_filesystem_utilisation:ratio
- expr: |
sum by (cluster, node, device) (
max by (namespace, pod, instance, device) (
max by (cluster, namespace, pod, instance, device) (
node_filesystem_avail_bytes{device=~"/dev/.*",device!~"/dev/loop\\d+", job="node-exporter"}
)
* on (cluster, namespace, pod) group_left (node)
Expand Down Expand Up @@ -161,12 +161,12 @@ spec:
- expr: |
count by (cluster, node) (
node_namespace_pod:kube_pod_info:{node!=""}
unless on (pod, namespace, cluster,)
unless on (pod, namespace, cluster)
(kube_pod_status_phase{job="kube-state-metrics",phase="Succeeded"} > 0)
unless on (pod, namespace, cluster,)
unless on (pod, namespace, cluster)
(
(kube_pod_status_ready{condition="true",job="kube-state-metrics"} > 0)
and on (pod, namespace, cluster,)
and on (pod, namespace, cluster)
(kube_pod_status_phase{job="kube-state-metrics",phase="Running"} > 0)
)
unless on (cluster, pod, namespace)
Expand All @@ -175,7 +175,7 @@ spec:
/
count by (cluster, node) (
node_namespace_pod:kube_pod_info:{node!=""}
unless on (pod, namespace, cluster,)
unless on (pod, namespace, cluster)
kube_pod_status_phase{job="kube-state-metrics",phase="Succeeded"} > 0
)
record: node:pod_abnormal_utilisation:ratio
Expand Down

0 comments on commit 86d31a2

Please sign in to comment.