Graphing number of targets

Hi, I’m trying to add a chart which shows the changing number of target nodes that I am scraping. Using this query.

sum(prometheus_target_scrape_pool_targets)

I get a level line that accurately shows the current sum of my targets (across all jobs) – at present. But, that’s not what I want.

I then tried out sum(rate(prometheus_target_scrape_pool_targets[1h])) but that returns “0”

So, what am I missing with my query in order to get a moving graph of targets over time?

Thanks

Hi,

What do you mean changing number of target nodes? Are your nodes
replaced or renames?

Over time, our targets rise and fall. I would like to see the trend over time. Plus, if I see a sudden, unexpected drop, that would alert me to a problem in scraping a particular job.

count (up) by (job)

Thank you, this is getting close, I’m seeing change in targets over time. But I have found a problem. The count I am getting is ALL targets in each job, including targets which are actually down. So it seems the (up) metric is not accurate.

Then, use

sum (up) by (job)

:slight_smile:

That works, thanks!