nshttpd / mikrotik-exporter

prometheus mikrotik device(s) exporter
BSD 3-Clause "New" or "Revised" License
550 stars 153 forks source link

Slow metrics endpoint #112

Open rlex opened 3 years ago

rlex commented 3 years ago

Monitoring two routers, both of them have around 100k routes via BGP.

When i call /metrics, it can take up to minute to print them. Does it calls mikrotik API every time i use /metrics?

nshttpd commented 3 years ago

Yes, it does. What is your polling rate from prometheus? It doesn't do any sort of caching because it expects that your poll rate from Prometheus is what you want as the granularity of the metrics as reported by the exporter.

I have had the pondering of a couple of things to add in and I should probably just add them as issues to do here at some point. The first is to spin up a collection go func per device with a configurable max concurrency value. So that users with multiple devices won't have to wait for the serialization of all the devices.

The other would be the same thing, but for each metric type that needs to be collected. That I'm wondering on just how bad that would hammer the device API endpoint though. So at the very least I could do the first and see how it helps and then work on the second.

Does that sound like a possible "maybe it would help" thing @rlex?

nshttpd commented 3 years ago

Oh, already add the go func per device thing already. I guess it's really just down to the other part then.