Skip to content

Commit daffd86

Browse files
dsnt02518hansmi
authored andcommitted
Add test data for snapshots.
Ensure ancestors are parsed properly as info rather than metrics.
1 parent c021751 commit daffd86

File tree

3 files changed

+178
-0
lines changed

3 files changed

+178
-0
lines changed

collector_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ func TestCollector(t *testing.T) {
6767
{name: "multivg"},
6868
{name: "mirrored"},
6969
{name: "mirrored-unhealthy"},
70+
{name: "snapshot"},
7071
} {
7172
t.Run(tc.name, func(t *testing.T) {
7273
c := newCollector()

testdata/snapshot.golden

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# HELP lvm_lv_info
2+
# TYPE lvm_lv_info gauge
3+
lvm_lv_info{lv_active="",lv_allocation_policy="",lv_ancestors="",lv_attr="",lv_convert_lv="",lv_convert_lv_uuid="",lv_data_lv="",lv_data_lv_uuid="",lv_descendants="",lv_dm_path="",lv_full_ancestors="",lv_full_descendants="",lv_full_name="",lv_health_status="",lv_host="",lv_kernel_cache_policy="",lv_kernel_cache_settings="",lv_kernel_discards="",lv_kernel_metadata_format="",lv_kernel_read_ahead_bytes="",lv_layout="",lv_metadata_lv="",lv_metadata_lv_uuid="",lv_mirror_log="",lv_mirror_log_uuid="",lv_modules="",lv_move_pv="",lv_move_pv_uuid="",lv_name="lv_csmeta",lv_origin="",lv_origin_uuid="",lv_parent="",lv_path="",lv_permissions="",lv_pool_lv="",lv_pool_lv_uuid="",lv_raid_sync_action="",lv_raidintegritymode="",lv_role="",lv_tags="",lv_uuid="VBJ3Ct-yDJ3-JPGS-Zyew-tCO5-7AvK-INt3g6",lv_vdo_operating_mode="",lv_when_full=""} 1
4+
lvm_lv_info{lv_active="",lv_allocation_policy="",lv_ancestors="",lv_attr="",lv_convert_lv="",lv_convert_lv_uuid="",lv_data_lv="",lv_data_lv_uuid="",lv_descendants="",lv_dm_path="",lv_full_ancestors="",lv_full_descendants="",lv_full_name="",lv_health_status="",lv_host="",lv_kernel_cache_policy="",lv_kernel_cache_settings="",lv_kernel_discards="",lv_kernel_metadata_format="",lv_kernel_read_ahead_bytes="",lv_layout="",lv_metadata_lv="",lv_metadata_lv_uuid="",lv_mirror_log="",lv_mirror_log_uuid="",lv_modules="",lv_move_pv="",lv_move_pv_uuid="",lv_name="lv_docker",lv_origin="",lv_origin_uuid="",lv_parent="",lv_path="",lv_permissions="",lv_pool_lv="",lv_pool_lv_uuid="",lv_raid_sync_action="",lv_raidintegritymode="",lv_role="",lv_tags="",lv_uuid="FNkhIS-Vozm-bmE7-dmHD-vjOM-103g-irxDIb",lv_vdo_operating_mode="",lv_when_full=""} 1
5+
lvm_lv_info{lv_active="",lv_allocation_policy="",lv_ancestors="",lv_attr="",lv_convert_lv="",lv_convert_lv_uuid="",lv_data_lv="",lv_data_lv_uuid="",lv_descendants="",lv_dm_path="",lv_full_ancestors="",lv_full_descendants="",lv_full_name="",lv_health_status="",lv_host="",lv_kernel_cache_policy="",lv_kernel_cache_settings="",lv_kernel_discards="",lv_kernel_metadata_format="",lv_kernel_read_ahead_bytes="",lv_layout="",lv_metadata_lv="",lv_metadata_lv_uuid="",lv_mirror_log="",lv_mirror_log_uuid="",lv_modules="",lv_move_pv="",lv_move_pv_uuid="",lv_name="lv_libvirt_images",lv_origin="",lv_origin_uuid="",lv_parent="",lv_path="",lv_permissions="",lv_pool_lv="",lv_pool_lv_uuid="",lv_raid_sync_action="",lv_raidintegritymode="",lv_role="",lv_tags="",lv_uuid="PucjXb-iwvM-Px3b-tfO8-xy43-F8B4-2uEyc0",lv_vdo_operating_mode="",lv_when_full=""} 1
6+
lvm_lv_info{lv_active="",lv_allocation_policy="",lv_ancestors="",lv_attr="",lv_convert_lv="",lv_convert_lv_uuid="",lv_data_lv="",lv_data_lv_uuid="",lv_descendants="",lv_dm_path="",lv_full_ancestors="",lv_full_descendants="",lv_full_name="",lv_health_status="",lv_host="",lv_kernel_cache_policy="",lv_kernel_cache_settings="",lv_kernel_discards="",lv_kernel_metadata_format="",lv_kernel_read_ahead_bytes="",lv_layout="",lv_metadata_lv="",lv_metadata_lv_uuid="",lv_mirror_log="",lv_mirror_log_uuid="",lv_modules="",lv_move_pv="",lv_move_pv_uuid="",lv_name="lv_root",lv_origin="",lv_origin_uuid="",lv_parent="",lv_path="",lv_permissions="",lv_pool_lv="",lv_pool_lv_uuid="",lv_raid_sync_action="",lv_raidintegritymode="",lv_role="",lv_tags="",lv_uuid="Il5cUA-BDjk-T5ZB-vTdr-EsJd-6bFa-zjuhgB",lv_vdo_operating_mode="",lv_when_full=""} 1
7+
lvm_lv_info{lv_active="",lv_allocation_policy="",lv_ancestors="",lv_attr="",lv_convert_lv="",lv_convert_lv_uuid="",lv_data_lv="",lv_data_lv_uuid="",lv_descendants="lv_home_snapshot",lv_dm_path="",lv_full_ancestors="",lv_full_descendants="lv_home_snapshot",lv_full_name="",lv_health_status="",lv_host="",lv_kernel_cache_policy="",lv_kernel_cache_settings="",lv_kernel_discards="",lv_kernel_metadata_format="",lv_kernel_read_ahead_bytes="",lv_layout="",lv_metadata_lv="",lv_metadata_lv_uuid="",lv_mirror_log="",lv_mirror_log_uuid="",lv_modules="",lv_move_pv="",lv_move_pv_uuid="",lv_name="lv_home",lv_origin="",lv_origin_uuid="",lv_parent="",lv_path="",lv_permissions="",lv_pool_lv="",lv_pool_lv_uuid="",lv_raid_sync_action="",lv_raidintegritymode="",lv_role="",lv_tags="",lv_uuid="b3Wegf-3TOd-I5YS-ll0X-RZgI-QxAu-qv0fbc",lv_vdo_operating_mode="",lv_when_full=""} 1
8+
lvm_lv_info{lv_active="",lv_allocation_policy="",lv_ancestors="lv_home",lv_attr="",lv_convert_lv="",lv_convert_lv_uuid="",lv_data_lv="",lv_data_lv_uuid="",lv_descendants="",lv_dm_path="",lv_full_ancestors="lv_home",lv_full_descendants="",lv_full_name="",lv_health_status="",lv_host="",lv_kernel_cache_policy="",lv_kernel_cache_settings="",lv_kernel_discards="",lv_kernel_metadata_format="",lv_kernel_read_ahead_bytes="",lv_layout="",lv_metadata_lv="",lv_metadata_lv_uuid="",lv_mirror_log="",lv_mirror_log_uuid="",lv_modules="",lv_move_pv="",lv_move_pv_uuid="",lv_name="lv_home_snapshot",lv_origin="",lv_origin_uuid="",lv_parent="",lv_path="",lv_permissions="",lv_pool_lv="",lv_pool_lv_uuid="",lv_raid_sync_action="",lv_raidintegritymode="",lv_role="",lv_tags="",lv_uuid="zqJxaj-K6iF-f1NV-4G35-8Pg7-hhpn-p77SMP",lv_vdo_operating_mode="",lv_when_full=""} 1
9+
# HELP lvm_pv_info
10+
# TYPE lvm_pv_info gauge
11+
lvm_pv_info{pv_attr="",pv_fmt="",pv_name="",pv_tags="",pv_uuid=""} 1
12+
# HELP lvm_unknown_field_count Fields reported by LVM not recognized by exporter
13+
# TYPE lvm_unknown_field_count gauge
14+
lvm_unknown_field_count{details="",group="lv"} 0
15+
lvm_unknown_field_count{details="",group="pv"} 0
16+
lvm_unknown_field_count{details="",group="vg"} 0
17+
# HELP lvm_up Whether scrape was successful
18+
# TYPE lvm_up gauge
19+
lvm_up{status=""} 1
20+
# HELP lvm_vg_info
21+
# TYPE lvm_vg_info gauge
22+
lvm_vg_info{vg_allocation_policy="",vg_attr="",vg_fmt="",vg_lock_args="",vg_lock_type="",vg_name="",vg_permissions="",vg_systemid="",vg_tags="",vg_uuid=""} 1

testdata/snapshot.json

+155
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
{
2+
"report": [
3+
{
4+
"vg": [
5+
{}
6+
],
7+
"pv": [
8+
{}
9+
],
10+
"lv": [
11+
{
12+
"lv_uuid": "b3Wegf-3TOd-I5YS-ll0X-RZgI-QxAu-qv0fbc",
13+
"lv_name": "lv_home",
14+
"lv_ancestors": "",
15+
"lv_descendants": "lv_home_snapshot",
16+
"lv_full_ancestors": "",
17+
"lv_full_descendants": "lv_home_snapshot"
18+
},
19+
{
20+
"lv_uuid": "Il5cUA-BDjk-T5ZB-vTdr-EsJd-6bFa-zjuhgB",
21+
"lv_name": "lv_root",
22+
"lv_ancestors": "",
23+
"lv_descendants": "",
24+
"lv_full_ancestors": "",
25+
"lv_full_descendants": ""
26+
},
27+
{
28+
"lv_uuid": "FNkhIS-Vozm-bmE7-dmHD-vjOM-103g-irxDIb",
29+
"lv_name": "lv_docker",
30+
"lv_ancestors": "",
31+
"lv_descendants": "",
32+
"lv_full_ancestors": "",
33+
"lv_full_descendants": ""
34+
},
35+
{
36+
"lv_uuid": "PucjXb-iwvM-Px3b-tfO8-xy43-F8B4-2uEyc0",
37+
"lv_name": "lv_libvirt_images",
38+
"lv_ancestors": "",
39+
"lv_descendants": "",
40+
"lv_full_ancestors": "",
41+
"lv_full_descendants": ""
42+
},
43+
{
44+
"lv_uuid": "VBJ3Ct-yDJ3-JPGS-Zyew-tCO5-7AvK-INt3g6",
45+
"lv_name": "lv_csmeta",
46+
"lv_ancestors": "",
47+
"lv_descendants": "",
48+
"lv_full_ancestors": "",
49+
"lv_full_descendants": ""
50+
},
51+
{
52+
"lv_uuid": "zqJxaj-K6iF-f1NV-4G35-8Pg7-hhpn-p77SMP",
53+
"lv_name": "lv_home_snapshot",
54+
"lv_ancestors": "lv_home",
55+
"lv_descendants": "",
56+
"lv_full_ancestors": "lv_home",
57+
"lv_full_descendants": ""
58+
}
59+
],
60+
"pvseg": [
61+
{
62+
"pv_uuid": "DobPwo-HVJ3-hjKh-m4q7-y4e6-bmHi-2avBcN",
63+
"lv_uuid": "FNkhIS-Vozm-bmE7-dmHD-vjOM-103g-irxDIb"
64+
},
65+
{
66+
"pv_uuid": "DobPwo-HVJ3-hjKh-m4q7-y4e6-bmHi-2avBcN",
67+
"lv_uuid": "PucjXb-iwvM-Px3b-tfO8-xy43-F8B4-2uEyc0"
68+
},
69+
{
70+
"pv_uuid": "DobPwo-HVJ3-hjKh-m4q7-y4e6-bmHi-2avBcN",
71+
"lv_uuid": "b3Wegf-3TOd-I5YS-ll0X-RZgI-QxAu-qv0fbc"
72+
},
73+
{
74+
"pv_uuid": "DobPwo-HVJ3-hjKh-m4q7-y4e6-bmHi-2avBcN",
75+
"lv_uuid": "Il5cUA-BDjk-T5ZB-vTdr-EsJd-6bFa-zjuhgB"
76+
},
77+
{
78+
"pv_uuid": "DobPwo-HVJ3-hjKh-m4q7-y4e6-bmHi-2avBcN",
79+
"lv_uuid": "FNkhIS-Vozm-bmE7-dmHD-vjOM-103g-irxDIb"
80+
},
81+
{
82+
"pv_uuid": "DobPwo-HVJ3-hjKh-m4q7-y4e6-bmHi-2avBcN",
83+
"lv_uuid": "zqJxaj-K6iF-f1NV-4G35-8Pg7-hhpn-p77SMP"
84+
},
85+
{
86+
"pv_uuid": "DobPwo-HVJ3-hjKh-m4q7-y4e6-bmHi-2avBcN",
87+
"lv_uuid": ""
88+
},
89+
{
90+
"pv_uuid": "DobPwo-HVJ3-hjKh-m4q7-y4e6-bmHi-2avBcN",
91+
"lv_uuid": "PucjXb-iwvM-Px3b-tfO8-xy43-F8B4-2uEyc0"
92+
},
93+
{
94+
"pv_uuid": "DobPwo-HVJ3-hjKh-m4q7-y4e6-bmHi-2avBcN",
95+
"lv_uuid": "VBJ3Ct-yDJ3-JPGS-Zyew-tCO5-7AvK-INt3g6"
96+
},
97+
{
98+
"pv_uuid": "DobPwo-HVJ3-hjKh-m4q7-y4e6-bmHi-2avBcN",
99+
"lv_uuid": ""
100+
},
101+
{
102+
"pv_uuid": "DobPwo-HVJ3-hjKh-m4q7-y4e6-bmHi-2avBcN",
103+
"lv_uuid": "b3Wegf-3TOd-I5YS-ll0X-RZgI-QxAu-qv0fbc"
104+
},
105+
{
106+
"pv_uuid": "DobPwo-HVJ3-hjKh-m4q7-y4e6-bmHi-2avBcN",
107+
"lv_uuid": ""
108+
},
109+
{
110+
"pv_uuid": "DobPwo-HVJ3-hjKh-m4q7-y4e6-bmHi-2avBcN",
111+
"lv_uuid": "b3Wegf-3TOd-I5YS-ll0X-RZgI-QxAu-qv0fbc"
112+
},
113+
{
114+
"pv_uuid": "DobPwo-HVJ3-hjKh-m4q7-y4e6-bmHi-2avBcN",
115+
"lv_uuid": "PucjXb-iwvM-Px3b-tfO8-xy43-F8B4-2uEyc0"
116+
}
117+
],
118+
"seg": [
119+
{
120+
"lv_uuid": "b3Wegf-3TOd-I5YS-ll0X-RZgI-QxAu-qv0fbc"
121+
},
122+
{
123+
"lv_uuid": "b3Wegf-3TOd-I5YS-ll0X-RZgI-QxAu-qv0fbc"
124+
},
125+
{
126+
"lv_uuid": "b3Wegf-3TOd-I5YS-ll0X-RZgI-QxAu-qv0fbc"
127+
},
128+
{
129+
"lv_uuid": "Il5cUA-BDjk-T5ZB-vTdr-EsJd-6bFa-zjuhgB"
130+
},
131+
{
132+
"lv_uuid": "FNkhIS-Vozm-bmE7-dmHD-vjOM-103g-irxDIb"
133+
},
134+
{
135+
"lv_uuid": "FNkhIS-Vozm-bmE7-dmHD-vjOM-103g-irxDIb"
136+
},
137+
{
138+
"lv_uuid": "PucjXb-iwvM-Px3b-tfO8-xy43-F8B4-2uEyc0"
139+
},
140+
{
141+
"lv_uuid": "PucjXb-iwvM-Px3b-tfO8-xy43-F8B4-2uEyc0"
142+
},
143+
{
144+
"lv_uuid": "PucjXb-iwvM-Px3b-tfO8-xy43-F8B4-2uEyc0"
145+
},
146+
{
147+
"lv_uuid": "VBJ3Ct-yDJ3-JPGS-Zyew-tCO5-7AvK-INt3g6"
148+
},
149+
{
150+
"lv_uuid": "zqJxaj-K6iF-f1NV-4G35-8Pg7-hhpn-p77SMP"
151+
}
152+
]
153+
}
154+
]
155+
}

0 commit comments

Comments
 (0)