zabbix-zfs icon indicating copy to clipboard operation
zabbix-zfs copied to clipboard

IO stats can't be read

Open RomLecat opened this issue 3 years ago • 3 comments

Hello,

The script can't seem to export IO stats properly. Zabbix reports "Failed: cannot extract value from json by path "$.pools['tank'].io.nread": no data matches the specified path".

[root@nas scripts]# zfs version
zfs-2.1.2-1
zfs-kmod-2.1.2-1
[root@nas scripts]# cat /proc/spl/kstat/zfs/tank/iostats
25 1 0x01 18 4896 16480097184 1560546720495438
name                            type data
trim_extents_written            4    0
trim_bytes_written              4    0
trim_extents_skipped            4    0
trim_bytes_skipped              4    0
trim_extents_failed             4    0
trim_bytes_failed               4    0
autotrim_extents_written        4    0
autotrim_bytes_written          4    0
autotrim_extents_skipped        4    0
autotrim_bytes_skipped          4    0
autotrim_extents_failed         4    0
autotrim_bytes_failed           4    0
simple_trim_extents_written     4    0
simple_trim_bytes_written       4    0
simple_trim_extents_skipped     4    0
simple_trim_bytes_skipped       4    0
simple_trim_extents_failed      4    0
simple_trim_bytes_failed        4    0
[root@nas scripts]# zabbix_agent2 -t zfs
...
"pools": {
    "tank": {
      "name": "tank",
      "size": 235965503242240,
      "alloc": 128453681639424,
      "free": 107511821602816,
      "frag": 4,
      "usage": 54,
      "dedup": 1.0,
      "scrub": 0,
      "online": 1,
      "io": {
        "type": 4,
        "data": 0
      }
    }
  }
... 

Likely due to https://github.com/openzfs/zfs/commit/371f88d96fe0aeb46a72fec78f90e1d777493ee5

Thanks :)

RomLecat avatar Jan 17 '22 20:01 RomLecat

Hi. Yeah, probably due to that. I'm not sure how to better get those stats, but probably for now we can just remove them so that it does not cause alerts in Zabbix...

blind-oracle avatar Jan 18 '22 11:01 blind-oracle

I'm not sure if there's any other way than parsing the output of zpool iostat right now 😕

For instance, to get the stats of the latest 1 second:

[root@nas ~]# zpool iostat -yp 1 1
                        capacity                         operations                         bandwidth
pool                  alloc             free             read            write             read            write
----------  ---------------  ---------------  ---------------  ---------------  ---------------  ---------------
tank        128466484310016  107499018932224               85                0          4407824                0
[root@nas ~]# zpool iostat -yHp 1 1
tank    128466487062528 107499016179712 183     0       11438520        0

RomLecat avatar Jan 18 '22 12:01 RomLecat

Yeah, or summing per-disk IOs of vdevs, which is also not nice. zpool iostat way I don't like as it blocks the script for one second but I just want cumulative counters...

blind-oracle avatar Jan 18 '22 12:01 blind-oracle