libstatgrab(3)

NAME
statgrab, libstatgrab - get system statistics

SYNOPSIS
\FC#include <statgrab.h>\F[]

\FCsg_error sg_init\F[]
\FC(int ignore_init_errors);\F[]

\FCsg_error sg_shutdown\F[]
\FC(void);\F[]

\FCsg_error sg_drop_privileges\F[]
\FC(void);\F[]

\FCsg_error sg_get_error\F[]
\FC(void);\F[]

\FCconst char *sg_get_error_arg\F[]
\FC(void);\F[]

\FCint sg_get_error_errno\F[]
\FC(void);\F[]

\FCconst char *sg_str_error\F[]
\FC(sg_error code);\F[]

\FCsg_error sg_get_error_details\F[]
\FC(sg_error_details *err_details);\F[]

\FCchar *sg_strperror\F[]
\FC(char **buf, const sg_error_details * const err_details);\F[]

\FCsize_t sg_get_nelements\F[]
\FC(const void *data);\F[]

\FCsg_error sg_free_stats_buf\F[]
\FC(void *data);\F[]

\FCsg_error sg_lock_mutex\F[]
\FC(const char *mutex_name);\F[]

\FCsg_error sg_unlock_mutex\F[]
\FC(const char *mutex_name);\F[]

\FCsg_cpu_percents *sg_get_cpu_percents\F[]
\FC(void);\F[]

\FCsg_cpu_percents *sg_get_cpu_percents_of\F[]
\FC(sg_cpu_percent_source cps);\F[]

\FCsg_cpu_percents *sg_get_cpu_percents_r\F[]
\FC(const sg_cpu_stats *whereof);\F[]

\FCvoid sg_free_cpu_percents\F[]
\FC(sg_cpu_percents *data);\F[]

\FCsg_cpu_stats *sg_get_cpu_stats\F[]
\FC(void);\F[]

\FCsg_cpu_stats *sg_get_cpu_stats_diff\F[]
\FC(void);\F[]

\FCsg_cpu_stats *sg_get_cpu_stats_r\F[]
\FC(void);\F[]

\FCsg_cpu_stats *sg_get_cpu_stats_diff_between\F[]
\FC(const sg_cpu_stats *cpu_now, const sg_cpu_stats *cpu_last);\F[]

\FCsg_error sg_free_cpu_stats\F[]
\FC(sg_cpu_stats *data);\F[]

\FCsg_disk_io_stats *sg_get_disk_io_stats\F[]
\FC(size_t *entries);\F[]

\FCsg_disk_io_stats *sg_get_disk_io_stats_r\F[]
\FC(size_t *entries);\F[]

\FCsg_disk_io_stats *sg_get_disk_io_stats_diff\F[]
\FC(size_t *entries);\F[]

\FCsg_disk_io_stats *sg_get_disk_io_stats_diff_between\F[]
\FC(const sg_disk_io_stats *cur, const sg_disk_io_stats *last, size_t *entries);\F[]

\FCsg_error sg_free_disk_io_stats\F[]
\FC(sg_disk_io_stats *data);\F[]

\FCsg_fs_stats *sg_get_fs_stats\F[]
\FC(size_t *entries);\F[]

\FCsg_fs_stats *sg_get_fs_stats_r\F[]
\FC(size_t *entries);\F[]

\FCsg_error sg_free_fs_stats\F[]
\FC(sg_fs_stats *data);\F[]

\FCconst char **sg_get_valid_filesystems\F[]
\FC(size_t *entries);\F[]

\FCsg_error sg_set_valid_filesystems\F[]
\FC(const char *valid_fs[]);\F[]

\FCsg_host_info *sg_get_host_info\F[]
\FC(void);\F[]

\FCsg_host_info *sg_get_host_info_r\F[]
\FC(void);\F[]

\FCsg_error sg_free_host_info\F[]
\FC(sg_host_info *data);\F[]

\FCsg_load_stats *sg_get_load_stats\F[]
\FC(void);\F[]

\FCsg_load_stats *sg_get_load_stats\F[]
\FC(void);\F[]

\FCsg_error sg_free_load_stats\F[]
\FC(sg_load_stats *data);\F[]

\FCsg_mem_stats *sg_get_mem_stats\F[]
\FC(void);\F[]

\FCsg_mem_stats *sg_get_mem_stats_r\F[]
\FC(void);\F[]

\FCsg_error sg_free_mem_stats\F[]
\FC(sg_mem_stats *data);\F[]

\FCsg_swap_stats *sg_get_swap_stats\F[]
\FC(void);\F[]

\FCsg_swap_stats *sg_get_swap_stats_r\F[]
\FC(void);\F[]

\FCsg_error sg_free_swap_stats\F[]
\FC(sg_swap_stats *data);\F[]

\FCsg_network_iface_stats *sg_get_network_iface_stats\F[]
\FC(size_t *entries);\F[]

\FCsg_network_iface_stats *sg_get_network_iface_stats_r\F[]
\FC(size_t *entries);\F[]

\FCsg_error sg_free_network_iface_stats\F[]
\FC(sg_network_iface_stats *data);\F[]

\FCsg_network_io_stats *sg_get_network_io_stats\F[]
\FC(size_t *entries);\F[]

\FCsg_network_io_stats *sg_get_network_io_stats_r\F[]
\FC(size_t *entries);\F[]

\FCsg_network_io_stats *sg_get_network_io_stats_diff\F[]
\FC(size_t *entries);\F[]

\FCsg_network_io_stats *sg_get_network_io_stats_diff_between\F[]
\FC(const sg_network_io_stats *cur, const sg_network_io_stats *last, size_t *entries);\F[]

\FCsg_error sg_free_network_io_stats\F[]
\FC(sg_network_iface_stats *data);\F[]

\FCsg_page_stats *sg_get_page_stats\F[]
\FC(void);\F[]

\FCsg_page_stats *sg_get_page_stats_r\F[]
\FC(void);\F[]

\FCsg_page_stats *sg_get_page_stats_diff\F[]
\FC(void);\F[]

\FCsg_page_stats *sg_get_page_stats_diff_between\F[]
\FC(const sg_page_stats *cur, const sg_page_stats *last);\F[]

\FCsg_error sg_free_page_stats\F[]
\FC(sg_page_stats *data);\F[]

\FCsg_process_stats *sg_get_process_stats\F[]
\FC(size_t *entries);\F[]

\FCsg_process_stats *sg_get_process_stats_r\F[]
\FC(size_t *entries);\F[]

\FCsg_error sg_free_process_stats\F[]
\FC(sg_process_stats *data);\F[]

\FCsg_process_count *sg_get_process_count\F[]
\FC(void);\F[]

\FCsg_process_count *sg_get_process_count_of\F[]
\FC(sg_process_count_source pcs);\F[]

\FCsg_process_count *sg_get_process_count_r\F[]
\FC(sg_process_stats const *whereof);\F[]

\FCsg_error sg_free_process_count\F[]
\FC(sg_process_count *data);\F[]

\FCsg_user_stats *sg_get_user_stats\F[]
\FC(size_t *entries);\F[]

\FCsg_user_stats *sg_get_user_stats_r\F[]
\FC(size_t *entries);\F[]

\FCsg_error sg_free_user_stats\F[]
\FC(sg_user_stats *data);\F[]

DESCRIPTION
The statgrab library provides a cross-platform interface to get several system statistics. System statistics aren't standardised, so the statgrab library tries to choose the most important values over all supported operating systems. This implies that some values might not be available on every OS while some specific values are missing when there are no counterparts on any other OS.

The libstatgrab is organised in components, each for interrelated statistics.
component | statistics
cpu | \FCsg_cpu_stats\F[], \FCsg_cpu_percents\F[]
disk | \FCsg_disk_io_stats\F[], \FCsg_fs_stats\F[]
load | \FCsg_load_stats\F[]
mem | \FCsg_mem_stats\F[]
network | \FCsg_network_io_stats\F[], \FCsg_network_iface_stats\F[]
os | \FCsg_host_info\F[]
page | \FCsg_page_stats\F[]
process | \FCsg_process_stats\F[], \FCsg_process_count\F[]
swap | \FCsg_swap_stats\F[]
user | \FCsg_user_stats\F[]

The library was originally written to support the i-scream central monitoring system, but has since become a standalone package. It has been ported to work on Linux, NetBSD, FreeBSD, OpenBSD, DragonFly BSD, Solaris, HP-UX, AIX and Cygwin.

SEE ALSO
sg_intro(3) sg_get_cpu_stats(3) sg_get_disk_io_stats(3) sg_get_fs_stats(3) sg_get_host_info(3) sg_get_load_stats(3) sg_get_mem_stats(3) sg_get_network_io_stats(3) sg_get_network_iface_stats(3) sg_get_page_stats(3) sg_get_process_stats(3) sg_get_swap_stats(3) sg_get_user_stats(3) sg_get_error(3) sg_internal-intro(3)

WEBSITE
⟨https://libstatgrab.org/⟩