forked from suprememoocow/victron-exporter
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmetrics.go
40 lines (33 loc) · 1.19 KB
/
metrics.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package main
import (
"github.com/prometheus/client_golang/prometheus"
)
const namespace = "victron"
var (
connectionStatus = prometheus.NewGaugeVec(prometheus.GaugeOpts{
Namespace: namespace,
Name: "mqtt_connection_state",
Help: "0=Disconnected; 1=Connected",
}, []string{"client_id"})
connectionStatusSinceTimeSeconds = prometheus.NewGaugeVec(prometheus.GaugeOpts{
Namespace: namespace,
Name: "mqtt_connection_state_since_time_seconds",
Help: "Time since last change to mqtt_connection_state",
}, []string{"client_id"})
subscriptionsUpdatesTotal = prometheus.NewCounter(prometheus.CounterOpts{
Namespace: namespace,
Name: "mqtt_subscription_updates_total",
Help: "MQTT subscriptions updated received",
})
subscriptionsUpdatesIgnoredTotal = prometheus.NewCounter(prometheus.CounterOpts{
Namespace: namespace,
Name: "mqtt_subscription_updates_ignored_total",
Help: "MQTT subscription updates ignored",
})
)
func init() {
prometheus.MustRegister(connectionStatus)
prometheus.MustRegister(connectionStatusSinceTimeSeconds)
prometheus.MustRegister(subscriptionsUpdatesTotal)
prometheus.MustRegister(subscriptionsUpdatesIgnoredTotal)
}