I have a program that collects various kstat information on our Solaris systems and, now that we've introduced Linux into our data center, I'd like to do the same for Linux.
I'm having trouble, however, finding equivalents for many of the kstats. I was wondering if there is a library or utility that mimics kstats for the Linux environment. Even a partial implementation would be helpful.
As of right now, I've been parsing files in /proc but finding the right information has been hit or miss. For example, kstat has the following data:
unix::vminfo swap_alloc swap_avail swap_free swap_resv
In Linux, you have the entries "SwapTotal" and "SwapFree" but a) It appears that swap_free actually corresponds to "SwapTotal" and swap_avail corresponds to "SwapFree" b) I can't find values for swap_avail (Maybe SwapTotal minus SwapFree?) now swap_resv
Any ideas?
Perl version:
https://github.com/zfsonlinux/linux-kstat
"This is an implementation of the Sun::Solaris::Kstat Perl module for Linux ZFS. It should behave identically to the Solaris version."
Ruby version:
https://www.rubydoc.info/gems/linux-kstat/Linux/Kstat
"The Kstat class encapsulates Linux kernel statistics derived from /proc/stat."