mirror of
https://github.com/nshttpd/mikrotik-exporter.git
synced 2024-11-16 10:25:12 +01:00
d170b0a4d2
* added config file implementation, refactoring * add gitignore * improved test * preperations for more metrics * added resource metrics * added first bgp metrics * added asn as label for bgp metrics * added prefix and message counts to bgp metrics * simplified * Update README.md * added yaml dependency * fixed go routine call * added timeout * clean up * added TLS support * set default api port for TLS * added routes metric * added missing log information * added type collectorContext to reduce the count of parameters for better readability * added DHCP and DHCPv6 metrics * filter for active dhcp leases only * added pool metrics * enable/disable feature in config file * refactoring * clean up * comment fix
30 lines
628 B
Go
30 lines
628 B
Go
package collector
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/prometheus/client_golang/prometheus"
|
|
)
|
|
|
|
func metricStringCleanup(in string) string {
|
|
return strings.Replace(in, "-", "_", -1)
|
|
}
|
|
|
|
func descriptionForPropertyName(prefix, property string, labelNames []string) *prometheus.Desc {
|
|
return prometheus.NewDesc(
|
|
prometheus.BuildFQName(namespace, prefix, metricStringCleanup(property)),
|
|
property,
|
|
labelNames,
|
|
nil,
|
|
)
|
|
}
|
|
|
|
func description(prefix, name, helpText string, labelNames []string) *prometheus.Desc {
|
|
return prometheus.NewDesc(
|
|
prometheus.BuildFQName(namespace, prefix, name),
|
|
helpText,
|
|
labelNames,
|
|
nil,
|
|
)
|
|
}
|