'How to get number of nodes running in prometheus

I am trying to create an alert in which, when the number of nodes increase or decrease I'll send an alert.

currently, I can get the node's count using this:

count(kube_node_info)

but I want to get the node's count for 5 mins and 1min so that I can do the subtraction and sent the alert. I don't know how to get the count of nodes for a 5m time frame.



Solution 1:[1]

You can use either the delta function or the offset modifier to get what you want.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Marcelo Ávila de Oliveira