libstatgrab
- What is libstatgrab?
- Current version
- Downloading
- Bug reporting and development
- Language bindings
- Packages
- Documentation
- Screenshot
What is libstatgrab?
libstatgrab is a library that provides cross platform access to statistics about the system on which it’s run. It’s written in C and presents a selection of useful interfaces which can be used to access key system statistics. The current list of statistics includes CPU usage, memory utilisation, disk usage, process counts, network traffic, disk I/O, and more.
The current list of supported and tested platforms includes FreeBSD, Linux, NetBSD, OpenBSD, Solaris, DragonFly BSD, HP-UX and AIX. We are always happy to accept patches to extend support to other operating systems.
The package also includes a couple of useful tools. The first, saidar, provides a curses-based interface to viewing the current state of the system. The second, statgrab, gives a sysctl-style interface to the statistics gathered by libstatgrab. This extends the use of libstatgrab to people writing scripts or anything else that can’t easily make C function calls. Included with statgrab is a script to generate an MRTG configuration file to use statgrab.
The library part of libstatgrab is licensed under the GNU LGPL, but the tools and examples are licensed under the GNU GPL.
Current version
The current release is libstatgrab 0.92.1 released on 27 July 2021.
This release includes minor bugfixes and is API and ABI compatible with 0.92.
- Fix build with autoconf 2.70+.
- Fix CPU stats on older Linux kernels.
- Make sure to count processes in an unknown state.
- Check if -ltinfo is needed when linking ncurses.
- Fixes to build when cross-compiling.
- Fix build with -DNDEBUG.
- Handle vmmeter changes in FreeBSD 12.
Downloading
All versions of libstatgrab can be downloaded from GitHub. Downloads are signed using our key (download here):
pub rsa4096/0xA12F416AA37F3BD7 2013-08-07 [SC] [expires: 2027-08-29]
Key fingerprint = 4AD8 6566 CAD0 3297 A980 4702 A12F 416A A37F 3BD7
uid [ full ] i-scream Development Team <dev@i-scream.org>
sub rsa4096/0x29E38BE8BCE83B45 2013-08-07 [E] [expires: 2027-08-29]
For installation instructions see the README file contained within the archive.
Bug reporting and development
If you found a bug or an issue with libstatgrab then you can report it on the project’s GitHub issues page. If you have a fix you can make a pull request there too. Bugs with a detailed description or a fix are likely to be committed sooner.
We’re happy to accept patches that fix, improve, or extend libstatgrab.
Language bindings
Here are links to bindings for higher level languages that provide access to libstatgrab. If you’ve written a binding for another language, please get in touch so we can add a link here.
Packages of libstatgrab
These are various pre-packaged versions of libstatgrab that you can get for your favourite operating system. If we’ve missed any out, please let us know.
We’ve noticed that Google throws up some RPMs relating to Mandrake and Suse, but no webpage for them.
Documentation
The only online documentation we have at the moment is the manual pages converted in to HTML format. First are the manual pages for the command line tools:
We also have an overview page for the library:
Then we have the manual pages for each function:
- sg_comp_init(3)
- sg_get_cpu_stats(3)
- sg_get_disk_io_stats(3)
- sg_get_error(3)
- sg_get_fs_stats(3)
- sg_get_host_info(3)
- sg_get_load_stats(3)
- sg_get_mem_stats(3)
- sg_get_network_iface_stats(3)
- sg_get_network_io_stats(3)
- sg_get_page_stats(3)
- sg_get_process_stats(3)
- sg_get_user_stats(3)
- sg_init(3)
- sg_internal-intro(3)
- sg_intro(3)
- sg_lock_mutex(3)
- sg_set_error(3)
- sg_vector_create(3)
Screenshot
Here’s what saidar looks like when it’s running: