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_common.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_common.go')
-rw-r--r-- | collector/diskstats_common.go | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/collector/diskstats_common.go b/collector/diskstats_common.go new file mode 100644 index 0000000..7efb399 --- /dev/null +++ b/collector/diskstats_common.go | |||
@@ -0,0 +1,73 @@ | |||
1 | // Copyright 2019 The Prometheus Authors | ||
2 | // Licensed under the Apache License, Version 2.0 (the "License"); | ||
3 | // you may not use this file except in compliance with the License. | ||
4 | // You may obtain a copy of the License at | ||
5 | // | ||
6 | // http://www.apache.org/licenses/LICENSE-2.0 | ||
7 | // | ||
8 | // Unless required by applicable law or agreed to in writing, software | ||
9 | // distributed under the License is distributed on an "AS IS" BASIS, | ||
10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
11 | // See the License for the specific language governing permissions and | ||
12 | // limitations under the License. | ||
13 | |||
14 | // +build !nodiskstats | ||
15 | // +build openbsd linux darwin | ||
16 | |||
17 | package collector | ||
18 | |||
19 | import ( | ||
20 | "github.com/prometheus/client_golang/prometheus" | ||
21 | ) | ||
22 | |||
23 | const ( | ||
24 | diskSubsystem = "disk" | ||
25 | ) | ||
26 | |||
27 | var ( | ||
28 | diskLabelNames = []string{"device"} | ||
29 | |||
30 | readsCompletedDesc = prometheus.NewDesc( | ||
31 | prometheus.BuildFQName(namespace, diskSubsystem, "reads_completed_total"), | ||
32 | "The total number of reads completed successfully.", | ||
33 | diskLabelNames, nil, | ||
34 | ) | ||
35 | |||
36 | readBytesDesc = prometheus.NewDesc( | ||
37 | prometheus.BuildFQName(namespace, diskSubsystem, "read_bytes_total"), | ||
38 | "The total number of bytes read successfully.", | ||
39 | diskLabelNames, nil, | ||
40 | ) | ||
41 | |||
42 | writesCompletedDesc = prometheus.NewDesc( | ||
43 | prometheus.BuildFQName(namespace, diskSubsystem, "writes_completed_total"), | ||
44 | "The total number of writes completed successfully.", | ||
45 | diskLabelNames, nil, | ||
46 | ) | ||
47 | |||
48 | writtenBytesDesc = prometheus.NewDesc( | ||
49 | prometheus.BuildFQName(namespace, diskSubsystem, "written_bytes_total"), | ||
50 | "The total number of bytes written successfully.", | ||
51 | diskLabelNames, nil, | ||
52 | ) | ||
53 | |||
54 | ioTimeSecondsDesc = prometheus.NewDesc( | ||
55 | prometheus.BuildFQName(namespace, diskSubsystem, "io_time_seconds_total"), | ||
56 | "Total seconds spent doing I/Os.", | ||
57 | diskLabelNames, nil, | ||
58 | ) | ||
59 | |||
60 | readTimeSecondsDesc = prometheus.NewDesc( | ||
61 | prometheus.BuildFQName(namespace, diskSubsystem, "read_time_seconds_total"), | ||
62 | "The total number of seconds spent by all reads.", | ||
63 | diskLabelNames, | ||
64 | nil, | ||
65 | ) | ||
66 | |||
67 | writeTimeSecondsDesc = prometheus.NewDesc( | ||
68 | prometheus.BuildFQName(namespace, diskSubsystem, "write_time_seconds_total"), | ||
69 | "This is the total number of seconds spent by all writes.", | ||
70 | diskLabelNames, | ||
71 | nil, | ||
72 | ) | ||
73 | ) | ||