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

Added new metrics to be federated according to new alertRules #176

Merged
merged 1 commit into from Jun 15, 2022

Conversation

bindrad
Copy link
Member

@bindrad bindrad commented Apr 22, 2022

This fixes two alerts

  1. CephMonQuorumLost
  2. CephMgrIsMissingReplicas

As there are two replicas of the Prometheus pod in the openshift-monitoring namespace and when we execute PersistentVolumeUsageNearFull and PersistentVolumeUsageCritical alertRule we get this error Error executing query: found duplicate series for the match group {storageclass="ocs-storagecluster-cephfs"} on the right hand-side of the operation: [{__name__="kube_storageclass_info", container="kube-rbac-proxy-main", endpoint="https-main", job="kube-state-metrics", namespace="openshift-monitoring", prometheus="openshift-monitoring/k8s", provisioner="openshift-storage.cephfs.csi.ceph.com", reclaim_policy="Delete", service="kube-state-metrics", storageclass="ocs-storagecluster-cephfs", volume_binding_mode="Immediate"}, {__name__="kube_storageclass_info", container="kube-rbac-proxy-main", endpoint="https-main", job="kube-state-metrics", namespace="openshift-monitoring", pod="prometheus-k8s-1", prometheus="openshift-monitoring/k8s", provisioner="openshift-storage.cephfs.csi.ceph.com", reclaim_policy="Delete", service="kube-state-metrics", storageclass="ocs-storagecluster-cephfs", volume_binding_mode="Immediate"}];many-to-many matching not allowed: matching labels must be unique on one side so we added labeldrop for pod label.

But now CephMonQuorumLost alert requires pod label so we are relabelling in such a way that the metrics that have pod label whose value is prometheus-k8s-0 or prometheus-k8s-1 will be replaced with blank value.

Metric before change:
    kube_pod_status_phase{container="kube-rbac-proxy-main", endpoint="https-main", job="kube-state-metrics", namespace="openshift-monitoring", phase="Succeeded", pod="prometheus-k8s-1", prometheus="openshift-monitoring/k8s", service="kube-state-metrics", uid="071feb6a-7d97-4ec3-93fd-938d27c5a097"}
Metrics after change:
    kube_pod_status_phase{container="kube-rbac-proxy-main", endpoint="https-main", job="kube-state-metrics", namespace="openshift-monitoring", phase="Succeeded", prometheus="openshift-monitoring/k8s", service="kube-state-metrics", uid="071feb6a-7d97-4ec3-93fd-938d27c5a097"}

Signed-off-by: bindrad dbindra@redhat.com

@bindrad
Copy link
Member Author

bindrad commented May 31, 2022

Based on our call regarding this PR, I don't think it is possible to drop the label with specific key-value pair
The other alternative is to replace prometheus-k8s-0 and prometheus-k8s-1 values with something generic such as promethueus-k8s and drop metrics that have prometheus-k8s-0 and prometheus-k8-1 values for the pod label

@leelavg
Copy link
Collaborator

leelavg commented Jun 8, 2022

@bindrad does this pr needs a re-work?

@bindrad
Copy link
Member Author

bindrad commented Jun 8, 2022

@bindrad does this pr needs a re-work?

@leelavg I re-worked on it and pushed the changes 2 days ago, waiting for it to get reviewed.

@leelavg
Copy link
Collaborator

leelavg commented Jun 8, 2022

  • Ack, will take a look at the earliest.
  • I read last comment and pinged for an update, thanks for the confirmation.

@bindrad bindrad requested a review from leelavg June 8, 2022 13:24
leelavg
leelavg previously approved these changes Jun 14, 2022
Copy link
Collaborator

@leelavg leelavg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

…ated metric relabelling

This fixes two alerts
1. CephMonQuorumLost
2. CephMgrIsMissingReplicas

The metrics that have pod label whose value is prometheus-k8s-0 or prometheus-k8s-1 will be replaced with blank value.
Metric before change:
kube_pod_status_phase{container="kube-rbac-proxy-main", endpoint="https-main", job="kube-state-metrics", namespace="openshift-monitoring", phase="Succeeded", pod="prometheus-k8s-1", prometheus="openshift-monitoring/k8s", service="kube-state-metrics", uid="071feb6a-7d97-4ec3-93fd-938d27c5a097"}
Metrics after change:
kube_pod_status_phase{container="kube-rbac-proxy-main", endpoint="https-main", job="kube-state-metrics", namespace="openshift-monitoring", phase="Succeeded", prometheus="openshift-monitoring/k8s", service="kube-state-metrics", uid="071feb6a-7d97-4ec3-93fd-938d27c5a097"}

Signed-off-by: bindrad <dbindra@redhat.com>
@bindrad
Copy link
Member Author

bindrad commented Jun 15, 2022

@nb-ohad This PR can be merged

@nb-ohad nb-ohad merged commit 3e85349 into red-hat-storage:main Jun 15, 2022
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants