--- projects/libstatgrab/docs/statgrab.xml 2004/01/06 17:15:04 1.5 +++ projects/libstatgrab/docs/statgrab.xml 2004/05/05 10:40:50 1.10 @@ -6,106 +6,129 @@ - $Date: 2004/01/06 17:15:04 $ - $Id: statgrab.xml,v 1.5 2004/01/06 17:15:04 pajs Exp $ + $Date: 2004/05/05 10:40:50 $ + $Id: statgrab.xml,v 1.10 2004/05/05 10:40:50 tdb Exp $ - + statgrab 3 i-scream - + statgrab get system statistics - + #include <statgrab.h> - int statgrab_init + int sg_init - int statgrab_drop_privileges + int sg_drop_privileges - cpu_percent_t *cpu_percent_usage + sg_error sg_get_error - cpu_states_t *get_cpu_totals + const char *sg_get_error_arg - cpu_states_t *get_cpu_diff + const char *sg_str_error + sg_error code + + + + sg_cpu_stats *sg_get_cpu_stats + + sg_cpu_stats *sg_get_cpu_stats_diff + + + + sg_cpu_percents *sg_get_cpu_percents + + - diskio_stat_t *get_diskio_stats + sg_disk_io_stats *sg_get_disk_io_stats int *entries - diskio_stat_t *get_diskio_stats_diff + sg_disk_io_stats *sg_get_disk_io_stats_diff int *entries - general_stat_t *get_general_stats + sg_fs_stats *sg_get_fs_stats - load_stat_t *get_load_stats + sg_host_info *sg_get_host_info - mem_stat_t *get_memory_stats + sg_load_stats *sg_get_load_stats + - swap_stat_t *get_swap_stats + sg_mem_stats *sg_get_mem_stats + + sg_swap_stats *sg_get_swap_stats + + - network_stat_t *get_network_stats + sg_network_io_stats *sg_get_network_io_stats int *entries - network_stat_t *get_network_stats_diff + sg_network_io_stats *sg_get_network_io_stats_diff int *entries - page_stat_t *get_page_stats + sg_network_iface_stats *sg_get_network_iface_stats + int *entries + + + + sg_page_stats *sg_get_page_stats - page_stat_t *get_page_stats_diff + sg_page_stats *sg_get_page_stats_diff - process_stat_t *get_process_stats + sg_process_count *sg_get_process_stats - user_stat_t *get_user_stats + sg_user_stats *sg_get_user_stats - + Description @@ -115,7 +138,7 @@ function for more details on usage. - statgrab_init must be the first + sg_init must be the first function you call before you start to use libstatgrab; it performs all the one-time initialisation operations that need setuid/setgid privileges. For instance, on *BSD it opens a descriptor to be able to @@ -123,74 +146,94 @@ mappings that in some cases are only accessible by root (machines with a /dev/osa). Once this has run, the other libstatgrab functions no longer need elevated privileges. It is therefore a good idea to call - statgrab_drop_privileges, which discards + sg_drop_privileges, which discards setuid and setgid privileges, immediately after you call - statgrab_init, unless your application has + sg_init, unless your application has another reason for needing setuid or setgid privileges. - statgrab_init and - statgrab_drop_privileges return 0 on success, and + sg_init and + sg_drop_privileges return 0 on success, and non-zero on failure. - 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, Solaris and Cygwin. + There are three functions relating to error reporting in libstatgrab. + The first, sg_get_error returns an sg_error code + which relates to the last error generated by libstatgrab. This can be + converted to a string by calling sg_str_error + giving the sg_error code as an argument. Finally, an optional + argument may be set when the error was generated. This can be + accessed by calling sg_get_error_arg. + + It is the intended practice that whenever a libstatgrab function is + called and subsequently fails that an appropriate error will be set. + + + 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 and Cygwin. + - + See Also - cpu_percent_usage + sg_get_cpu_percents 3 - get_diskio_stats + sg_get_disk_io_stats 3 - get_general_stats + sg_get_host_info 3 - get_load_stats + sg_get_load_stats 3 - get_memory_stats + sg_get_mem_stats 3 - get_network_stats + sg_get_network_io_stats 3 - get_page_stats + sg_get_network_iface_stats 3 - get_process_stats + sg_get_page_stats 3 - get_user_stats + sg_get_process_stats 3 + + sg_get_user_stats + 3 + - + Website - + - http://www.i-scream.org + + http://www.i-scream.org/libstatgrab/ +