add more labels, ditch uptime
This commit is contained in:
parent
bf74687f42
commit
04789d54e9
|
|
@ -161,11 +161,11 @@ func descUAP(ns string) *uap {
|
|||
|
||||
func (u *promUnifi) exportUAP(r report, d *unifi.UAP) {
|
||||
labels := []string{d.Type, d.SiteName, d.Name}
|
||||
infoLabels := []string{d.Version, d.Model, d.Serial, d.Mac}
|
||||
infoLabels := []string{d.Version, d.Model, d.Serial, d.Mac, d.IP, d.ID, d.Bytes.Txt}
|
||||
|
||||
// Wireless System Data.
|
||||
r.send([]*metric{
|
||||
{u.Device.Info, prometheus.GaugeValue, d.Uptime, append(labels, infoLabels...)},
|
||||
{u.Device.Uptime, prometheus.GaugeValue, d.Uptime, labels},
|
||||
{u.Device.TotalTxBytes, prometheus.CounterValue, d.TxBytes, labels},
|
||||
{u.Device.TotalRxBytes, prometheus.CounterValue, d.RxBytes, labels},
|
||||
{u.Device.TotalBytes, prometheus.CounterValue, d.Bytes, labels},
|
||||
|
|
|
|||
|
|
@ -7,8 +7,7 @@ import (
|
|||
|
||||
// These are shared by all four device types: UDM, UAP, USG, USW
|
||||
type unifiDevice struct {
|
||||
Info *prometheus.Desc
|
||||
Uptime *prometheus.Desc
|
||||
Info *prometheus.Desc // uptime
|
||||
Temperature *prometheus.Desc // sw only
|
||||
TotalMaxPower *prometheus.Desc // sw only
|
||||
FanLevel *prometheus.Desc // sw only
|
||||
|
|
@ -36,10 +35,9 @@ type unifiDevice struct {
|
|||
|
||||
func descDevice(ns string) *unifiDevice {
|
||||
labels := []string{"type", "site_name", "name"}
|
||||
infoLabels := []string{"version", "model", "serial", "mac"}
|
||||
infoLabels := []string{"version", "model", "serial", "mac", "ip", "id", "bytes"}
|
||||
return &unifiDevice{
|
||||
Info: prometheus.NewDesc(ns+"info", "Device Information", append(labels, infoLabels...), nil),
|
||||
Uptime: prometheus.NewDesc(ns+"uptime", "Uptime", labels, nil),
|
||||
Temperature: prometheus.NewDesc(ns+"temperature_celsius", "Temperature", labels, nil),
|
||||
TotalMaxPower: prometheus.NewDesc(ns+"max_power_total", "Total Max Power", labels, nil),
|
||||
FanLevel: prometheus.NewDesc(ns+"fan_level", "Fan Level", labels, nil),
|
||||
|
|
@ -69,13 +67,12 @@ func descDevice(ns string) *unifiDevice {
|
|||
// UDM is a collection of stats from USG, USW and UAP. It has no unique stats.
|
||||
func (u *promUnifi) exportUDM(r report, d *unifi.UDM) {
|
||||
labels := []string{d.Type, d.SiteName, d.Name}
|
||||
infoLabels := []string{d.Version, d.Model, d.Serial, d.Mac}
|
||||
infoLabels := []string{d.Version, d.Model, d.Serial, d.Mac, d.IP, d.ID, d.Bytes.Txt}
|
||||
labelsGuest := append(labels, "guest")
|
||||
labelsUser := append(labels, "user")
|
||||
// Dream Machine System Data.
|
||||
r.send([]*metric{
|
||||
{u.Device.Info, prometheus.GaugeValue, d.Uptime, append(labels, infoLabels...)},
|
||||
{u.Device.Uptime, prometheus.GaugeValue, d.Uptime, labels},
|
||||
{u.Device.TotalTxBytes, prometheus.CounterValue, d.TxBytes, labels},
|
||||
{u.Device.TotalRxBytes, prometheus.CounterValue, d.RxBytes, labels},
|
||||
{u.Device.TotalBytes, prometheus.CounterValue, d.Bytes, labels},
|
||||
|
|
|
|||
|
|
@ -72,13 +72,12 @@ func descUSG(ns string) *usg {
|
|||
|
||||
func (u *promUnifi) exportUSG(r report, d *unifi.USG) {
|
||||
labels := []string{d.Type, d.SiteName, d.Name}
|
||||
infoLabels := []string{d.Version, d.Model, d.Serial, d.Mac}
|
||||
infoLabels := []string{d.Version, d.Model, d.Serial, d.Mac, d.IP, d.ID, d.Bytes.Txt}
|
||||
labelsUser := append(labels, "user")
|
||||
labelsGuest := append(labels, "guest")
|
||||
// Gateway System Data.
|
||||
r.send([]*metric{
|
||||
{u.Device.Info, prometheus.GaugeValue, d.Uptime, append(labels, infoLabels...)},
|
||||
{u.Device.Uptime, prometheus.GaugeValue, d.Uptime, labels},
|
||||
{u.Device.TotalTxBytes, prometheus.CounterValue, d.TxBytes, labels},
|
||||
{u.Device.TotalRxBytes, prometheus.CounterValue, d.RxBytes, labels},
|
||||
{u.Device.TotalBytes, prometheus.CounterValue, d.Bytes, labels},
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ func descUSW(ns string) *usw {
|
|||
func (u *promUnifi) exportUSW(r report, d *unifi.USW) {
|
||||
|
||||
labels := []string{d.Type, d.SiteName, d.Name}
|
||||
infoLabels := []string{d.Version, d.Model, d.Serial, d.Mac}
|
||||
infoLabels := []string{d.Version, d.Model, d.Serial, d.Mac, d.IP, d.ID, d.Bytes.Txt}
|
||||
labelsGuest := append(labels, "guest")
|
||||
labelsUser := append(labels, "user")
|
||||
if d.HasTemperature.Val {
|
||||
|
|
@ -106,7 +106,6 @@ func (u *promUnifi) exportUSW(r report, d *unifi.USW) {
|
|||
// Switch System Data.
|
||||
r.send([]*metric{
|
||||
{u.Device.Info, prometheus.GaugeValue, d.Uptime, append(labels, infoLabels...)},
|
||||
{u.Device.Uptime, prometheus.GaugeValue, d.Uptime, labels},
|
||||
{u.Device.TotalMaxPower, prometheus.GaugeValue, d.TotalMaxPower, labels},
|
||||
{u.Device.TotalTxBytes, prometheus.CounterValue, d.TxBytes, labels},
|
||||
{u.Device.TotalRxBytes, prometheus.CounterValue, d.RxBytes, labels},
|
||||
|
|
|
|||
Loading…
Reference in New Issue