-
Notifications
You must be signed in to change notification settings - Fork 4
/
lv.go
522 lines (518 loc) · 13.9 KB
/
lv.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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
package main
import "github.com/hansmi/prometheus-lvm-exporter/lvmreport"
var lvGroup = &group{
name: lvmreport.LV,
infoMetricName: "lv_info",
keyFields: []*descriptor{
{
fieldName: "lv_uuid",
metricName: "lv_uuid",
desc: "Unique identifier",
},
},
infoFields: []*descriptor{
{
fieldName: "convert_lv",
metricName: "lv_convert_lv",
desc: "For lvconvert, Name of temporary LV created by lvconvert",
},
{
fieldName: "convert_lv_uuid",
metricName: "lv_convert_lv_uuid",
desc: "For lvconvert, UUID of temporary LV created by lvconvert",
},
{
fieldName: "data_lv",
metricName: "lv_data_lv",
desc: "For cache/thin/vdo pools, the LV holding the associated data",
},
{
fieldName: "data_lv_uuid",
metricName: "lv_data_lv_uuid",
desc: "For cache/thin/vdo pools, the UUID of the LV holding the associated data",
},
{
fieldName: "kernel_cache_policy",
metricName: "lv_kernel_cache_policy",
desc: "Cache policy used in kernel",
},
{
fieldName: "kernel_cache_settings",
metricName: "lv_kernel_cache_settings",
desc: "Cache settings/parameters as set in kernel, including default values (cached segments only)",
},
{
fieldName: "kernel_discards",
metricName: "lv_kernel_discards",
desc: "For thin pools, how discards are handled in kernel",
},
{
fieldName: "kernel_metadata_format",
metricName: "lv_kernel_metadata_format",
desc: "Cache metadata format used in kernel",
},
{
fieldName: "lv_active",
metricName: "lv_active",
desc: "Active state of the LV",
},
{
fieldName: "lv_allocation_policy",
metricName: "lv_allocation_policy",
desc: "LV allocation policy",
},
{
fieldName: "lv_ancestors",
metricName: "lv_ancestors",
desc: "LV ancestors ignoring any stored history of the ancestry chain",
},
{
fieldName: "lv_attr",
metricName: "lv_attr",
desc: "Various attributes",
},
{
fieldName: "lv_descendants",
metricName: "lv_descendants",
desc: "LV descendants ignoring any stored history of the ancestry chain",
},
{
fieldName: "lv_dm_path",
metricName: "lv_dm_path",
desc: "Internal device-mapper pathname for LV (in /dev/mapper directory)",
},
{
fieldName: "lv_full_ancestors",
metricName: "lv_full_ancestors",
desc: "LV ancestors including stored history of the ancestry chain",
},
{
fieldName: "lv_full_descendants",
metricName: "lv_full_descendants",
desc: "LV descendants including stored history of the ancestry chain",
},
{
fieldName: "lv_full_name",
metricName: "lv_full_name",
desc: "Full name of LV including its VG, namely VG/LV",
},
{
fieldName: "lv_health_status",
metricName: "lv_health_status",
desc: "LV health status",
},
{
fieldName: "lv_host",
metricName: "lv_host",
desc: "Creation host of the LV, if known",
},
{
fieldName: "lv_kernel_read_ahead",
metricName: "lv_kernel_read_ahead_bytes",
desc: "Currently-in-use read ahead setting",
},
{
fieldName: "lv_layout",
metricName: "lv_layout",
desc: "LV layout",
},
{
fieldName: "lv_lockargs",
metricName: "lv_lockargs",
desc: "Lock args of the LV used by lvmlockd",
},
{
fieldName: "lv_modules",
metricName: "lv_modules",
desc: "Kernel device-mapper modules required for this LV",
},
{
fieldName: "lv_name",
metricName: "lv_name",
desc: "Name; LVs created for internal use are enclosed in brackets",
},
{
fieldName: "lv_parent",
metricName: "lv_parent",
desc: "For LVs that are components of another LV, the parent LV",
},
{
fieldName: "lv_path",
metricName: "lv_path",
desc: "Full pathname for LV. Blank for internal LVs",
},
{
fieldName: "lv_permissions",
metricName: "lv_permissions",
desc: "LV permissions",
},
{
fieldName: "lv_role",
metricName: "lv_role",
desc: "LV role",
},
{
fieldName: "lv_tags",
metricName: "lv_tags",
desc: "Tags, if any",
},
{
fieldName: "lv_when_full",
metricName: "lv_when_full",
desc: "For thin pools, behavior when full",
},
{
fieldName: "metadata_lv",
metricName: "lv_metadata_lv",
desc: "For cache/thin pools, the LV holding the associated metadata",
},
{
fieldName: "metadata_lv_uuid",
metricName: "lv_metadata_lv_uuid",
desc: "For cache/thin pools, the UUID of the LV holding the associated metadata",
},
{
fieldName: "mirror_log",
metricName: "lv_mirror_log",
desc: "For mirrors, the LV holding the synchronisation log",
},
{
fieldName: "mirror_log_uuid",
metricName: "lv_mirror_log_uuid",
desc: "For mirrors, the UUID of the LV holding the synchronisation log",
},
{
fieldName: "move_pv",
metricName: "lv_move_pv",
desc: "For pvmove, Source PV of temporary LV created by pvmove",
},
{
fieldName: "move_pv_uuid",
metricName: "lv_move_pv_uuid",
desc: "For pvmove, the UUID of Source PV of temporary LV created by pvmove",
},
{
fieldName: "origin",
metricName: "lv_origin",
desc: "For snapshots and thins, the origin device of this LV",
},
{
fieldName: "origin_uuid",
metricName: "lv_origin_uuid",
desc: "For snapshots and thins, the UUID of origin device of this LV",
},
{
fieldName: "pool_lv",
metricName: "lv_pool_lv",
desc: "For cache/thin/vdo volumes, the cache/thin/vdo pool LV for this volume",
},
{
fieldName: "pool_lv_uuid",
metricName: "lv_pool_lv_uuid",
desc: "For cache/thin/vdo volumes, the UUID of the cache/thin/vdo pool LV for this volume",
},
{
fieldName: "raid_sync_action",
metricName: "lv_raid_sync_action",
desc: "For RAID, the current synchronization action being performed",
},
{
fieldName: "raidintegritymode",
metricName: "lv_raidintegritymode",
desc: "The integrity mode",
},
{
fieldName: "vdo_compression_state",
metricName: "lv_vdo_compression_state",
desc: "For vdo pools, whether compression is running",
},
{
fieldName: "vdo_index_state",
metricName: "lv_vdo_index_state",
desc: "For vdo pools, state of index for deduplication",
},
{
fieldName: "vdo_operating_mode",
metricName: "lv_vdo_operating_mode",
desc: "For vdo pools, its current operating mode",
},
},
metricFields: []*descriptor{
{
fieldName: "cache_dirty_blocks",
metricName: "lv_cache_dirty_blocks",
desc: "Dirty cache blocks",
},
{
fieldName: "cache_read_hits",
metricName: "lv_cache_read_hits",
desc: "Cache read hits",
},
{
fieldName: "cache_read_misses",
metricName: "lv_cache_read_misses",
desc: "Cache read misses",
},
{
fieldName: "cache_total_blocks",
metricName: "lv_cache_total_blocks",
desc: "Total cache blocks",
},
{
fieldName: "cache_used_blocks",
metricName: "lv_cache_used_blocks",
desc: "Used cache blocks",
},
{
fieldName: "cache_write_hits",
metricName: "lv_cache_write_hits",
desc: "Cache write hits",
},
{
fieldName: "cache_write_misses",
metricName: "lv_cache_write_misses",
desc: "Cache write misses",
},
{
fieldName: "copy_percent",
metricName: "lv_copy_percent",
desc: "For Cache, RAID, mirrors and pvmove, current percentage in-sync",
},
{
fieldName: "data_percent",
metricName: "lv_data_percent",
desc: "For snapshot, cache and thin pools and volumes, the percentage full if LV is active",
},
{
fieldName: "integritymismatches",
metricName: "lv_integritymismatches",
desc: "The number of integrity mismatches",
},
{
fieldName: "lv_active_exclusively",
metricName: "lv_active_exclusively",
desc: "Set if the LV is active exclusively",
},
{
fieldName: "lv_active_locally",
metricName: "lv_active_locally",
desc: "Set if the LV is active locally",
},
{
fieldName: "lv_active_remotely",
metricName: "lv_active_remotely",
desc: "Set if the LV is active remotely",
},
{
fieldName: "lv_allocation_locked",
metricName: "lv_allocation_locked",
desc: "Set if LV is locked against allocation changes",
},
{
fieldName: "lv_check_needed",
metricName: "lv_check_needed",
desc: "For thin pools and cache volumes, whether metadata check is needed",
},
{
fieldName: "lv_converting",
metricName: "lv_converting",
desc: "Set if LV is being converted",
},
{
fieldName: "lv_device_open",
metricName: "lv_device_open",
desc: "Set if LV device is open",
},
{
fieldName: "lv_fixed_minor",
metricName: "lv_fixed_minor",
desc: "Set if LV has fixed minor number assigned",
},
{
fieldName: "lv_historical",
metricName: "lv_historical",
desc: "Set if the LV is historical",
},
{
fieldName: "lv_image_synced",
metricName: "lv_image_synced",
desc: "Set if mirror/RAID image is synchronized",
},
{
fieldName: "lv_inactive_table",
metricName: "lv_inactive_table",
desc: "Set if LV has inactive table present",
},
{
fieldName: "lv_initial_image_sync",
metricName: "lv_initial_image_sync",
desc: "Set if mirror/RAID images underwent initial resynchronization",
},
{
fieldName: "lv_kernel_major",
metricName: "lv_kernel_major",
desc: "Currently assigned major number or -1 if LV is not active",
},
{
fieldName: "lv_kernel_minor",
metricName: "lv_kernel_minor",
desc: "Currently assigned minor number or -1 if LV is not active",
},
{
fieldName: "lv_live_table",
metricName: "lv_live_table",
desc: "Set if LV has live table present",
},
{
fieldName: "lv_major",
metricName: "lv_major",
desc: "Persistent major number or -1 if not persistent",
},
{
fieldName: "lv_merge_failed",
metricName: "lv_merge_failed",
desc: "Set if snapshot merge failed",
},
{
fieldName: "lv_merging",
metricName: "lv_merging",
desc: "Set if snapshot LV is being merged to origin",
},
{
fieldName: "lv_metadata_size",
metricName: "lv_metadata_size_bytes",
desc: "For thin and cache pools, the size of the LV that holds the metadata",
},
{
fieldName: "lv_minor",
metricName: "lv_minor",
desc: "Persistent minor number or -1 if not persistent",
},
{
fieldName: "lv_profile",
metricName: "lv_profile",
desc: "Configuration profile attached to this LV",
},
{
fieldName: "lv_read_ahead",
metricName: "lv_read_ahead_bytes",
desc: "Read ahead setting",
metricValue: func(raw string) (float64, error) {
if raw == "auto" {
return -1, nil
}
return fromNumeric(raw)
},
},
{
fieldName: "lv_size",
metricName: "lv_size_bytes",
desc: "Size of LV",
},
{
fieldName: "lv_skip_activation",
metricName: "lv_skip_activation",
desc: "Set if LV is skipped on activation",
},
{
fieldName: "lv_snapshot_invalid",
metricName: "lv_snapshot_invalid",
desc: "Set if snapshot LV is invalid",
},
{
fieldName: "lv_suspended",
metricName: "lv_suspended",
desc: "Set if LV is suspended",
},
{
fieldName: "lv_time",
metricName: "lv_time",
desc: "Creation time of the LV, if known",
},
{
fieldName: "lv_time_removed",
metricName: "lv_time_removed",
desc: "Removal time of the LV, if known",
},
{
fieldName: "metadata_percent",
metricName: "lv_metadata_percent",
desc: "For cache and thin pools, the percentage of metadata full if LV is active",
},
{
fieldName: "origin_size",
metricName: "lv_origin_size_bytes",
desc: "For snapshots, the size of the origin device of this LV",
},
{
fieldName: "raid_max_recovery_rate",
metricName: "lv_raid_max_recovery_rate",
desc: "For RAID1, the maximum recovery I/O load in kiB/sec/disk",
},
{
fieldName: "raid_min_recovery_rate",
metricName: "lv_raid_min_recovery_rate",
desc: "For RAID1, the minimum recovery I/O load in kiB/sec/disk",
},
{
fieldName: "raid_mismatch_count",
metricName: "lv_raid_mismatch_count",
desc: "For RAID, number of mismatches found or repaired",
},
{
fieldName: "raid_write_behind",
metricName: "lv_raid_write_behind",
desc: "For RAID1, the number of outstanding writes allowed to writemostly devices",
},
{
fieldName: "raidintegrityblocksize",
metricName: "lv_raidintegrityblocksize",
desc: "The integrity block size",
},
{
fieldName: "seg_count",
metricName: "lv_seg_count",
desc: "Number of segments in LV",
},
{
fieldName: "snap_percent",
metricName: "lv_snap_percent",
desc: "For snapshots, the percentage full if LV is active",
},
{
fieldName: "sync_percent",
metricName: "lv_sync_percent",
desc: "For Cache, RAID, mirrors and pvmove, current percentage in-sync",
},
{
fieldName: "vdo_saving_percent",
metricName: "lv_vdo_saving_percent",
desc: "For vdo pools, percentage of saved space",
},
{
fieldName: "vdo_used_size",
metricName: "lv_vdo_used_size_bytes",
desc: "For vdo pools, currently used space",
},
{
fieldName: "writecache_error",
metricName: "lv_writecache_error",
desc: "Total writecache errors",
},
{
fieldName: "writecache_free_blocks",
metricName: "lv_writecache_free_blocks",
desc: "Total writecache free blocks",
},
{
fieldName: "writecache_total_blocks",
metricName: "lv_writecache_total_blocks",
desc: "Total writecache blocks",
},
{
fieldName: "writecache_writeback_blocks",
metricName: "lv_writecache_writeback_blocks",
desc: "Total writecache writeback blocks",
},
},
}