czerwonk / junos_exporter

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

Add multi routing engine support to the "routing_engine" module #128

Closed AKYD closed 3 years ago

AKYD commented 3 years ago

(this should close https://github.com/czerwonk/junos_exporter/issues/83)

Since some info is not available on different setups, I've used the following conditional to only export the metric where the value exists. The other approach is to export it with the default value (0 for int, floats, empty string, etc). I slightly prefer to only have the metric appear when the value makes sense than always having it, but with an useless value.

if re.MemorySystemTotal > 0 {
    ch <- prometheus.MustNewConstMetric(memorySystemTotal, prometheus.GaugeValue, float64(re.MemorySystemTotal)*1024*1024, l...)
}