Use the same namespace for collector and version.
Signed-off-by: Ben Kochie <superq@gmail.com>
This commit is contained in:
parent
3abcff9dbf
commit
d44324d3c7
|
|
@ -18,15 +18,16 @@ const oneDecimalPoint = 10
|
||||||
func (u *UnifiPoller) RunPrometheus() error {
|
func (u *UnifiPoller) RunPrometheus() error {
|
||||||
u.Logf("Exporting Measurements for Prometheus at https://%s/metrics", u.Config.HTTPListen)
|
u.Logf("Exporting Measurements for Prometheus at https://%s/metrics", u.Config.HTTPListen)
|
||||||
http.Handle("/metrics", promhttp.Handler())
|
http.Handle("/metrics", promhttp.Handler())
|
||||||
|
ns := strings.Replace(u.Config.Namespace, "-", "", -1)
|
||||||
prometheus.MustRegister(promunifi.NewUnifiCollector(promunifi.UnifiCollectorCnfg{
|
prometheus.MustRegister(promunifi.NewUnifiCollector(promunifi.UnifiCollectorCnfg{
|
||||||
Namespace: strings.Replace(u.Config.Namespace, "-", "", -1),
|
Namespace: ns,
|
||||||
CollectFn: u.ExportMetrics,
|
CollectFn: u.ExportMetrics,
|
||||||
LoggingFn: u.LogExportReport,
|
LoggingFn: u.LogExportReport,
|
||||||
ReportErrors: true, // XXX: Does this need to be configurable?
|
ReportErrors: true, // XXX: Does this need to be configurable?
|
||||||
}))
|
}))
|
||||||
|
|
||||||
version.Version = Version
|
version.Version = Version
|
||||||
prometheus.MustRegister(version.NewCollector("unifipoller"))
|
prometheus.MustRegister(version.NewCollector(ns))
|
||||||
|
|
||||||
return http.ListenAndServe(u.Config.HTTPListen, nil)
|
return http.ListenAndServe(u.Config.HTTPListen, nil)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue