diff options
author | Ralf Horstmann <ralf+github@ackstorm.de> | 2019-02-06 11:36:22 +0100 |
---|---|---|
committer | Ben Kochie <superq@gmail.com> | 2019-02-06 11:36:22 +0100 |
commit | 3867ad5ab00846010238bc10ab6aec04169fd7f5 (patch) | |
tree | 0a79e820e80c484069a6abbe21b57743bd48c9ea /collector/diskstats_darwin.go | |
parent | d442108d7ae3c3445b501fd253816b40c322a4f9 (diff) | |
download | prometheus_node_collector-3867ad5ab00846010238bc10ab6aec04169fd7f5.tar.bz2 prometheus_node_collector-3867ad5ab00846010238bc10ab6aec04169fd7f5.tar.xz prometheus_node_collector-3867ad5ab00846010238bc10ab6aec04169fd7f5.zip |
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>
Diffstat (limited to 'collector/diskstats_darwin.go')
-rw-r--r-- | collector/diskstats_darwin.go | 46 |
1 files changed, 6 insertions, 40 deletions
diff --git a/collector/diskstats_darwin.go b/collector/diskstats_darwin.go index a92de52..2c76582 100644 --- a/collector/diskstats_darwin.go +++ b/collector/diskstats_darwin.go | |||
@@ -22,10 +22,6 @@ import ( | |||
22 | "github.com/prometheus/client_golang/prometheus" | 22 | "github.com/prometheus/client_golang/prometheus" |
23 | ) | 23 | ) |
24 | 24 | ||
25 | const ( | ||
26 | diskSubsystem = "disk" | ||
27 | ) | ||
28 | |||
29 | type typedDescFunc struct { | 25 | type typedDescFunc struct { |
30 | typedDesc | 26 | typedDesc |
31 | value func(stat *iostat.DriveStats) float64 | 27 | value func(stat *iostat.DriveStats) float64 |
@@ -47,12 +43,7 @@ func NewDiskstatsCollector() (Collector, error) { | |||
47 | descs: []typedDescFunc{ | 43 | descs: []typedDescFunc{ |
48 | { | 44 | { |
49 | typedDesc: typedDesc{ | 45 | typedDesc: typedDesc{ |
50 | desc: prometheus.NewDesc( | 46 | desc: readsCompletedDesc, |
51 | prometheus.BuildFQName(namespace, diskSubsystem, "reads_completed_total"), | ||
52 | "The total number of reads completed successfully.", | ||
53 | diskLabelNames, | ||
54 | nil, | ||
55 | ), | ||
56 | valueType: prometheus.CounterValue, | 47 | valueType: prometheus.CounterValue, |
57 | }, | 48 | }, |
58 | value: func(stat *iostat.DriveStats) float64 { | 49 | value: func(stat *iostat.DriveStats) float64 { |
@@ -75,12 +66,7 @@ func NewDiskstatsCollector() (Collector, error) { | |||
75 | }, | 66 | }, |
76 | { | 67 | { |
77 | typedDesc: typedDesc{ | 68 | typedDesc: typedDesc{ |
78 | desc: prometheus.NewDesc( | 69 | desc: readTimeSecondsDesc, |
79 | prometheus.BuildFQName(namespace, diskSubsystem, "read_time_seconds_total"), | ||
80 | "The total number of seconds spent by all reads.", | ||
81 | diskLabelNames, | ||
82 | nil, | ||
83 | ), | ||
84 | valueType: prometheus.CounterValue, | 70 | valueType: prometheus.CounterValue, |
85 | }, | 71 | }, |
86 | value: func(stat *iostat.DriveStats) float64 { | 72 | value: func(stat *iostat.DriveStats) float64 { |
@@ -89,12 +75,7 @@ func NewDiskstatsCollector() (Collector, error) { | |||
89 | }, | 75 | }, |
90 | { | 76 | { |
91 | typedDesc: typedDesc{ | 77 | typedDesc: typedDesc{ |
92 | desc: prometheus.NewDesc( | 78 | desc: writesCompletedDesc, |
93 | prometheus.BuildFQName(namespace, diskSubsystem, "writes_completed_total"), | ||
94 | "The total number of writes completed successfully.", | ||
95 | diskLabelNames, | ||
96 | nil, | ||
97 | ), | ||
98 | valueType: prometheus.CounterValue, | 79 | valueType: prometheus.CounterValue, |
99 | }, | 80 | }, |
100 | value: func(stat *iostat.DriveStats) float64 { | 81 | value: func(stat *iostat.DriveStats) float64 { |
@@ -117,12 +98,7 @@ func NewDiskstatsCollector() (Collector, error) { | |||
117 | }, | 98 | }, |
118 | { | 99 | { |
119 | typedDesc: typedDesc{ | 100 | typedDesc: typedDesc{ |
120 | desc: prometheus.NewDesc( | 101 | desc: writeTimeSecondsDesc, |
121 | prometheus.BuildFQName(namespace, diskSubsystem, "write_time_seconds_total"), | ||
122 | "This is the total number of seconds spent by all writes.", | ||
123 | diskLabelNames, | ||
124 | nil, | ||
125 | ), | ||
126 | valueType: prometheus.CounterValue, | 102 | valueType: prometheus.CounterValue, |
127 | }, | 103 | }, |
128 | value: func(stat *iostat.DriveStats) float64 { | 104 | value: func(stat *iostat.DriveStats) float64 { |
@@ -131,12 +107,7 @@ func NewDiskstatsCollector() (Collector, error) { | |||
131 | }, | 107 | }, |
132 | { | 108 | { |
133 | typedDesc: typedDesc{ | 109 | typedDesc: typedDesc{ |
134 | desc: prometheus.NewDesc( | 110 | desc: readBytesDesc, |
135 | prometheus.BuildFQName(namespace, diskSubsystem, "read_bytes_total"), | ||
136 | "The total number of bytes read successfully.", | ||
137 | diskLabelNames, | ||
138 | nil, | ||
139 | ), | ||
140 | valueType: prometheus.CounterValue, | 111 | valueType: prometheus.CounterValue, |
141 | }, | 112 | }, |
142 | value: func(stat *iostat.DriveStats) float64 { | 113 | value: func(stat *iostat.DriveStats) float64 { |
@@ -145,12 +116,7 @@ func NewDiskstatsCollector() (Collector, error) { | |||
145 | }, | 116 | }, |
146 | { | 117 | { |
147 | typedDesc: typedDesc{ | 118 | typedDesc: typedDesc{ |
148 | desc: prometheus.NewDesc( | 119 | desc: writtenBytesDesc, |
149 | prometheus.BuildFQName(namespace, diskSubsystem, "written_bytes_total"), | ||
150 | "The total number of bytes written successfully.", | ||
151 | diskLabelNames, | ||
152 | nil, | ||
153 | ), | ||
154 | valueType: prometheus.CounterValue, | 120 | valueType: prometheus.CounterValue, |
155 | }, | 121 | }, |
156 | value: func(stat *iostat.DriveStats) float64 { | 122 | value: func(stat *iostat.DriveStats) float64 { |