Check 0/0 targets

16 views
Skip to first unread message

Kameneko

unread,
Apr 20, 2020, 8:00:12 PM4/20/20
to Prometheus Users
Hello Community.

For some reason, Prometheus' target may be "0/0".
For example, if the Label of the Pod in the Scrape Targets has changed.

I would like to detect this.
I've considered the "up" metric, but it doesn't output.
How do I detect it?

00_targets.png



Julien Pivotto

unread,
Apr 20, 2020, 8:01:26 PM4/20/20
to Kameneko, Prometheus Users
On 20 Apr 16:58, Kameneko wrote:
> Hello Community.
>
> For some reason, Prometheus' target may be "0/0".
> For example, if the Label of the Pod in the Scrape Targets has changed.
>
> I would like to detect this.
> I've considered the "UP" metric, but it doesn't output.
> How do I detect it?


You can use the following metric:


prometheus_sd_discovered_targets == 0


regards,

>
> [image: 00_targets.png]
>
> --
> You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/b31b1963-657a-4d29-81e7-5af7e742969a%40googlegroups.com.




--
(o- Julien Pivotto
//\ Open-Source Consultant
V_/_ Inuits - https://www.inuits.eu
signature.asc

Kameneko

unread,
Apr 20, 2020, 8:32:51 PM4/20/20
to Prometheus Users
I ran it as follows.
Instead of 0, 59 came back.

Apparently, ServiceDiscovery is "0/59".
I would like to know the value of Active Targets.

What should I do?


# Query
prometheus_sd_discovered_targets{config="kube-system/fluentd-logging/0"}

# Result
prometheus_sd_discovered_targets{app="prometheus-k8s",config="kube-system/fluentd-logging/0",endpoint="web",instance="10.233.104.255:9090",job="prometheus-k8s",name="scrape",namespace="monitoring",pod="prometheus-k8s-1",service="prometheus-k8s"} 59
prometheus_sd_discovered_targets{app="prometheus-k8s",config="kube-system/fluentd-logging/0",endpoint="web",instance="10.233.74.160:9090",job="prometheus-k8s",name="scrape",namespace="monitoring",pod="prometheus-k8s-0",service="prometheus-k8s"} 59

# ServiceDiscovery
kube-system/fluentd-logging/0 (0/59 active targets)


2020年4月21日火曜日 9時00分12秒 UTC+9 Kameneko:

Julius Volz

unread,
Apr 21, 2020, 3:23:33 AM4/21/20
to Kameneko, Prometheus Users
On Tue, Apr 21, 2020 at 2:32 AM Kameneko <kame...@lab-dev.net> wrote:
I ran it as follows.
Instead of 0, 59 came back.

Apparently, ServiceDiscovery is "0/59".
I would like to know the value of Active Targets.

What should I do?


# Query
prometheus_sd_discovered_targets{config="kube-system/fluentd-logging/0"}

# Result
prometheus_sd_discovered_targets{app="prometheus-k8s",config="kube-system/fluentd-logging/0",endpoint="web",instance="10.233.104.255:9090",job="prometheus-k8s",name="scrape",namespace="monitoring",pod="prometheus-k8s-1",service="prometheus-k8s"} 59
prometheus_sd_discovered_targets{app="prometheus-k8s",config="kube-system/fluentd-logging/0",endpoint="web",instance="10.233.74.160:9090",job="prometheus-k8s",name="scrape",namespace="monitoring",pod="prometheus-k8s-0",service="prometheus-k8s"} 59

# ServiceDiscovery
kube-system/fluentd-logging/0 (0/59 active targets)

The query results above make sense if the UI is now also showing these 59 targets (like in your last line here), right? But before, that metric should have been 0.
 

2020年4月21日火曜日 9時00分12秒 UTC+9 Kameneko:
Hello Community.

For some reason, Prometheus' target may be "0/0".
For example, if the Label of the Pod in the Scrape Targets has changed.

I would like to detect this.
I've considered the "up" metric, but it doesn't output.
How do I detect it?

00_targets.png



--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages