forked from hansmi/prometheus-lvm-exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vg.go
142 lines (138 loc) · 3.6 KB
/
vg.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
package main
import "github.com/hansmi/prometheus-lvm-exporter/lvmreport"
var vgGroup = &group{
name: lvmreport.VG,
infoMetricName: "vg_info",
keyFields: []*descriptor{
{fieldName: "vg_uuid", metricName: "vg_uuid", desc: "Unique identifier"},
},
infoFields: []*descriptor{
{fieldName: "vg_allocation_policy", metricName: "vg_allocation_policy"},
{fieldName: "vg_attr", metricName: "vg_attr"},
{fieldName: "vg_fmt", metricName: "vg_fmt", desc: "Type of metadata"},
{fieldName: "vg_lock_args", metricName: "vg_lock_args"},
{fieldName: "vg_lock_type", metricName: "vg_lock_type"},
{fieldName: "vg_name", metricName: "vg_name", desc: "Name"},
{fieldName: "vg_permissions", metricName: "vg_permissions"},
{fieldName: "vg_systemid", metricName: "vg_systemid"},
{fieldName: "vg_tags", metricName: "vg_tags"},
},
metricFields: []*descriptor{
{
fieldName: "lv_count",
metricName: "vg_lv_count",
desc: "Number of LVs",
},
{
fieldName: "max_lv",
metricName: "vg_max_lv",
desc: "Maximum number of LVs allowed in VG or 0 if unlimited",
},
{
fieldName: "max_pv",
metricName: "vg_max_pv",
desc: "Maximum number of PVs allowed in VG or 0 if unlimited",
},
{
fieldName: "pv_count",
metricName: "vg_pv_count",
desc: "Number of PVs in VG",
},
{
fieldName: "snap_count",
metricName: "vg_snap_count",
desc: "Number of snapshots",
},
{
fieldName: "vg_clustered",
metricName: "vg_clustered",
desc: "Set if VG is clustered",
},
{
fieldName: "vg_exported",
metricName: "vg_exported",
desc: "Set if VG is exported",
},
{
fieldName: "vg_extendable",
metricName: "vg_extendable",
desc: "Set if VG is extendable",
},
{
fieldName: "vg_extent_count",
metricName: "vg_extent_count",
desc: "Total number of Physical Extents",
},
{
fieldName: "vg_extent_size",
metricName: "vg_extent_size_bytes",
desc: "Size of Physical Extents",
},
{
fieldName: "vg_free",
metricName: "vg_free_bytes",
desc: "Total amount of free space in bytes",
},
{
fieldName: "vg_free_count",
metricName: "vg_free_count",
desc: "Total number of unallocated Physical Extents",
},
{
fieldName: "vg_mda_copies",
metricName: "vg_mda_copies",
desc: "Target number of in use metadata areas in the VG",
metricValue: func(raw string) (float64, error) {
if raw == "unmanaged" {
return 0, nil
}
return fromNumeric(raw)
},
},
{
fieldName: "vg_mda_count",
metricName: "vg_mda_count",
desc: "Number of metadata areas",
},
{
fieldName: "vg_mda_free",
metricName: "vg_mda_free_bytes",
desc: "Free metadata area space for this VG",
},
{
fieldName: "vg_mda_size",
metricName: "vg_mda_size_bytes",
desc: "Size of smallest metadata area for this VG",
},
{
fieldName: "vg_mda_used_count",
metricName: "vg_mda_used_count",
desc: "Number of metadata areas in use on this VG",
},
{
fieldName: "vg_missing_pv_count",
metricName: "vg_missing_pv_count",
desc: "Number of PVs in VG which are missing",
},
{
fieldName: "vg_partial",
metricName: "vg_partial",
desc: "Set if VG is partial",
},
{
fieldName: "vg_seqno",
metricName: "vg_seqno",
desc: "Revision number of internal metadata",
},
{
fieldName: "vg_shared",
metricName: "vg_shared",
desc: "Set if VG is shared",
},
{
fieldName: "vg_size",
metricName: "vg_size_bytes",
desc: "Total size of VG in bytes",
},
},
}