1libstatgrab(3)                                                  libstatgrab(3)
2
3
4

NAME

6       statgrab, libstatgrab - get system statistics
7

SYNOPSIS

9       #include <statgrab.h>
10
11
12       sg_error sg_init (int ignore_init_errors);
13
14       sg_error sg_shutdown (void);
15
16       sg_error sg_drop_privileges (void);
17
18       sg_error sg_get_error (void);
19
20       const char *sg_get_error_arg (void);
21
22       int sg_get_error_errno (void);
23
24       const char *sg_str_error (sg_error code);
25
26       sg_error sg_get_error_details (sg_error_details *err_details);
27
28       char *sg_strperror (char **buf, const sg_error_details * const
29                          err_details);
30
31       size_t sg_get_nelements (const void *data);
32
33       sg_error sg_free_stats_buf (void *data);
34
35       sg_error sg_lock_mutex (const char *mutex_name);
36
37       sg_error sg_unlock_mutex (const char *mutex_name);
38
39       sg_cpu_percents *sg_get_cpu_percents (void);
40
41       sg_cpu_percents *sg_get_cpu_percents_of (sg_cpu_percent_source cps);
42
43       sg_cpu_percents *sg_get_cpu_percents_r (const sg_cpu_stats *whereof);
44
45       void sg_free_cpu_percents (sg_cpu_percents *data);
46
47       sg_cpu_stats *sg_get_cpu_stats (void);
48
49       sg_cpu_stats *sg_get_cpu_stats_diff (void);
50
51       sg_cpu_stats *sg_get_cpu_stats_r (void);
52
53       sg_cpu_stats *sg_get_cpu_stats_diff_between (const sg_cpu_stats
54                       *cpu_now, const sg_cpu_stats *cpu_last);
55
56       sg_error sg_free_cpu_stats (sg_cpu_stats *data);
57
58       sg_disk_io_stats *sg_get_disk_io_stats (size_t *entries);
59
60       sg_disk_io_stats *sg_get_disk_io_stats_r (size_t *entries);
61
62       sg_disk_io_stats *sg_get_disk_io_stats_diff (size_t *entries);
63
64       sg_disk_io_stats *sg_get_disk_io_stats_diff_between (const
65                       sg_disk_io_stats *cur, const sg_disk_io_stats *last,
66                       size_t *entries);
67
68       sg_error sg_free_disk_io_stats (sg_disk_io_stats *data);
69
70       sg_fs_stats *sg_get_fs_stats (size_t *entries);
71
72       sg_fs_stats *sg_get_fs_stats_r (size_t *entries);
73
74       sg_error sg_free_fs_stats (sg_fs_stats *data);
75
76       const char **sg_get_valid_filesystems (size_t *entries);
77
78       sg_error sg_set_valid_filesystems (const char *valid_fs[]);
79
80       sg_host_info *sg_get_host_info (void);
81
82       sg_host_info *sg_get_host_info_r (void);
83
84       sg_error sg_free_host_info (sg_host_info *data);
85
86       sg_load_stats *sg_get_load_stats (void);
87
88       sg_load_stats *sg_get_load_stats (void);
89
90       sg_error sg_free_load_stats (sg_load_stats *data);
91
92       sg_mem_stats *sg_get_mem_stats (void);
93
94       sg_mem_stats *sg_get_mem_stats_r (void);
95
96       sg_error sg_free_mem_stats (sg_mem_stats *data);
97
98       sg_swap_stats *sg_get_swap_stats (void);
99
100       sg_swap_stats *sg_get_swap_stats_r (void);
101
102       sg_error sg_free_swap_stats (sg_swap_stats *data);
103
104       sg_network_iface_stats *sg_get_network_iface_stats (size_t *entries);
105
106       sg_network_iface_stats *sg_get_network_iface_stats_r (size_t *entries);
107
108       sg_error sg_free_network_iface_stats (sg_network_iface_stats *data);
109
110       sg_network_io_stats *sg_get_network_io_stats (size_t *entries);
111
112       sg_network_io_stats *sg_get_network_io_stats_r (size_t *entries);
113
114       sg_network_io_stats *sg_get_network_io_stats_diff (size_t *entries);
115
116       sg_network_io_stats *sg_get_network_io_stats_diff_between (const
117                       sg_network_io_stats *cur, const sg_network_io_stats
118                       *last, size_t *entries);
119
120       sg_error sg_free_network_io_stats (sg_network_iface_stats *data);
121
122       sg_page_stats *sg_get_page_stats (void);
123
124       sg_page_stats *sg_get_page_stats_r (void);
125
126       sg_page_stats *sg_get_page_stats_diff (void);
127
128       sg_page_stats *sg_get_page_stats_diff_between (const sg_page_stats
129                       *cur, const sg_page_stats *last);
130
131       sg_error sg_free_page_stats (sg_page_stats *data);
132
133       sg_process_stats *sg_get_process_stats (size_t *entries);
134
135       sg_process_stats *sg_get_process_stats_r (size_t *entries);
136
137       sg_error sg_free_process_stats (sg_process_stats *data);
138
139       sg_process_count *sg_get_process_count (void);
140
141       sg_process_count *sg_get_process_count_of (sg_process_count_source
142                       pcs);
143
144       sg_process_count *sg_get_process_count_r (sg_process_stats const
145                       *whereof);
146
147       sg_error sg_free_process_count (sg_process_count *data);
148
149       sg_user_stats *sg_get_user_stats (size_t *entries);
150
151       sg_user_stats *sg_get_user_stats_r (size_t *entries);
152
153       sg_error sg_free_user_stats (sg_user_stats *data);
154

DESCRIPTION

156       The statgrab library provides a cross-platform interface to get several
157       system  statistics. System statistics aren't standardised, so the stat‐
158       grab library tries to choose the most important values  over  all  sup‐
159       ported  operating  systems.  This implies that some values might not be
160       available on every OS while some specific values are missing when there
161       are no counterparts on any other OS.
162
163       The  libstatgrab is organised in components, each for interrelated sta‐
164       tistics.
165
166       ┌──────────┬────────────────────────────┐
167       │component │ statistics                 │
168       ├──────────┼────────────────────────────┤
169       │cpu       │ sg_cpu_stats,  sg_cpu_per‐ │
170       │          │ cents                      │
171       ├──────────┼────────────────────────────┤
172       │disk      │ sg_disk_io_stats,          │
173       │          │ sg_fs_stats                │
174       ├──────────┼────────────────────────────┤
175       │load      │ sg_load_stats              │
176       ├──────────┼────────────────────────────┤
177       │mem       │ sg_mem_stats               │
178       ├──────────┼────────────────────────────┤
179       │network   │ sg_network_io_stats,       │
180       │          │ sg_network_iface_stats     │
181       ├──────────┼────────────────────────────┤
182       │os        │ sg_host_info               │
183       ├──────────┼────────────────────────────┤
184       │page      │ sg_page_stats              │
185       ├──────────┼────────────────────────────┤
186       │process   │ sg_process_stats,          │
187       │          │ sg_process_count           │
188       ├──────────┼────────────────────────────┤
189       │swap      │ sg_swap_stats              │
190       ├──────────┼────────────────────────────┤
191       │user      │ sg_user_stats              │
192       └──────────┴────────────────────────────┘
193       The library was originally written to support the i-scream central mon‐
194       itoring  system, but has since become a standalone package. It has been
195       ported to work on Linux, NetBSD, FreeBSD, OpenBSD, DragonFly  BSD,  So‐
196       laris, HP-UX, AIX and Cygwin.
197

SEE ALSO

199       sg_intro(3)         sg_get_cpu_stats(3)         sg_get_disk_io_stats(3)
200       sg_get_fs_stats(3)       sg_get_host_info(3)       sg_get_load_stats(3)
201       sg_get_mem_stats(3)        sg_get_network_io_stats(3)       sg_get_net‐
202       work_iface_stats(3)    sg_get_page_stats(3)     sg_get_process_stats(3)
203       sg_get_swap_stats(3)  sg_get_user_stats(3) sg_get_error(3) sg_internal-
204       intro(3)
205

WEBSITE

207https://libstatgrab.org/
208
209
210
211libstatgrab                       2019-03-08                    libstatgrab(3)
Impressum