updates for zfsonlinux 0.7.5 (#779)

* updates for zfsonlinux 0.7.5

* add constants for KSTAT_DATA_* types

* added e2e test for negative values represented by uint64 that can result from ZFS bugs
This commit is contained in:
Richard Elling 2018-02-16 06:46:31 -08:00 committed by Ben Kochie
parent 6468e7c80b
commit d7348a5c78
9 changed files with 671 additions and 19 deletions

View file

@ -2888,6 +2888,69 @@ node_xfs_extent_allocation_extents_allocated_total{device="sda1"} 1
# HELP node_xfs_extent_allocation_extents_freed_total Number of extents freed for a filesystem. # HELP node_xfs_extent_allocation_extents_freed_total Number of extents freed for a filesystem.
# TYPE node_xfs_extent_allocation_extents_freed_total counter # TYPE node_xfs_extent_allocation_extents_freed_total counter
node_xfs_extent_allocation_extents_freed_total{device="sda1"} 0 node_xfs_extent_allocation_extents_freed_total{device="sda1"} 0
# HELP node_zfs_abd_linear_cnt kstat.zfs.misc.abdstats.linear_cnt
# TYPE node_zfs_abd_linear_cnt untyped
node_zfs_abd_linear_cnt 62
# HELP node_zfs_abd_linear_data_size kstat.zfs.misc.abdstats.linear_data_size
# TYPE node_zfs_abd_linear_data_size untyped
node_zfs_abd_linear_data_size 223232
# HELP node_zfs_abd_scatter_chunk_waste kstat.zfs.misc.abdstats.scatter_chunk_waste
# TYPE node_zfs_abd_scatter_chunk_waste untyped
node_zfs_abd_scatter_chunk_waste 0
# HELP node_zfs_abd_scatter_cnt kstat.zfs.misc.abdstats.scatter_cnt
# TYPE node_zfs_abd_scatter_cnt untyped
node_zfs_abd_scatter_cnt 1
# HELP node_zfs_abd_scatter_data_size kstat.zfs.misc.abdstats.scatter_data_size
# TYPE node_zfs_abd_scatter_data_size untyped
node_zfs_abd_scatter_data_size 16384
# HELP node_zfs_abd_scatter_order_0 kstat.zfs.misc.abdstats.scatter_order_0
# TYPE node_zfs_abd_scatter_order_0 untyped
node_zfs_abd_scatter_order_0 0
# HELP node_zfs_abd_scatter_order_1 kstat.zfs.misc.abdstats.scatter_order_1
# TYPE node_zfs_abd_scatter_order_1 untyped
node_zfs_abd_scatter_order_1 0
# HELP node_zfs_abd_scatter_order_10 kstat.zfs.misc.abdstats.scatter_order_10
# TYPE node_zfs_abd_scatter_order_10 untyped
node_zfs_abd_scatter_order_10 0
# HELP node_zfs_abd_scatter_order_2 kstat.zfs.misc.abdstats.scatter_order_2
# TYPE node_zfs_abd_scatter_order_2 untyped
node_zfs_abd_scatter_order_2 1
# HELP node_zfs_abd_scatter_order_3 kstat.zfs.misc.abdstats.scatter_order_3
# TYPE node_zfs_abd_scatter_order_3 untyped
node_zfs_abd_scatter_order_3 0
# HELP node_zfs_abd_scatter_order_4 kstat.zfs.misc.abdstats.scatter_order_4
# TYPE node_zfs_abd_scatter_order_4 untyped
node_zfs_abd_scatter_order_4 0
# HELP node_zfs_abd_scatter_order_5 kstat.zfs.misc.abdstats.scatter_order_5
# TYPE node_zfs_abd_scatter_order_5 untyped
node_zfs_abd_scatter_order_5 0
# HELP node_zfs_abd_scatter_order_6 kstat.zfs.misc.abdstats.scatter_order_6
# TYPE node_zfs_abd_scatter_order_6 untyped
node_zfs_abd_scatter_order_6 0
# HELP node_zfs_abd_scatter_order_7 kstat.zfs.misc.abdstats.scatter_order_7
# TYPE node_zfs_abd_scatter_order_7 untyped
node_zfs_abd_scatter_order_7 0
# HELP node_zfs_abd_scatter_order_8 kstat.zfs.misc.abdstats.scatter_order_8
# TYPE node_zfs_abd_scatter_order_8 untyped
node_zfs_abd_scatter_order_8 0
# HELP node_zfs_abd_scatter_order_9 kstat.zfs.misc.abdstats.scatter_order_9
# TYPE node_zfs_abd_scatter_order_9 untyped
node_zfs_abd_scatter_order_9 0
# HELP node_zfs_abd_scatter_page_alloc_retry kstat.zfs.misc.abdstats.scatter_page_alloc_retry
# TYPE node_zfs_abd_scatter_page_alloc_retry untyped
node_zfs_abd_scatter_page_alloc_retry 0
# HELP node_zfs_abd_scatter_page_multi_chunk kstat.zfs.misc.abdstats.scatter_page_multi_chunk
# TYPE node_zfs_abd_scatter_page_multi_chunk untyped
node_zfs_abd_scatter_page_multi_chunk 0
# HELP node_zfs_abd_scatter_page_multi_zone kstat.zfs.misc.abdstats.scatter_page_multi_zone
# TYPE node_zfs_abd_scatter_page_multi_zone untyped
node_zfs_abd_scatter_page_multi_zone 0
# HELP node_zfs_abd_scatter_sg_table_retry kstat.zfs.misc.abdstats.scatter_sg_table_retry
# TYPE node_zfs_abd_scatter_sg_table_retry untyped
node_zfs_abd_scatter_sg_table_retry 0
# HELP node_zfs_abd_struct_size kstat.zfs.misc.abdstats.struct_size
# TYPE node_zfs_abd_struct_size untyped
node_zfs_abd_struct_size 2520
# HELP node_zfs_arc_anon_evictable_data kstat.zfs.misc.arcstats.anon_evictable_data # HELP node_zfs_arc_anon_evictable_data kstat.zfs.misc.arcstats.anon_evictable_data
# TYPE node_zfs_arc_anon_evictable_data untyped # TYPE node_zfs_arc_anon_evictable_data untyped
node_zfs_arc_anon_evictable_data 0 node_zfs_arc_anon_evictable_data 0
@ -3161,6 +3224,195 @@ node_zfs_arc_prefetch_metadata_misses 16071
# HELP node_zfs_arc_size kstat.zfs.misc.arcstats.size # HELP node_zfs_arc_size kstat.zfs.misc.arcstats.size
# TYPE node_zfs_arc_size untyped # TYPE node_zfs_arc_size untyped
node_zfs_arc_size 1.603939792e+09 node_zfs_arc_size 1.603939792e+09
# HELP node_zfs_dbuf_dbuf_cache_count kstat.zfs.misc.dbuf_stats.dbuf_cache_count
# TYPE node_zfs_dbuf_dbuf_cache_count untyped
node_zfs_dbuf_dbuf_cache_count 27
# HELP node_zfs_dbuf_dbuf_cache_hiwater_bytes kstat.zfs.misc.dbuf_stats.dbuf_cache_hiwater_bytes
# TYPE node_zfs_dbuf_dbuf_cache_hiwater_bytes untyped
node_zfs_dbuf_dbuf_cache_hiwater_bytes 6.9117804e+07
# HELP node_zfs_dbuf_dbuf_cache_level_0 kstat.zfs.misc.dbuf_stats.dbuf_cache_level_0
# TYPE node_zfs_dbuf_dbuf_cache_level_0 untyped
node_zfs_dbuf_dbuf_cache_level_0 27
# HELP node_zfs_dbuf_dbuf_cache_level_0_bytes kstat.zfs.misc.dbuf_stats.dbuf_cache_level_0_bytes
# TYPE node_zfs_dbuf_dbuf_cache_level_0_bytes untyped
node_zfs_dbuf_dbuf_cache_level_0_bytes 302080
# HELP node_zfs_dbuf_dbuf_cache_level_1 kstat.zfs.misc.dbuf_stats.dbuf_cache_level_1
# TYPE node_zfs_dbuf_dbuf_cache_level_1 untyped
node_zfs_dbuf_dbuf_cache_level_1 0
# HELP node_zfs_dbuf_dbuf_cache_level_10 kstat.zfs.misc.dbuf_stats.dbuf_cache_level_10
# TYPE node_zfs_dbuf_dbuf_cache_level_10 untyped
node_zfs_dbuf_dbuf_cache_level_10 0
# HELP node_zfs_dbuf_dbuf_cache_level_10_bytes kstat.zfs.misc.dbuf_stats.dbuf_cache_level_10_bytes
# TYPE node_zfs_dbuf_dbuf_cache_level_10_bytes untyped
node_zfs_dbuf_dbuf_cache_level_10_bytes 0
# HELP node_zfs_dbuf_dbuf_cache_level_11 kstat.zfs.misc.dbuf_stats.dbuf_cache_level_11
# TYPE node_zfs_dbuf_dbuf_cache_level_11 untyped
node_zfs_dbuf_dbuf_cache_level_11 0
# HELP node_zfs_dbuf_dbuf_cache_level_11_bytes kstat.zfs.misc.dbuf_stats.dbuf_cache_level_11_bytes
# TYPE node_zfs_dbuf_dbuf_cache_level_11_bytes untyped
node_zfs_dbuf_dbuf_cache_level_11_bytes 0
# HELP node_zfs_dbuf_dbuf_cache_level_1_bytes kstat.zfs.misc.dbuf_stats.dbuf_cache_level_1_bytes
# TYPE node_zfs_dbuf_dbuf_cache_level_1_bytes untyped
node_zfs_dbuf_dbuf_cache_level_1_bytes 0
# HELP node_zfs_dbuf_dbuf_cache_level_2 kstat.zfs.misc.dbuf_stats.dbuf_cache_level_2
# TYPE node_zfs_dbuf_dbuf_cache_level_2 untyped
node_zfs_dbuf_dbuf_cache_level_2 0
# HELP node_zfs_dbuf_dbuf_cache_level_2_bytes kstat.zfs.misc.dbuf_stats.dbuf_cache_level_2_bytes
# TYPE node_zfs_dbuf_dbuf_cache_level_2_bytes untyped
node_zfs_dbuf_dbuf_cache_level_2_bytes 0
# HELP node_zfs_dbuf_dbuf_cache_level_3 kstat.zfs.misc.dbuf_stats.dbuf_cache_level_3
# TYPE node_zfs_dbuf_dbuf_cache_level_3 untyped
node_zfs_dbuf_dbuf_cache_level_3 0
# HELP node_zfs_dbuf_dbuf_cache_level_3_bytes kstat.zfs.misc.dbuf_stats.dbuf_cache_level_3_bytes
# TYPE node_zfs_dbuf_dbuf_cache_level_3_bytes untyped
node_zfs_dbuf_dbuf_cache_level_3_bytes 0
# HELP node_zfs_dbuf_dbuf_cache_level_4 kstat.zfs.misc.dbuf_stats.dbuf_cache_level_4
# TYPE node_zfs_dbuf_dbuf_cache_level_4 untyped
node_zfs_dbuf_dbuf_cache_level_4 0
# HELP node_zfs_dbuf_dbuf_cache_level_4_bytes kstat.zfs.misc.dbuf_stats.dbuf_cache_level_4_bytes
# TYPE node_zfs_dbuf_dbuf_cache_level_4_bytes untyped
node_zfs_dbuf_dbuf_cache_level_4_bytes 0
# HELP node_zfs_dbuf_dbuf_cache_level_5 kstat.zfs.misc.dbuf_stats.dbuf_cache_level_5
# TYPE node_zfs_dbuf_dbuf_cache_level_5 untyped
node_zfs_dbuf_dbuf_cache_level_5 0
# HELP node_zfs_dbuf_dbuf_cache_level_5_bytes kstat.zfs.misc.dbuf_stats.dbuf_cache_level_5_bytes
# TYPE node_zfs_dbuf_dbuf_cache_level_5_bytes untyped
node_zfs_dbuf_dbuf_cache_level_5_bytes 0
# HELP node_zfs_dbuf_dbuf_cache_level_6 kstat.zfs.misc.dbuf_stats.dbuf_cache_level_6
# TYPE node_zfs_dbuf_dbuf_cache_level_6 untyped
node_zfs_dbuf_dbuf_cache_level_6 0
# HELP node_zfs_dbuf_dbuf_cache_level_6_bytes kstat.zfs.misc.dbuf_stats.dbuf_cache_level_6_bytes
# TYPE node_zfs_dbuf_dbuf_cache_level_6_bytes untyped
node_zfs_dbuf_dbuf_cache_level_6_bytes 0
# HELP node_zfs_dbuf_dbuf_cache_level_7 kstat.zfs.misc.dbuf_stats.dbuf_cache_level_7
# TYPE node_zfs_dbuf_dbuf_cache_level_7 untyped
node_zfs_dbuf_dbuf_cache_level_7 0
# HELP node_zfs_dbuf_dbuf_cache_level_7_bytes kstat.zfs.misc.dbuf_stats.dbuf_cache_level_7_bytes
# TYPE node_zfs_dbuf_dbuf_cache_level_7_bytes untyped
node_zfs_dbuf_dbuf_cache_level_7_bytes 0
# HELP node_zfs_dbuf_dbuf_cache_level_8 kstat.zfs.misc.dbuf_stats.dbuf_cache_level_8
# TYPE node_zfs_dbuf_dbuf_cache_level_8 untyped
node_zfs_dbuf_dbuf_cache_level_8 0
# HELP node_zfs_dbuf_dbuf_cache_level_8_bytes kstat.zfs.misc.dbuf_stats.dbuf_cache_level_8_bytes
# TYPE node_zfs_dbuf_dbuf_cache_level_8_bytes untyped
node_zfs_dbuf_dbuf_cache_level_8_bytes 0
# HELP node_zfs_dbuf_dbuf_cache_level_9 kstat.zfs.misc.dbuf_stats.dbuf_cache_level_9
# TYPE node_zfs_dbuf_dbuf_cache_level_9 untyped
node_zfs_dbuf_dbuf_cache_level_9 0
# HELP node_zfs_dbuf_dbuf_cache_level_9_bytes kstat.zfs.misc.dbuf_stats.dbuf_cache_level_9_bytes
# TYPE node_zfs_dbuf_dbuf_cache_level_9_bytes untyped
node_zfs_dbuf_dbuf_cache_level_9_bytes 0
# HELP node_zfs_dbuf_dbuf_cache_lowater_bytes kstat.zfs.misc.dbuf_stats.dbuf_cache_lowater_bytes
# TYPE node_zfs_dbuf_dbuf_cache_lowater_bytes untyped
node_zfs_dbuf_dbuf_cache_lowater_bytes 5.6550932e+07
# HELP node_zfs_dbuf_dbuf_cache_max_bytes kstat.zfs.misc.dbuf_stats.dbuf_cache_max_bytes
# TYPE node_zfs_dbuf_dbuf_cache_max_bytes untyped
node_zfs_dbuf_dbuf_cache_max_bytes 6.2834368e+07
# HELP node_zfs_dbuf_dbuf_cache_size kstat.zfs.misc.dbuf_stats.dbuf_cache_size
# TYPE node_zfs_dbuf_dbuf_cache_size untyped
node_zfs_dbuf_dbuf_cache_size 302080
# HELP node_zfs_dbuf_dbuf_cache_size_max kstat.zfs.misc.dbuf_stats.dbuf_cache_size_max
# TYPE node_zfs_dbuf_dbuf_cache_size_max untyped
node_zfs_dbuf_dbuf_cache_size_max 394240
# HELP node_zfs_dbuf_dbuf_cache_total_evicts kstat.zfs.misc.dbuf_stats.dbuf_cache_total_evicts
# TYPE node_zfs_dbuf_dbuf_cache_total_evicts untyped
node_zfs_dbuf_dbuf_cache_total_evicts 0
# HELP node_zfs_dbuf_hash_chain_max kstat.zfs.misc.dbuf_stats.hash_chain_max
# TYPE node_zfs_dbuf_hash_chain_max untyped
node_zfs_dbuf_hash_chain_max 0
# HELP node_zfs_dbuf_hash_chains kstat.zfs.misc.dbuf_stats.hash_chains
# TYPE node_zfs_dbuf_hash_chains untyped
node_zfs_dbuf_hash_chains 0
# HELP node_zfs_dbuf_hash_collisions kstat.zfs.misc.dbuf_stats.hash_collisions
# TYPE node_zfs_dbuf_hash_collisions untyped
node_zfs_dbuf_hash_collisions 0
# HELP node_zfs_dbuf_hash_dbuf_level_0 kstat.zfs.misc.dbuf_stats.hash_dbuf_level_0
# TYPE node_zfs_dbuf_hash_dbuf_level_0 untyped
node_zfs_dbuf_hash_dbuf_level_0 37
# HELP node_zfs_dbuf_hash_dbuf_level_0_bytes kstat.zfs.misc.dbuf_stats.hash_dbuf_level_0_bytes
# TYPE node_zfs_dbuf_hash_dbuf_level_0_bytes untyped
node_zfs_dbuf_hash_dbuf_level_0_bytes 465920
# HELP node_zfs_dbuf_hash_dbuf_level_1 kstat.zfs.misc.dbuf_stats.hash_dbuf_level_1
# TYPE node_zfs_dbuf_hash_dbuf_level_1 untyped
node_zfs_dbuf_hash_dbuf_level_1 10
# HELP node_zfs_dbuf_hash_dbuf_level_10 kstat.zfs.misc.dbuf_stats.hash_dbuf_level_10
# TYPE node_zfs_dbuf_hash_dbuf_level_10 untyped
node_zfs_dbuf_hash_dbuf_level_10 0
# HELP node_zfs_dbuf_hash_dbuf_level_10_bytes kstat.zfs.misc.dbuf_stats.hash_dbuf_level_10_bytes
# TYPE node_zfs_dbuf_hash_dbuf_level_10_bytes untyped
node_zfs_dbuf_hash_dbuf_level_10_bytes 0
# HELP node_zfs_dbuf_hash_dbuf_level_11 kstat.zfs.misc.dbuf_stats.hash_dbuf_level_11
# TYPE node_zfs_dbuf_hash_dbuf_level_11 untyped
node_zfs_dbuf_hash_dbuf_level_11 0
# HELP node_zfs_dbuf_hash_dbuf_level_11_bytes kstat.zfs.misc.dbuf_stats.hash_dbuf_level_11_bytes
# TYPE node_zfs_dbuf_hash_dbuf_level_11_bytes untyped
node_zfs_dbuf_hash_dbuf_level_11_bytes 0
# HELP node_zfs_dbuf_hash_dbuf_level_1_bytes kstat.zfs.misc.dbuf_stats.hash_dbuf_level_1_bytes
# TYPE node_zfs_dbuf_hash_dbuf_level_1_bytes untyped
node_zfs_dbuf_hash_dbuf_level_1_bytes 1.31072e+06
# HELP node_zfs_dbuf_hash_dbuf_level_2 kstat.zfs.misc.dbuf_stats.hash_dbuf_level_2
# TYPE node_zfs_dbuf_hash_dbuf_level_2 untyped
node_zfs_dbuf_hash_dbuf_level_2 2
# HELP node_zfs_dbuf_hash_dbuf_level_2_bytes kstat.zfs.misc.dbuf_stats.hash_dbuf_level_2_bytes
# TYPE node_zfs_dbuf_hash_dbuf_level_2_bytes untyped
node_zfs_dbuf_hash_dbuf_level_2_bytes 262144
# HELP node_zfs_dbuf_hash_dbuf_level_3 kstat.zfs.misc.dbuf_stats.hash_dbuf_level_3
# TYPE node_zfs_dbuf_hash_dbuf_level_3 untyped
node_zfs_dbuf_hash_dbuf_level_3 2
# HELP node_zfs_dbuf_hash_dbuf_level_3_bytes kstat.zfs.misc.dbuf_stats.hash_dbuf_level_3_bytes
# TYPE node_zfs_dbuf_hash_dbuf_level_3_bytes untyped
node_zfs_dbuf_hash_dbuf_level_3_bytes 262144
# HELP node_zfs_dbuf_hash_dbuf_level_4 kstat.zfs.misc.dbuf_stats.hash_dbuf_level_4
# TYPE node_zfs_dbuf_hash_dbuf_level_4 untyped
node_zfs_dbuf_hash_dbuf_level_4 2
# HELP node_zfs_dbuf_hash_dbuf_level_4_bytes kstat.zfs.misc.dbuf_stats.hash_dbuf_level_4_bytes
# TYPE node_zfs_dbuf_hash_dbuf_level_4_bytes untyped
node_zfs_dbuf_hash_dbuf_level_4_bytes 262144
# HELP node_zfs_dbuf_hash_dbuf_level_5 kstat.zfs.misc.dbuf_stats.hash_dbuf_level_5
# TYPE node_zfs_dbuf_hash_dbuf_level_5 untyped
node_zfs_dbuf_hash_dbuf_level_5 2
# HELP node_zfs_dbuf_hash_dbuf_level_5_bytes kstat.zfs.misc.dbuf_stats.hash_dbuf_level_5_bytes
# TYPE node_zfs_dbuf_hash_dbuf_level_5_bytes untyped
node_zfs_dbuf_hash_dbuf_level_5_bytes 262144
# HELP node_zfs_dbuf_hash_dbuf_level_6 kstat.zfs.misc.dbuf_stats.hash_dbuf_level_6
# TYPE node_zfs_dbuf_hash_dbuf_level_6 untyped
node_zfs_dbuf_hash_dbuf_level_6 0
# HELP node_zfs_dbuf_hash_dbuf_level_6_bytes kstat.zfs.misc.dbuf_stats.hash_dbuf_level_6_bytes
# TYPE node_zfs_dbuf_hash_dbuf_level_6_bytes untyped
node_zfs_dbuf_hash_dbuf_level_6_bytes 0
# HELP node_zfs_dbuf_hash_dbuf_level_7 kstat.zfs.misc.dbuf_stats.hash_dbuf_level_7
# TYPE node_zfs_dbuf_hash_dbuf_level_7 untyped
node_zfs_dbuf_hash_dbuf_level_7 0
# HELP node_zfs_dbuf_hash_dbuf_level_7_bytes kstat.zfs.misc.dbuf_stats.hash_dbuf_level_7_bytes
# TYPE node_zfs_dbuf_hash_dbuf_level_7_bytes untyped
node_zfs_dbuf_hash_dbuf_level_7_bytes 0
# HELP node_zfs_dbuf_hash_dbuf_level_8 kstat.zfs.misc.dbuf_stats.hash_dbuf_level_8
# TYPE node_zfs_dbuf_hash_dbuf_level_8 untyped
node_zfs_dbuf_hash_dbuf_level_8 0
# HELP node_zfs_dbuf_hash_dbuf_level_8_bytes kstat.zfs.misc.dbuf_stats.hash_dbuf_level_8_bytes
# TYPE node_zfs_dbuf_hash_dbuf_level_8_bytes untyped
node_zfs_dbuf_hash_dbuf_level_8_bytes 0
# HELP node_zfs_dbuf_hash_dbuf_level_9 kstat.zfs.misc.dbuf_stats.hash_dbuf_level_9
# TYPE node_zfs_dbuf_hash_dbuf_level_9 untyped
node_zfs_dbuf_hash_dbuf_level_9 0
# HELP node_zfs_dbuf_hash_dbuf_level_9_bytes kstat.zfs.misc.dbuf_stats.hash_dbuf_level_9_bytes
# TYPE node_zfs_dbuf_hash_dbuf_level_9_bytes untyped
node_zfs_dbuf_hash_dbuf_level_9_bytes 0
# HELP node_zfs_dbuf_hash_elements kstat.zfs.misc.dbuf_stats.hash_elements
# TYPE node_zfs_dbuf_hash_elements untyped
node_zfs_dbuf_hash_elements 55
# HELP node_zfs_dbuf_hash_elements_max kstat.zfs.misc.dbuf_stats.hash_elements_max
# TYPE node_zfs_dbuf_hash_elements_max untyped
node_zfs_dbuf_hash_elements_max 55
# HELP node_zfs_dbuf_hash_hits kstat.zfs.misc.dbuf_stats.hash_hits
# TYPE node_zfs_dbuf_hash_hits untyped
node_zfs_dbuf_hash_hits 108807
# HELP node_zfs_dbuf_hash_insert_race kstat.zfs.misc.dbuf_stats.hash_insert_race
# TYPE node_zfs_dbuf_hash_insert_race untyped
node_zfs_dbuf_hash_insert_race 0
# HELP node_zfs_dbuf_hash_misses kstat.zfs.misc.dbuf_stats.hash_misses
# TYPE node_zfs_dbuf_hash_misses untyped
node_zfs_dbuf_hash_misses 1851
# HELP node_zfs_dmu_tx_dmu_tx_assigned kstat.zfs.misc.dmu_tx.dmu_tx_assigned # HELP node_zfs_dmu_tx_dmu_tx_assigned kstat.zfs.misc.dmu_tx.dmu_tx_assigned
# TYPE node_zfs_dmu_tx_dmu_tx_assigned untyped # TYPE node_zfs_dmu_tx_dmu_tx_assigned untyped
node_zfs_dmu_tx_dmu_tx_assigned 3.532844e+06 node_zfs_dmu_tx_dmu_tx_assigned 3.532844e+06
@ -3194,6 +3446,90 @@ node_zfs_dmu_tx_dmu_tx_quota 0
# HELP node_zfs_dmu_tx_dmu_tx_suspended kstat.zfs.misc.dmu_tx.dmu_tx_suspended # HELP node_zfs_dmu_tx_dmu_tx_suspended kstat.zfs.misc.dmu_tx.dmu_tx_suspended
# TYPE node_zfs_dmu_tx_dmu_tx_suspended untyped # TYPE node_zfs_dmu_tx_dmu_tx_suspended untyped
node_zfs_dmu_tx_dmu_tx_suspended 0 node_zfs_dmu_tx_dmu_tx_suspended 0
# HELP node_zfs_dnode_dnode_alloc_next_block kstat.zfs.misc.dnodestats.dnode_alloc_next_block
# TYPE node_zfs_dnode_dnode_alloc_next_block untyped
node_zfs_dnode_dnode_alloc_next_block 0
# HELP node_zfs_dnode_dnode_alloc_next_chunk kstat.zfs.misc.dnodestats.dnode_alloc_next_chunk
# TYPE node_zfs_dnode_dnode_alloc_next_chunk untyped
node_zfs_dnode_dnode_alloc_next_chunk 0
# HELP node_zfs_dnode_dnode_alloc_race kstat.zfs.misc.dnodestats.dnode_alloc_race
# TYPE node_zfs_dnode_dnode_alloc_race untyped
node_zfs_dnode_dnode_alloc_race 0
# HELP node_zfs_dnode_dnode_allocate kstat.zfs.misc.dnodestats.dnode_allocate
# TYPE node_zfs_dnode_dnode_allocate untyped
node_zfs_dnode_dnode_allocate 0
# HELP node_zfs_dnode_dnode_buf_evict kstat.zfs.misc.dnodestats.dnode_buf_evict
# TYPE node_zfs_dnode_dnode_buf_evict untyped
node_zfs_dnode_dnode_buf_evict 17
# HELP node_zfs_dnode_dnode_hold_alloc_hits kstat.zfs.misc.dnodestats.dnode_hold_alloc_hits
# TYPE node_zfs_dnode_dnode_hold_alloc_hits untyped
node_zfs_dnode_dnode_hold_alloc_hits 37617
# HELP node_zfs_dnode_dnode_hold_alloc_interior kstat.zfs.misc.dnodestats.dnode_hold_alloc_interior
# TYPE node_zfs_dnode_dnode_hold_alloc_interior untyped
node_zfs_dnode_dnode_hold_alloc_interior 0
# HELP node_zfs_dnode_dnode_hold_alloc_lock_misses kstat.zfs.misc.dnodestats.dnode_hold_alloc_lock_misses
# TYPE node_zfs_dnode_dnode_hold_alloc_lock_misses untyped
node_zfs_dnode_dnode_hold_alloc_lock_misses 0
# HELP node_zfs_dnode_dnode_hold_alloc_lock_retry kstat.zfs.misc.dnodestats.dnode_hold_alloc_lock_retry
# TYPE node_zfs_dnode_dnode_hold_alloc_lock_retry untyped
node_zfs_dnode_dnode_hold_alloc_lock_retry 0
# HELP node_zfs_dnode_dnode_hold_alloc_misses kstat.zfs.misc.dnodestats.dnode_hold_alloc_misses
# TYPE node_zfs_dnode_dnode_hold_alloc_misses untyped
node_zfs_dnode_dnode_hold_alloc_misses 0
# HELP node_zfs_dnode_dnode_hold_alloc_type_none kstat.zfs.misc.dnodestats.dnode_hold_alloc_type_none
# TYPE node_zfs_dnode_dnode_hold_alloc_type_none untyped
node_zfs_dnode_dnode_hold_alloc_type_none 0
# HELP node_zfs_dnode_dnode_hold_dbuf_hold kstat.zfs.misc.dnodestats.dnode_hold_dbuf_hold
# TYPE node_zfs_dnode_dnode_hold_dbuf_hold untyped
node_zfs_dnode_dnode_hold_dbuf_hold 0
# HELP node_zfs_dnode_dnode_hold_dbuf_read kstat.zfs.misc.dnodestats.dnode_hold_dbuf_read
# TYPE node_zfs_dnode_dnode_hold_dbuf_read untyped
node_zfs_dnode_dnode_hold_dbuf_read 0
# HELP node_zfs_dnode_dnode_hold_free_hits kstat.zfs.misc.dnodestats.dnode_hold_free_hits
# TYPE node_zfs_dnode_dnode_hold_free_hits untyped
node_zfs_dnode_dnode_hold_free_hits 0
# HELP node_zfs_dnode_dnode_hold_free_lock_misses kstat.zfs.misc.dnodestats.dnode_hold_free_lock_misses
# TYPE node_zfs_dnode_dnode_hold_free_lock_misses untyped
node_zfs_dnode_dnode_hold_free_lock_misses 0
# HELP node_zfs_dnode_dnode_hold_free_lock_retry kstat.zfs.misc.dnodestats.dnode_hold_free_lock_retry
# TYPE node_zfs_dnode_dnode_hold_free_lock_retry untyped
node_zfs_dnode_dnode_hold_free_lock_retry 0
# HELP node_zfs_dnode_dnode_hold_free_misses kstat.zfs.misc.dnodestats.dnode_hold_free_misses
# TYPE node_zfs_dnode_dnode_hold_free_misses untyped
node_zfs_dnode_dnode_hold_free_misses 0
# HELP node_zfs_dnode_dnode_hold_free_overflow kstat.zfs.misc.dnodestats.dnode_hold_free_overflow
# TYPE node_zfs_dnode_dnode_hold_free_overflow untyped
node_zfs_dnode_dnode_hold_free_overflow 0
# HELP node_zfs_dnode_dnode_hold_free_refcount kstat.zfs.misc.dnodestats.dnode_hold_free_refcount
# TYPE node_zfs_dnode_dnode_hold_free_refcount untyped
node_zfs_dnode_dnode_hold_free_refcount 0
# HELP node_zfs_dnode_dnode_hold_free_txg kstat.zfs.misc.dnodestats.dnode_hold_free_txg
# TYPE node_zfs_dnode_dnode_hold_free_txg untyped
node_zfs_dnode_dnode_hold_free_txg 0
# HELP node_zfs_dnode_dnode_move_active kstat.zfs.misc.dnodestats.dnode_move_active
# TYPE node_zfs_dnode_dnode_move_active untyped
node_zfs_dnode_dnode_move_active 0
# HELP node_zfs_dnode_dnode_move_handle kstat.zfs.misc.dnodestats.dnode_move_handle
# TYPE node_zfs_dnode_dnode_move_handle untyped
node_zfs_dnode_dnode_move_handle 0
# HELP node_zfs_dnode_dnode_move_invalid kstat.zfs.misc.dnodestats.dnode_move_invalid
# TYPE node_zfs_dnode_dnode_move_invalid untyped
node_zfs_dnode_dnode_move_invalid 0
# HELP node_zfs_dnode_dnode_move_recheck1 kstat.zfs.misc.dnodestats.dnode_move_recheck1
# TYPE node_zfs_dnode_dnode_move_recheck1 untyped
node_zfs_dnode_dnode_move_recheck1 0
# HELP node_zfs_dnode_dnode_move_recheck2 kstat.zfs.misc.dnodestats.dnode_move_recheck2
# TYPE node_zfs_dnode_dnode_move_recheck2 untyped
node_zfs_dnode_dnode_move_recheck2 0
# HELP node_zfs_dnode_dnode_move_rwlock kstat.zfs.misc.dnodestats.dnode_move_rwlock
# TYPE node_zfs_dnode_dnode_move_rwlock untyped
node_zfs_dnode_dnode_move_rwlock 0
# HELP node_zfs_dnode_dnode_move_special kstat.zfs.misc.dnodestats.dnode_move_special
# TYPE node_zfs_dnode_dnode_move_special untyped
node_zfs_dnode_dnode_move_special 0
# HELP node_zfs_dnode_dnode_reallocate kstat.zfs.misc.dnodestats.dnode_reallocate
# TYPE node_zfs_dnode_dnode_reallocate untyped
node_zfs_dnode_dnode_reallocate 0
# HELP node_zfs_fm_erpt_dropped kstat.zfs.misc.fm.erpt-dropped # HELP node_zfs_fm_erpt_dropped kstat.zfs.misc.fm.erpt-dropped
# TYPE node_zfs_fm_erpt_dropped untyped # TYPE node_zfs_fm_erpt_dropped untyped
node_zfs_fm_erpt_dropped 18 node_zfs_fm_erpt_dropped 18
@ -3215,6 +3551,27 @@ node_zfs_vdev_cache_hits 0
# HELP node_zfs_vdev_cache_misses kstat.zfs.misc.vdev_cache_stats.misses # HELP node_zfs_vdev_cache_misses kstat.zfs.misc.vdev_cache_stats.misses
# TYPE node_zfs_vdev_cache_misses untyped # TYPE node_zfs_vdev_cache_misses untyped
node_zfs_vdev_cache_misses 0 node_zfs_vdev_cache_misses 0
# HELP node_zfs_vdev_mirror_non_rotating_linear kstat.zfs.misc.vdev_mirror_stats.non_rotating_linear
# TYPE node_zfs_vdev_mirror_non_rotating_linear untyped
node_zfs_vdev_mirror_non_rotating_linear 0
# HELP node_zfs_vdev_mirror_non_rotating_seek kstat.zfs.misc.vdev_mirror_stats.non_rotating_seek
# TYPE node_zfs_vdev_mirror_non_rotating_seek untyped
node_zfs_vdev_mirror_non_rotating_seek 0
# HELP node_zfs_vdev_mirror_preferred_found kstat.zfs.misc.vdev_mirror_stats.preferred_found
# TYPE node_zfs_vdev_mirror_preferred_found untyped
node_zfs_vdev_mirror_preferred_found 0
# HELP node_zfs_vdev_mirror_preferred_not_found kstat.zfs.misc.vdev_mirror_stats.preferred_not_found
# TYPE node_zfs_vdev_mirror_preferred_not_found untyped
node_zfs_vdev_mirror_preferred_not_found 94
# HELP node_zfs_vdev_mirror_rotating_linear kstat.zfs.misc.vdev_mirror_stats.rotating_linear
# TYPE node_zfs_vdev_mirror_rotating_linear untyped
node_zfs_vdev_mirror_rotating_linear 0
# HELP node_zfs_vdev_mirror_rotating_offset kstat.zfs.misc.vdev_mirror_stats.rotating_offset
# TYPE node_zfs_vdev_mirror_rotating_offset untyped
node_zfs_vdev_mirror_rotating_offset 0
# HELP node_zfs_vdev_mirror_rotating_seek kstat.zfs.misc.vdev_mirror_stats.rotating_seek
# TYPE node_zfs_vdev_mirror_rotating_seek untyped
node_zfs_vdev_mirror_rotating_seek 0
# HELP node_zfs_xuio_onloan_read_buf kstat.zfs.misc.xuio_stats.onloan_read_buf # HELP node_zfs_xuio_onloan_read_buf kstat.zfs.misc.xuio_stats.onloan_read_buf
# TYPE node_zfs_xuio_onloan_read_buf untyped # TYPE node_zfs_xuio_onloan_read_buf untyped
node_zfs_xuio_onloan_read_buf 32 node_zfs_xuio_onloan_read_buf 32
@ -3301,7 +3658,7 @@ node_zfs_zil_zil_itx_metaslab_slog_bytes 0
node_zfs_zil_zil_itx_metaslab_slog_count 0 node_zfs_zil_zil_itx_metaslab_slog_count 0
# HELP node_zfs_zil_zil_itx_needcopy_bytes kstat.zfs.misc.zil.zil_itx_needcopy_bytes # HELP node_zfs_zil_zil_itx_needcopy_bytes kstat.zfs.misc.zil.zil_itx_needcopy_bytes
# TYPE node_zfs_zil_zil_itx_needcopy_bytes untyped # TYPE node_zfs_zil_zil_itx_needcopy_bytes untyped
node_zfs_zil_zil_itx_needcopy_bytes 0 node_zfs_zil_zil_itx_needcopy_bytes 1.8446744073709537e+19
# HELP node_zfs_zil_zil_itx_needcopy_count kstat.zfs.misc.zil.zil_itx_needcopy_count # HELP node_zfs_zil_zil_itx_needcopy_count kstat.zfs.misc.zil.zil_itx_needcopy_count
# TYPE node_zfs_zil_zil_itx_needcopy_count untyped # TYPE node_zfs_zil_zil_itx_needcopy_count untyped
node_zfs_zil_zil_itx_needcopy_count 0 node_zfs_zil_zil_itx_needcopy_count 0

View file

@ -0,0 +1,23 @@
7 1 0x01 21 5712 73163810083184 309946154984654
name type data
struct_size 4 2520
linear_cnt 4 62
linear_data_size 4 223232
scatter_cnt 4 1
scatter_data_size 4 16384
scatter_chunk_waste 4 0
scatter_order_0 4 0
scatter_order_1 4 0
scatter_order_2 4 1
scatter_order_3 4 0
scatter_order_4 4 0
scatter_order_5 4 0
scatter_order_6 4 0
scatter_order_7 4 0
scatter_order_8 4 0
scatter_order_9 4 0
scatter_order_10 4 0
scatter_page_multi_chunk 4 0
scatter_page_multi_zone 4 0
scatter_page_alloc_retry 4 0
scatter_sg_table_retry 4 0

View file

@ -0,0 +1,65 @@
15 1 0x01 63 17136 73163812943503 309964267073187
name type data
dbuf_cache_count 4 27
dbuf_cache_size 4 302080
dbuf_cache_size_max 4 394240
dbuf_cache_max_bytes 4 62834368
dbuf_cache_lowater_bytes 4 56550932
dbuf_cache_hiwater_bytes 4 69117804
dbuf_cache_total_evicts 4 0
dbuf_cache_level_0 4 27
dbuf_cache_level_1 4 0
dbuf_cache_level_2 4 0
dbuf_cache_level_3 4 0
dbuf_cache_level_4 4 0
dbuf_cache_level_5 4 0
dbuf_cache_level_6 4 0
dbuf_cache_level_7 4 0
dbuf_cache_level_8 4 0
dbuf_cache_level_9 4 0
dbuf_cache_level_10 4 0
dbuf_cache_level_11 4 0
dbuf_cache_level_0_bytes 4 302080
dbuf_cache_level_1_bytes 4 0
dbuf_cache_level_2_bytes 4 0
dbuf_cache_level_3_bytes 4 0
dbuf_cache_level_4_bytes 4 0
dbuf_cache_level_5_bytes 4 0
dbuf_cache_level_6_bytes 4 0
dbuf_cache_level_7_bytes 4 0
dbuf_cache_level_8_bytes 4 0
dbuf_cache_level_9_bytes 4 0
dbuf_cache_level_10_bytes 4 0
dbuf_cache_level_11_bytes 4 0
hash_hits 4 108807
hash_misses 4 1851
hash_collisions 4 0
hash_elements 4 55
hash_elements_max 4 55
hash_chains 4 0
hash_chain_max 4 0
hash_insert_race 4 0
hash_dbuf_level_0 4 37
hash_dbuf_level_1 4 10
hash_dbuf_level_2 4 2
hash_dbuf_level_3 4 2
hash_dbuf_level_4 4 2
hash_dbuf_level_5 4 2
hash_dbuf_level_6 4 0
hash_dbuf_level_7 4 0
hash_dbuf_level_8 4 0
hash_dbuf_level_9 4 0
hash_dbuf_level_10 4 0
hash_dbuf_level_11 4 0
hash_dbuf_level_0_bytes 4 465920
hash_dbuf_level_1_bytes 4 1310720
hash_dbuf_level_2_bytes 4 262144
hash_dbuf_level_3_bytes 4 262144
hash_dbuf_level_4_bytes 4 262144
hash_dbuf_level_5_bytes 4 262144
hash_dbuf_level_6_bytes 4 0
hash_dbuf_level_7_bytes 4 0
hash_dbuf_level_8_bytes 4 0
hash_dbuf_level_9_bytes 4 0
hash_dbuf_level_10_bytes 4 0
hash_dbuf_level_11_bytes 4 0

View file

@ -0,0 +1,30 @@
10 1 0x01 28 7616 73163810135894 309969103316276
name type data
dnode_hold_dbuf_hold 4 0
dnode_hold_dbuf_read 4 0
dnode_hold_alloc_hits 4 37617
dnode_hold_alloc_misses 4 0
dnode_hold_alloc_interior 4 0
dnode_hold_alloc_lock_retry 4 0
dnode_hold_alloc_lock_misses 4 0
dnode_hold_alloc_type_none 4 0
dnode_hold_free_hits 4 0
dnode_hold_free_misses 4 0
dnode_hold_free_lock_misses 4 0
dnode_hold_free_lock_retry 4 0
dnode_hold_free_overflow 4 0
dnode_hold_free_refcount 4 0
dnode_hold_free_txg 4 0
dnode_allocate 4 0
dnode_reallocate 4 0
dnode_buf_evict 4 17
dnode_alloc_next_chunk 4 0
dnode_alloc_race 4 0
dnode_alloc_next_block 4 0
dnode_move_invalid 4 0
dnode_move_recheck1 4 0
dnode_move_recheck2 4 0
dnode_move_special 4 0
dnode_move_handle 4 0
dnode_move_rwlock 4 0
dnode_move_active 4 0

View file

@ -0,0 +1,9 @@
18 1 0x01 7 1904 73163813004224 309980651991187
name type data
rotating_linear 4 0
rotating_offset 4 0
rotating_seek 4 0
non_rotating_linear 4 0
non_rotating_seek 4 0
preferred_found 4 0
preferred_not_found 4 94

View file

@ -8,7 +8,7 @@ zil_itx_indirect_bytes 4 0
zil_itx_copied_count 4 0 zil_itx_copied_count 4 0
zil_itx_copied_bytes 4 0 zil_itx_copied_bytes 4 0
zil_itx_needcopy_count 4 0 zil_itx_needcopy_count 4 0
zil_itx_needcopy_bytes 4 0 zil_itx_needcopy_bytes 4 18446744073709537686
zil_itx_metaslab_normal_count 4 0 zil_itx_metaslab_normal_count 4 0
zil_itx_metaslab_normal_bytes 4 0 zil_itx_metaslab_normal_bytes 4 0
zil_itx_metaslab_slog_count 4 0 zil_itx_metaslab_slog_count 4 0

View file

@ -44,13 +44,17 @@ func NewZFSCollector() (Collector, error) {
linuxProcpathBase: "spl/kstat/zfs", linuxProcpathBase: "spl/kstat/zfs",
linuxZpoolIoPath: "/*/io", linuxZpoolIoPath: "/*/io",
linuxPathMap: map[string]string{ linuxPathMap: map[string]string{
"zfs_arc": "arcstats", "zfs_abd": "abdstats",
"zfs_dmu_tx": "dmu_tx", "zfs_arc": "arcstats",
"zfs_fm": "fm", "zfs_dbuf": "dbuf_stats",
"zfs_zfetch": "zfetchstats", "zfs_dmu_tx": "dmu_tx",
"zfs_vdev_cache": "vdev_cache_stats", "zfs_dnode": "dnodestats",
"zfs_xuio": "xuio_stats", "zfs_fm": "fm",
"zfs_zil": "zil", "zfs_vdev_cache": "vdev_cache_stats", // vdev_cache is deprecated
"zfs_vdev_mirror": "vdev_mirror_stats",
"zfs_xuio": "xuio_stats", // no known consumers of the XUIO interface on Linux exist
"zfs_zfetch": "zfetchstats",
"zfs_zil": "zil",
}, },
}, nil }, nil
} }
@ -60,7 +64,8 @@ func (c *zfsCollector) Update(ch chan<- prometheus.Metric) error {
if err := c.updateZfsStats(subsystem, ch); err != nil { if err := c.updateZfsStats(subsystem, ch); err != nil {
if err == errZFSNotAvailable { if err == errZFSNotAvailable {
log.Debug(err) log.Debug(err)
return nil // ZFS /proc files are added as new features to ZFS arrive, it is ok to continue
continue
} }
return err return err
} }

View file

@ -26,10 +26,26 @@ import (
"github.com/prometheus/common/log" "github.com/prometheus/common/log"
) )
// constants from https://github.com/zfsonlinux/zfs/blob/master/lib/libspl/include/sys/kstat.h
// kept as strings for comparison thus avoiding conversion to int
const (
KSTAT_DATA_CHAR = "0"
KSTAT_DATA_INT32 = "1"
KSTAT_DATA_UINT32 = "2"
KSTAT_DATA_INT64 = "3"
KSTAT_DATA_UINT64 = "4"
KSTAT_DATA_LONG = "5"
KSTAT_DATA_ULONG = "6"
KSTAT_DATA_STRING = "7"
)
func (c *zfsCollector) openProcFile(path string) (*os.File, error) { func (c *zfsCollector) openProcFile(path string) (*os.File, error) {
file, err := os.Open(procFilePath(path)) file, err := os.Open(procFilePath(path))
if err != nil { if err != nil {
log.Debugf("Cannot open %q for reading. Is the kernel module loaded?", procFilePath(path)) // file not found error can occur if:
// 1. zfs module is not loaded
// 2. zfs version does not have the feature with metrics -- ok to ignore
log.Debugf("Cannot open %q for reading", procFilePath(path))
return nil, errZFSNotAvailable return nil, errZFSNotAvailable
} }
return file, nil return file, nil
@ -60,7 +76,8 @@ func (c *zfsCollector) updatePoolStats(ch chan<- prometheus.Metric) error {
for _, zpoolPath := range zpoolPaths { for _, zpoolPath := range zpoolPaths {
file, err := os.Open(zpoolPath) file, err := os.Open(zpoolPath)
if err != nil { if err != nil {
log.Debugf("Cannot open %q for reading. Is the kernel module loaded?", zpoolPath) // this file should exist, but there is a race where an exporting pool can remove the files -- ok to ignore
log.Debugf("Cannot open %q for reading", zpoolPath)
return errZFSNotAvailable return errZFSNotAvailable
} }
@ -93,14 +110,16 @@ func (c *zfsCollector) parseProcfsFile(reader io.Reader, fmtExt string, handler
continue continue
} }
key := fmt.Sprintf("kstat.zfs.misc.%s.%s", fmtExt, parts[0]) // kstat data type (column 2) should be KSTAT_DATA_UINT64, otherwise ignore
// TODO: when other KSTAT_DATA_* types arrive, much of this will need to be restructured
value, err := strconv.ParseUint(parts[2], 10, 64) if parts[1] == KSTAT_DATA_UINT64 {
if err != nil { key := fmt.Sprintf("kstat.zfs.misc.%s.%s", fmtExt, parts[0])
return fmt.Errorf("could not parse expected integer value for %q", key) value, err := strconv.ParseUint(parts[2], 10, 64)
if err != nil {
return fmt.Errorf("could not parse expected integer value for %q", key)
}
handler(zfsSysctl(key), value)
} }
handler(zfsSysctl(key), value)
} }
if !parseLine { if !parseLine {
return fmt.Errorf("did not parse a single %q metric", fmtExt) return fmt.Errorf("did not parse a single %q metric", fmtExt)

View file

@ -310,3 +310,147 @@ func TestZpoolParsing(t *testing.T) {
t.Fatal("Zpool parsing handler was not called for some expected sysctls") t.Fatal("Zpool parsing handler was not called for some expected sysctls")
} }
} }
func TestAbdstatsParsing(t *testing.T) {
abdstatsFile, err := os.Open("fixtures/proc/spl/kstat/zfs/abdstats")
if err != nil {
t.Fatal(err)
}
defer abdstatsFile.Close()
c := zfsCollector{}
if err != nil {
t.Fatal(err)
}
handlerCalled := false
err = c.parseProcfsFile(abdstatsFile, "abdstats", func(s zfsSysctl, v uint64) {
if s != zfsSysctl("kstat.zfs.misc.abdstats.linear_data_size") {
return
}
handlerCalled = true
if v != uint64(223232) {
t.Fatalf("Incorrect value parsed from procfs abdstats data")
}
})
if err != nil {
t.Fatal(err)
}
if !handlerCalled {
t.Fatal("ABDStats parsing handler was not called for some expected sysctls")
}
}
func TestDbufstatsParsing(t *testing.T) {
dbufstatsFile, err := os.Open("fixtures/proc/spl/kstat/zfs/dbuf_stats")
if err != nil {
t.Fatal(err)
}
defer dbufstatsFile.Close()
c := zfsCollector{}
if err != nil {
t.Fatal(err)
}
handlerCalled := false
err = c.parseProcfsFile(dbufstatsFile, "dbufstats", func(s zfsSysctl, v uint64) {
if s != zfsSysctl("kstat.zfs.misc.dbufstats.hash_hits") {
return
}
handlerCalled = true
if v != uint64(108807) {
t.Fatalf("Incorrect value parsed from procfs dbufstats data")
}
})
if err != nil {
t.Fatal(err)
}
if !handlerCalled {
t.Fatal("DbufStats parsing handler was not called for some expected sysctls")
}
}
func TestDnodestatsParsing(t *testing.T) {
dnodestatsFile, err := os.Open("fixtures/proc/spl/kstat/zfs/dnodestats")
if err != nil {
t.Fatal(err)
}
defer dnodestatsFile.Close()
c := zfsCollector{}
if err != nil {
t.Fatal(err)
}
handlerCalled := false
err = c.parseProcfsFile(dnodestatsFile, "dnodestats", func(s zfsSysctl, v uint64) {
if s != zfsSysctl("kstat.zfs.misc.dnodestats.dnode_hold_alloc_hits") {
return
}
handlerCalled = true
if v != uint64(37617) {
t.Fatalf("Incorrect value parsed from procfs dnodestats data")
}
})
if err != nil {
t.Fatal(err)
}
if !handlerCalled {
t.Fatal("Dnodestats parsing handler was not called for some expected sysctls")
}
}
func TestVdevMirrorstatsParsing(t *testing.T) {
vdevMirrorStatsFile, err := os.Open("fixtures/proc/spl/kstat/zfs/vdev_mirror_stats")
if err != nil {
t.Fatal(err)
}
defer vdevMirrorStatsFile.Close()
c := zfsCollector{}
if err != nil {
t.Fatal(err)
}
handlerCalled := false
err = c.parseProcfsFile(vdevMirrorStatsFile, "vdev_mirror_stats", func(s zfsSysctl, v uint64) {
if s != zfsSysctl("kstat.zfs.misc.vdev_mirror_stats.preferred_not_found") {
return
}
handlerCalled = true
if v != uint64(94) {
t.Fatalf("Incorrect value parsed from procfs vdev_mirror_stats data")
}
})
if err != nil {
t.Fatal(err)
}
if !handlerCalled {
t.Fatal("VdevMirrorStats parsing handler was not called for some expected sysctls")
}
}