Add diskstats collector for OpenBSD (#1250)
* Add diskstats collector for OpenBSD Tested on i386 and amd64, OpenBSD 6.4 and -current. * Refactor diskstats collectors This moves common descriptors from Linux, Darwin, OpenBSD diskstats collectors into diskstats_common.go Signed-off-by: Ralf Horstmann <ralf+github@ackstorm.de>
This commit is contained in:
parent
d442108d7a
commit
3867ad5ab0
6 changed files with 162 additions and 84 deletions
|
|
@ -22,10 +22,6 @@ import (
|
|||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
const (
|
||||
diskSubsystem = "disk"
|
||||
)
|
||||
|
||||
type typedDescFunc struct {
|
||||
typedDesc
|
||||
value func(stat *iostat.DriveStats) float64
|
||||
|
|
@ -47,12 +43,7 @@ func NewDiskstatsCollector() (Collector, error) {
|
|||
descs: []typedDescFunc{
|
||||
{
|
||||
typedDesc: typedDesc{
|
||||
desc: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(namespace, diskSubsystem, "reads_completed_total"),
|
||||
"The total number of reads completed successfully.",
|
||||
diskLabelNames,
|
||||
nil,
|
||||
),
|
||||
desc: readsCompletedDesc,
|
||||
valueType: prometheus.CounterValue,
|
||||
},
|
||||
value: func(stat *iostat.DriveStats) float64 {
|
||||
|
|
@ -75,12 +66,7 @@ func NewDiskstatsCollector() (Collector, error) {
|
|||
},
|
||||
{
|
||||
typedDesc: typedDesc{
|
||||
desc: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(namespace, diskSubsystem, "read_time_seconds_total"),
|
||||
"The total number of seconds spent by all reads.",
|
||||
diskLabelNames,
|
||||
nil,
|
||||
),
|
||||
desc: readTimeSecondsDesc,
|
||||
valueType: prometheus.CounterValue,
|
||||
},
|
||||
value: func(stat *iostat.DriveStats) float64 {
|
||||
|
|
@ -89,12 +75,7 @@ func NewDiskstatsCollector() (Collector, error) {
|
|||
},
|
||||
{
|
||||
typedDesc: typedDesc{
|
||||
desc: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(namespace, diskSubsystem, "writes_completed_total"),
|
||||
"The total number of writes completed successfully.",
|
||||
diskLabelNames,
|
||||
nil,
|
||||
),
|
||||
desc: writesCompletedDesc,
|
||||
valueType: prometheus.CounterValue,
|
||||
},
|
||||
value: func(stat *iostat.DriveStats) float64 {
|
||||
|
|
@ -117,12 +98,7 @@ func NewDiskstatsCollector() (Collector, error) {
|
|||
},
|
||||
{
|
||||
typedDesc: typedDesc{
|
||||
desc: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(namespace, diskSubsystem, "write_time_seconds_total"),
|
||||
"This is the total number of seconds spent by all writes.",
|
||||
diskLabelNames,
|
||||
nil,
|
||||
),
|
||||
desc: writeTimeSecondsDesc,
|
||||
valueType: prometheus.CounterValue,
|
||||
},
|
||||
value: func(stat *iostat.DriveStats) float64 {
|
||||
|
|
@ -131,12 +107,7 @@ func NewDiskstatsCollector() (Collector, error) {
|
|||
},
|
||||
{
|
||||
typedDesc: typedDesc{
|
||||
desc: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(namespace, diskSubsystem, "read_bytes_total"),
|
||||
"The total number of bytes read successfully.",
|
||||
diskLabelNames,
|
||||
nil,
|
||||
),
|
||||
desc: readBytesDesc,
|
||||
valueType: prometheus.CounterValue,
|
||||
},
|
||||
value: func(stat *iostat.DriveStats) float64 {
|
||||
|
|
@ -145,12 +116,7 @@ func NewDiskstatsCollector() (Collector, error) {
|
|||
},
|
||||
{
|
||||
typedDesc: typedDesc{
|
||||
desc: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(namespace, diskSubsystem, "written_bytes_total"),
|
||||
"The total number of bytes written successfully.",
|
||||
diskLabelNames,
|
||||
nil,
|
||||
),
|
||||
desc: writtenBytesDesc,
|
||||
valueType: prometheus.CounterValue,
|
||||
},
|
||||
value: func(stat *iostat.DriveStats) float64 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue