Prometheus check if namespace missing quota

Viewed 278

How can I check if some namespace is missing quota?

I expected the absent() function to return 1 when something doesn't exist and 0 when something exists. So I tried to do the next query:

absent(kube_namespace_labels) * on(namespace) group(kube_resourcequota) by(namespace)

But Prometheus returned Empty query result.

My final goal is to alert if some namespace is missing quota, how can I achieve this?

1 Answers

You can use a different query instead to have all namespaces where resourcequota is missing:

count by (namespace)(kube_namespace_labels) unless sum by (namespace)(kube_resourcequota)
Related