Post by Borja Marcos
The zpool iostat output has all sorts of statistics I think would be useful/interesting to record over time.
Yes, thanks :) I think I will add them, I just started with the esoteric ones.
Anyway, still there's no better way to read it than running zpool iostat and parsing the output, right?
I believe, in this case you'd have to run it as a continuous process
and parse the outputs after the first one (overall uptime stat, IIRC).
Also note that on problems with ZFS engine itself, "zpool" may lock up
and thus halt your program - so have it ready to abort an outstanding
statistics read after a timeout and perhaps log an error.
And if pools are imported-exported during work, the "zpool iostat"
output changes dynamically, so you basically need to parse its text
structure every time.
The "zpool iostat -v" might be even more interesting though, as it lets
you see per-vdev statistics and perhaps notice imbalances, etc...
All that said, I don't know if this data isn't also available as some
set of kstats - that would probably be a lot better for your cause.
Inspect the "zpool" source to see where it gets its numbers from...
and perhaps make and RTI relevant kstats, if they aren't yet there ;)
On the other hand, I am not certain how Solaris-based kstats interact
or correspond to structures in FreeBSD (or Linux for that matter)?..