junos_exporter
junos_exporter copied to clipboard
Allow disabling features per device or fallback more gracefully
We are currently trying to roll this out and our smallest devices (EX2200) simply don't support power metering.
> show chassis power
error: command is not valid on the ex2200-c-12t-2g
which makes the export for that complete device fail
Could not connect to switch.example.net: could not connect to device: ssh: handshake failed: EOF
Power: expected element type <rpc-reply> but have <command>
One solution to this could be to allow disabling features on a per device basis. Ideally this could be extended to a grouping logic. Another approach I could imagine would be to notice these kinds of responses and disable the feature for this device at runtime.
As of today you already can define a feature set for a device. At the moment it has to be the complete set (not an override). I will addresss this topic in the future. I added an example in the README for the current approach.
It'd be great if we'd be able to scrape the different groups of metrics per device dynamically (i.e., not just through the config file), e.g., http://localhost:9326/metrics?target=1.2.3.4&features=isis,bgp,rpki
/ http://localhost:9326/metrics?target=5.6.7.8&features=storage,fpc,alarm
. Would you be open to something like this @czerwonk?