junos_exporter icon indicating copy to clipboard operation
junos_exporter copied to clipboard

junos_up metric seems to be missing?

Open mog01 opened this issue 2 years ago • 3 comments

Hi hi,

I managed to run junos_exporter on FreeBSD, I couldn't see the "junos_up" metric listed though... Should it be included in the metrics list by default? Or am I doing something wrong please?

thanks in advance!

mog01 avatar Aug 09 '23 08:08 mog01

I dont think there is a junos_up metric. There is the prometheus up{} for the target itself. But I am not entirely sure if this will actually go down if junos_exporter can't reach the target behind it. Because technically, the scrape job configured in prometheus is for the junos_exporter and successful, even the output is not what you expect.

You could alert on junos_scrape_duration_seconds{} and alert if it hits the timeout specified in your prometheus job. Alternatively you could check if you can alert on the last value being nil. Or you could use the prometheus blackbox_exporter to send icmp to the network devices.

cwaynej avatar Sep 01 '23 01:09 cwaynej

I thought it was one generated automatically like these...

junosDesc = map[string]*prometheus.Desc {
    "ScrapesTotal":   promDesc("scrapes_total", "Total number of times Junos has been scraped.", nil),
    "ScrapeErrTotal": promDesc("scrape_errors_total", "Total number of errors from a collector.", junosLabels),
    "ScrapeDuration": promDesc("scrape_duration_seconds", "Time it took for a collector's scrape to complete.", junosLabels),
    "CollectorUp":    promDesc("collector_up", "Whether the collector's last scrape was successful (1 = successful, 0 = unsuccessful).", junosLabels),
    "Up":             promDesc("up", "Whether the Junos collector is currently up.", nil),
}

I see things like:

# TYPE junos_scrapes_total counter
junos_scrapes_total 15287

# TYPE junos_scrape_errors_total gauge
junos_scrape_errors_total{collector="environment"} 0
junos_scrape_errors_total{collector="interface"} 0
junos_scrape_errors_total{collector="power"} 15287

But the last one in the code, junos_up{}, seems to be missing?

mog01 avatar Sep 13 '23 11:09 mog01

You are correct. The junos_up metric was not implemented because the more specific collector_up metric covers it.

Thanks for highlighting the code thate needs cleaning up.

tynany avatar Oct 17 '23 02:10 tynany