-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add myuplink_system_device_point_enum
Signed-off-by: Markus Blaschke <[email protected]>
- Loading branch information
Showing
2 changed files
with
78 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/prometheus/client_golang/prometheus" | ||
) | ||
|
||
type ( | ||
MyUplinkMetrics struct { | ||
system *prometheus.GaugeVec | ||
systemDevice *prometheus.GaugeVec | ||
systemDevicePoint *prometheus.GaugeVec | ||
systemDevicePointEnum *prometheus.GaugeVec | ||
} | ||
) | ||
|
||
func NewMyUplinkMetrics(registry *prometheus.Registry) *MyUplinkMetrics { | ||
metrics := &MyUplinkMetrics{} | ||
|
||
metrics.system = prometheus.NewGaugeVec( | ||
prometheus.GaugeOpts{ | ||
Name: "myuplink_system_info", | ||
Help: "myUplink system information", | ||
}, | ||
[]string{"systemID", "systemName", "country"}, | ||
) | ||
registry.MustRegister(metrics.system) | ||
|
||
metrics.systemDevice = prometheus.NewGaugeVec( | ||
prometheus.GaugeOpts{ | ||
Name: "myuplink_system_device_info", | ||
Help: "myUplink system device information", | ||
}, | ||
[]string{"systemID", "deviceID", "deviceName", "serialNumber", "connectionState", "firmwareVersion"}, | ||
) | ||
registry.MustRegister(metrics.systemDevice) | ||
|
||
metrics.systemDevicePoint = prometheus.NewGaugeVec( | ||
prometheus.GaugeOpts{ | ||
Name: "myuplink_system_device_point", | ||
Help: "myUplink device metric point", | ||
}, | ||
[]string{"systemID", "deviceID", "category", "parameterID", "parameterName", "parameterUnit"}, | ||
) | ||
registry.MustRegister(metrics.systemDevicePoint) | ||
|
||
metrics.systemDevicePointEnum = prometheus.NewGaugeVec( | ||
prometheus.GaugeOpts{ | ||
Name: "myuplink_system_device_point_enum", | ||
Help: "myUplink device metric point enum value", | ||
}, | ||
[]string{"systemID", "deviceID", "category", "parameterID", "parameterName", "parameterUnit", "valueText"}, | ||
) | ||
registry.MustRegister(metrics.systemDevicePointEnum) | ||
|
||
return metrics | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters