Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exporter: add alert for storagequotautilizationration > 0.8 #2861

Merged
merged 1 commit into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions metrics/deploy/prometheus-ocs-rules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,16 @@ spec:
floor((ocs_storage_provider_operator_version>0)/1000) - ignoring(storage_consumer_name) group_right() floor((ocs_storage_client_operator_version>0)/1000) > 1 or floor((ocs_storage_client_operator_version>0)/1000) - ignoring(storage_consumer_name) group_left() floor((ocs_storage_provider_operator_version>0)/1000) >= 1
labels:
severity: critical
- alert: StorageQuotaUtilizationThresholdReached
annotations:
description: ODF client ({{ $labels.client_name }}) - ({{ $labels.client_cluster_name }}) storage consumption has surpassed 80% of the configured quota, this might result in issues in the creation of new PV/PVCs on the target cluster.
message: ODF client ({{ $labels.odf_client_name }}) storage consumption has surpassed 80% of the configured quota, this might result in issues in the creation of new PV/PVCs on the target cluster.
runbook_url: https://github.com/openshift/runbooks/blob/master/alerts/openshift-container-storage-operator/StorageQuotaUtilizationThresholdReached.md
severity_level: warning
expr: |
ocs_storage_client_storage_quota_utilization_ratio > 0.8
labels:
severity: warning
- name: storage-cluster-alerts.rules
rules:
- alert: CephMonLowNumber
Expand Down
24 changes: 18 additions & 6 deletions metrics/internal/collectors/storageconsumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ import (
var _ prometheus.Collector = &StorageConsumerCollector{}

type StorageConsumerCollector struct {
Informer cache.SharedIndexInformer
StorageConsumerMetadata *prometheus.Desc
LastHeartbeat *prometheus.Desc
ProviderOperatorVersion *prometheus.Desc
ClientOperatorVersion *prometheus.Desc
AllowedNamespace string
Informer cache.SharedIndexInformer
StorageConsumerMetadata *prometheus.Desc
LastHeartbeat *prometheus.Desc
StorageQuotaUtilizationRatio *prometheus.Desc
ProviderOperatorVersion *prometheus.Desc
ClientOperatorVersion *prometheus.Desc
AllowedNamespace string
}

func NewStorageConsumerCollector(opts *options.Options) *StorageConsumerCollector {
Expand Down Expand Up @@ -60,6 +61,12 @@ func NewStorageConsumerCollector(opts *options.Options) *StorageConsumerCollecto
[]string{"storage_consumer_name"},
nil,
),
StorageQuotaUtilizationRatio: prometheus.NewDesc(
prometheus.BuildFQName("ocs", "storage_client", "storage_quota_utilization_ratio"),
`StorageQuotaUtilizationRatio of ODF Storage Client`,
[]string{"client_name", "client_cluster_name"},
nil,
),
Informer: sharedIndexInformer,
}
}
Expand All @@ -78,6 +85,7 @@ func (c *StorageConsumerCollector) Describe(ch chan<- *prometheus.Desc) {
c.LastHeartbeat,
c.ProviderOperatorVersion,
c.ClientOperatorVersion,
c.StorageQuotaUtilizationRatio,
}
for _, d := range ds {
ch <- d
Expand Down Expand Up @@ -137,6 +145,10 @@ func (c *StorageConsumerCollector) collectStorageConsumersMetadata(storageConsum
prometheus.GaugeValue,
float64(encodeVersion(storageConsumer.Status.Client.OperatorVersion)),
storageConsumer.Name)

ch <- prometheus.MustNewConstMetric(c.StorageQuotaUtilizationRatio,
prometheus.GaugeValue, storageConsumer.Status.Client.StorageQuotaUtilizationRatio,
storageConsumer.Status.Client.Name, storageConsumer.Status.Client.ClusterName)
}
}

Expand Down
Loading