Skip to content

Commit 954f4ce

Browse files
committed
Fix bug with CDIDataImportCronOutdated alert
Updated CDIDataImportCronOutdated to fire only if the issue is related to the Pre-defined golden images. Add a CDIUserDefinedDataImportCronOutdated alert for user defined DIC that will not impact the operator health. Updated the namspabe label name fro ns to namespace, since each alert should report a namespace. Signed-off-by: Shirly Radco <[email protected]>
1 parent 6d6517a commit 954f4ce

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

pkg/monitoring/metrics/cdi-controller/dataimportcron.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88

99
const (
1010
// PrometheusCronNsLabel labels the DataImportCron namespace
11-
PrometheusCronNsLabel = "ns"
11+
PrometheusCronNsLabel = "namespace"
1212
// PrometheusCronNameLabel labels the DataImportCron name
1313
PrometheusCronNameLabel = "cron_name"
1414
// PrometheusCronPendingLabel labels whether the DataImportCron import DataVolume is pending for default storage class

pkg/monitoring/rules/alerts/operator.go

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,28 @@ var operatorAlerts = []promv1.Rule{
5858
},
5959
{
6060
Alert: "CDIDataImportCronOutdated",
61-
Expr: intstr.FromString(`sum by(ns,cron_name) (kubevirt_cdi_dataimportcron_outdated{pending="false"}) > 0`),
61+
Expr: intstr.FromString(`sum by(namespace,cron_name) (kubevirt_cdi_dataimportcron_outdated{pending="false", namespace=~"openshift-virtualization-os-images|kubevirt-os-images"}) > 0`),
6262
For: (*promv1.Duration)(ptr.To("15m")),
6363
Annotations: map[string]string{
6464
"summary": "DataImportCron (recurring polling of VM templates disk image sources, also known as golden images) PVCs are not being updated on the defined schedule",
6565
},
6666
Labels: map[string]string{
67-
severityAlertLabelKey: "info",
67+
severityAlertLabelKey: "warning",
6868
operatorHealthImpactLabelKey: "warning",
6969
},
7070
},
71+
{
72+
Alert: "CDIUserDefinedDataImportCronOutdated",
73+
Expr: intstr.FromString(`sum by(namespace,cron_name) (kubevirt_cdi_dataimportcron_outdated{pending="false", namespace!~"openshift-virtualization-os-images|kubevirt-os-images"}) > 0`),
74+
For: (*promv1.Duration)(ptr.To("15m")),
75+
Annotations: map[string]string{
76+
"summary": "DataImportCron (recurring polling of VM templates disk image sources, also known as golden images) PVCs are not being updated on the defined schedule",
77+
},
78+
Labels: map[string]string{
79+
severityAlertLabelKey: "warning",
80+
operatorHealthImpactLabelKey: "none",
81+
},
82+
},
7183
{
7284
Alert: "CDINoDefaultStorageClass",
7385
Expr: intstr.FromString(`sum(kubevirt_cdi_storageprofile_info{default="true"} or on() vector(0)) +

0 commit comments

Comments
 (0)