czerwonk / junos_exporter

Exporter for devices running JunOS to use with https://prometheus.io/
MIT License
198 stars 81 forks source link

High CPU usage on the switches when using the exporter #205

Open ademenfis opened 1 year ago

ademenfis commented 1 year ago

Hi, I'm trying to use the exporter but I see the CPUs are spiking up when the scrape is happening.

Screenshot 2022-12-08 at 11 23 33

This shows the cpu usage since the target was added in week 39 has increased exponentially. I don't see anything particular in the switches logs.

Am I missing something? Should I enable some sort of caching in junos?

Thank you and sorry if this is not the right place to ask

4xoc commented 1 year ago

Unfortunately this just happens and afaik cannot be avoided. Due to the nature of the exporter having to run multiple cli commands that, depending on hardware model, can cause a lot of cpu use. This should however not have a high impact, if any at all, for the performance of the device since the CPU usage is for the control plane only. Do fewer scrapes if a constant high cpu use is of concern to you.

Nothing4You commented 1 year ago

considering the stated goal in the readme this is really baffling me:

The set of metrics is minimal to increase performance. We (a few friends from the Freifunk community and myself) used the generic snmp_exporter before. Since snmp_exporter is highly generic it comes with a lot of complexity at the cost of performance. We wanted to have an KIS and vendor specific exporter instead. This approach should allow us to scrape our metrics in a very time efficient way.

which performance is this supposed to increase?

i can see the configuration being much simpler and it being more flexible in the data available via CLI/RPC compared to what is available via snmp, as SNMP imposes some limitations e.g. in cluster scenarios, but the performance seems to be significantly worse, especially without using netconf (#190)