From f90ba25050c3e4ee5f112818a90aa31127d82edf Mon Sep 17 00:00:00 2001 From: Alex Kennedy Date: Fri, 27 Oct 2023 01:23:36 -0700 Subject: [PATCH] fix: grafana dashboard to support replicas (#8751) Signed-off-by: Alex Kennedy Signed-off-by: Mariam Fahmy Signed-off-by: shuting Co-authored-by: Mariam Fahmy Co-authored-by: shuting --- .../charts/grafana/dashboard/dashboard.json | 114 ++++++++++-------- 1 file changed, 61 insertions(+), 53 deletions(-) diff --git a/charts/kyverno/charts/grafana/dashboard/dashboard.json b/charts/kyverno/charts/grafana/dashboard/dashboard.json index f378104693..9458bef7b5 100644 --- a/charts/kyverno/charts/grafana/dashboard/dashboard.json +++ b/charts/kyverno/charts/grafana/dashboard/dashboard.json @@ -85,20 +85,24 @@ "mode": "absolute", "steps": [ { - "color": "red", - "value": null + "color": "text", + "value": null }, { - "color": "red", - "value": 50 + "value": 0, + "color": "green" }, { - "color": "#EAB839", - "value": 75 + "color": "#eab839", + "value": 25 }, { - "color": "green", - "value": 100 + "color": "red", + "value": 50 + }, + { + "color": "red", + "value": 100 } ] }, @@ -129,7 +133,7 @@ "targets": [ { "exemplar": true, - "expr": "sum(increase(kyverno_policy_results_total{rule_result=\"fail\", cluster=~\"$cluster\"}[24h]))*100/sum(increase(kyverno_policy_results_total{cluster=~\"$cluster\"}[24h]))", + "expr": "sum(increase(kyverno_policy_results_total{rule_result=\"fail\", cluster=~\"$cluster\"}[24h]) or vector(0))*100/sum(increase(kyverno_policy_results_total{cluster=~\"$cluster\"}[24h]))", "interval": "", "legendFormat": "", "refId": "A" @@ -269,20 +273,24 @@ "mode": "absolute", "steps": [ { - "color": "red", - "value": null + "color": "text", + "value": null }, { - "color": "red", - "value": 50 + "value": 0, + "color": "green" }, { - "color": "#EAB839", - "value": 75 + "color": "#eab839", + "value": 25 }, { - "color": "green", - "value": 100 + "color": "red", + "value": 50 + }, + { + "color": "red", + "value": 100 } ] }, @@ -313,7 +321,7 @@ "targets": [ { "exemplar": true, - "expr": "sum(increase(kyverno_policy_results_total{rule_result=\"fail\", policy_background_mode=\"true\", cluster=~\"$cluster\"}[24h]))*100/sum(increase(kyverno_policy_results_total{policy_background_mode=\"true\", cluster=~\"$cluster\"}[24h]))", + "expr": "sum(increase(kyverno_policy_results_total{rule_result=\"fail\", policy_background_mode=\"true\", cluster=~\"$cluster\"}[24h]) or vector(0))*100/sum(increase(kyverno_policy_results_total{policy_background_mode=\"true\", cluster=~\"$cluster\"}[24h]))", "interval": "", "legendFormat": "", "refId": "A" @@ -370,7 +378,7 @@ "targets": [ { "exemplar": true, - "expr": "count(kyverno_policy_rule_info_total{rule_type=\"validate\", cluster=~\"$cluster\"}==1)", + "expr": "count(count(kyverno_policy_rule_info_total{rule_type=\"validate\", cluster=~\"$cluster\"}==1) by (rule_name))", "interval": "", "legendFormat": "", "refId": "A" @@ -428,7 +436,7 @@ "targets": [ { "exemplar": true, - "expr": "count(kyverno_policy_rule_info_total{rule_type=\"mutate\", cluster=~\"$cluster\"}==1)", + "expr": "count(count(kyverno_policy_rule_info_total{rule_type=\"mutate\", cluster=~\"$cluster\"}==1) by (rule_name))", "interval": "", "legendFormat": "", "refId": "A" @@ -486,7 +494,7 @@ "targets": [ { "exemplar": true, - "expr": "count(kyverno_policy_rule_info_total{rule_type=\"generate\", cluster=~\"$cluster\"}==1)", + "expr": "count(count(kyverno_policy_rule_info_total{rule_type=\"generate\", cluster=~\"$cluster\"}==1) by (rule_name))", "interval": "", "legendFormat": "", "refId": "A" @@ -574,7 +582,7 @@ "exemplar": true, "expr": "sum(increase(kyverno_policy_results_total{rule_execution_cause=\"admission_request\", cluster=~\"$cluster\"}[5m])) by (rule_result)", "interval": "", - "legendFormat": "{{rule_result}}", + "legendFormat": "Admission Review Result: {{rule_result}}", "refId": "A" } ], @@ -603,7 +611,7 @@ "label": null, "logBase": 1, "max": null, - "min": null, + "min": "0", "show": true }, { @@ -680,7 +688,7 @@ "exemplar": true, "expr": "sum(increase(kyverno_policy_results_total{rule_execution_cause=\"background_scan\", cluster=~\"$cluster\"}[5m])) by (rule_result)", "interval": "", - "legendFormat": "{{rule_result}}", + "legendFormat": "Background Scan Result: {{rule_result}}", "refId": "A" } ], @@ -709,7 +717,7 @@ "label": null, "logBase": 1, "max": null, - "min": null, + "min": "0", "show": true }, { @@ -787,7 +795,7 @@ "exemplar": true, "expr": "sum(sum(increase(kyverno_policy_results_total{rule_result=\"fail\", cluster=~\"$cluster\"}[5m])) by (policy_name, policy_type)) by (policy_type)", "interval": "", - "legendFormat": "{{policy_type}}", + "legendFormat": "Policy Type: {{policy_type}}", "refId": "A" } ], @@ -816,7 +824,7 @@ "label": null, "logBase": 1, "max": null, - "min": null, + "min": "0", "show": true }, { @@ -893,7 +901,7 @@ "exemplar": true, "expr": "sum(sum(increase(kyverno_policy_results_total{rule_execution_cause=\"admission_request\", cluster=~\"$cluster\"}[5m])) by (policy_name, rule_result)) by (rule_result)", "interval": "", - "legendFormat": "{{rule_result}}", + "legendFormat": "Admission Review Result: {{rule_result}}", "refId": "A" } ], @@ -922,7 +930,7 @@ "label": null, "logBase": 1, "max": null, - "min": null, + "min": "0", "show": true }, { @@ -999,7 +1007,7 @@ "exemplar": true, "expr": "sum(sum(increase(kyverno_policy_results_total{rule_execution_cause=\"background_scan\", cluster=~\"$cluster\"}[5m])) by (policy_name, rule_result)) by (rule_result)", "interval": "", - "legendFormat": "{{rule_result}}", + "legendFormat": "Background Scan Result: {{rule_result}}", "refId": "A" } ], @@ -1028,7 +1036,7 @@ "label": null, "logBase": 1, "max": null, - "min": null, + "min": "0", "show": true }, { @@ -1122,7 +1130,7 @@ "exemplar": true, "expr": "count(count(kyverno_policy_rule_info_total{cluster=~\"$cluster\"}==1) by (policy_name, policy_type)) by (policy_type)", "interval": "", - "legendFormat": "{{policy_type}}", + "legendFormat": "Policy Type: {{policy_type}}", "refId": "A" } ], @@ -1151,7 +1159,7 @@ "label": null, "logBase": 1, "max": null, - "min": null, + "min": "0", "show": true }, { @@ -1227,7 +1235,7 @@ "exemplar": true, "expr": "count(count(kyverno_policy_rule_info_total{cluster=~\"$cluster\"}==1) by (policy_name, policy_validation_mode)) by (policy_validation_mode)", "interval": "", - "legendFormat": "audit", + "legendFormat": "Policy Validation Mode: {{policy_validation_mode}}", "refId": "A" } ], @@ -1256,7 +1264,7 @@ "label": null, "logBase": 1, "max": null, - "min": null, + "min": "0", "show": true }, { @@ -1327,7 +1335,7 @@ "exemplar": true, "expr": "count(count(kyverno_policy_rule_info_total{policy_background_mode=\"true\", cluster=~\"$cluster\"}==1) by (policy_name, policy_type)) by (policy_type)", "interval": "", - "legendFormat": "{{policy_type}}", + "legendFormat": "Policy Type: {{policy_type}}", "refId": "A" } ], @@ -1356,7 +1364,7 @@ "label": null, "logBase": 1, "max": null, - "min": null, + "min": "0", "show": true }, { @@ -1421,7 +1429,7 @@ "exemplar": true, "expr": "count(count(kyverno_policy_rule_info_total{policy_namespace!=\"-\", cluster=~\"$cluster\"}==1) by (policy_name, policy_namespace)) by (policy_namespace)", "interval": "", - "legendFormat": "{{policy_namespace}}", + "legendFormat": "Namespace: {{policy_namespace}}", "refId": "A" } ], @@ -1450,7 +1458,7 @@ "label": null, "logBase": 1, "max": null, - "min": null, + "min": "0", "show": true }, { @@ -1524,9 +1532,9 @@ "targets": [ { "exemplar": true, - "expr": "count(kyverno_policy_rule_info_total{cluster=~\"$cluster\"}==1) by (rule_type)", + "expr": "count(count(kyverno_policy_rule_info_total{cluster=~\"$cluster\"}==1) by (rule_type, rule_name)) by (rule_type)", "interval": "", - "legendFormat": "{{rule_type}}", + "legendFormat": "Rule Type: {{rule_type}}", "refId": "A" } ], @@ -1555,7 +1563,7 @@ "label": null, "logBase": 1, "max": null, - "min": null, + "min": "0", "show": true }, { @@ -1637,7 +1645,7 @@ "exemplar": true, "expr": "sum(rate(kyverno_policy_execution_duration_seconds_sum{cluster=~\"$cluster\"}[5m])) by (rule_type) / sum(rate(kyverno_policy_execution_duration_seconds_count{cluster=~\"$cluster\"}[5m])) by (rule_type)", "interval": "", - "legendFormat": "{{rule_type}}", + "legendFormat": "Rule Type: {{rule_type}}", "refId": "A" } ], @@ -1666,7 +1674,7 @@ "label": "", "logBase": 1, "max": null, - "min": null, + "min": "0", "show": true }, { @@ -1741,7 +1749,7 @@ "exemplar": true, "expr": "sum(rate(kyverno_policy_execution_duration_seconds_sum{cluster=~\"$cluster\"}[5m])) by (policy_type) / sum(rate(kyverno_policy_execution_duration_seconds_count{cluster=~\"$cluster\"}[5m])) by (policy_type)", "interval": "", - "legendFormat": "{{policy_type}}", + "legendFormat": "Policy Type: {{policy_type}}", "refId": "A" } ], @@ -1770,7 +1778,7 @@ "label": "", "logBase": 1, "max": null, - "min": null, + "min": "0", "show": true }, { @@ -1991,7 +1999,7 @@ "label": null, "logBase": 1, "max": null, - "min": null, + "min": "0", "show": true }, { @@ -2086,7 +2094,7 @@ "label": null, "logBase": 1, "max": null, - "min": null, + "min": "0", "show": true }, { @@ -2317,7 +2325,7 @@ "label": null, "logBase": 1, "max": null, - "min": null, + "min": "0", "show": true }, { @@ -2391,7 +2399,7 @@ "exemplar": true, "expr": "sum(increase(kyverno_policy_changes_total{cluster=~\"$cluster\"}[5m])) by (policy_type)", "interval": "", - "legendFormat": "{{policy_type}}", + "legendFormat": "Policy Type: {{policy_type}}", "refId": "A" } ], @@ -2420,7 +2428,7 @@ "label": null, "logBase": 1, "max": null, - "min": null, + "min": "0", "show": true }, { @@ -2647,7 +2655,7 @@ "label": null, "logBase": 1, "max": null, - "min": null, + "min": "0", "show": true }, { @@ -2748,7 +2756,7 @@ "label": null, "logBase": 1, "max": null, - "min": null, + "min": "0", "show": true }, {