ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/libstatgrab/src/libstatgrab/statgrab.h
Revision: 1.15
Committed: Fri Oct 24 17:00:26 2003 UTC (20 years, 6 months ago) by ats
Content type: text/plain
Branch: MAIN
Changes since 1.14: +6 -0 lines
Log Message:
Move MAX_LOGIN_NAME_SIZE definition to the right place.

File Contents

# User Rev Content
1 pajs 1.1 /*
2     * i-scream central monitoring system
3 tdb 1.13 * http://www.i-scream.org
4     * Copyright (C) 2000-2003 i-scream
5 pajs 1.1 *
6     * This program is free software; you can redistribute it and/or
7     * modify it under the terms of the GNU General Public License
8     * as published by the Free Software Foundation; either version 2
9     * of the License, or (at your option) any later version.
10     *
11     * This program is distributed in the hope that it will be useful,
12     * but WITHOUT ANY WARRANTY; without even the implied warranty of
13     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14     * GNU General Public License for more details.
15     *
16     * You should have received a copy of the GNU General Public License
17     * along with this program; if not, write to the Free Software
18     * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19     */
20    
21     #include <sys/types.h>
22 ats 1.15 #ifdef NETBSD
23     #include <limits.h>
24     #endif
25 pajs 1.1
26     typedef struct{
27 pajs 1.9 long long user;
28     long long kernel;
29     long long idle;
30     long long iowait;
31     long long swap;
32     long long nice;
33     long long total;
34 pajs 1.1 time_t systime;
35     }cpu_states_t;
36    
37     typedef struct{
38     float user;
39     float kernel;
40     float idle;
41     float iowait;
42     float swap;
43     float nice;
44     time_t time_taken;
45     }cpu_percent_t;
46    
47     typedef struct{
48     long long total;
49     long long free;
50     long long used;
51     long long cache;
52     }mem_stat_t;
53    
54     typedef struct{
55     double min1;
56     double min5;
57     double min15;
58     }load_stat_t;
59    
60     #ifdef SOLARIS
61     #define MAX_LOGIN_NAME_SIZE 8
62     #endif
63 pajs 1.12 #if defined(LINUX) || defined(FREEBSD)
64 pajs 1.10 #define MAX_LOGIN_NAME_SIZE UT_NAMESIZE
65 ats 1.15 #endif
66     #ifdef NETBSD
67     #define MAX_LOGIN_NAME_SIZE _POSIX_LOGIN_NAME_MAX
68 pajs 1.10 #endif
69 pajs 1.1
70     typedef struct{
71 pajs 1.8 char *name_list;
72 pajs 1.1 int num_entries;
73     }user_stat_t;
74    
75     typedef struct{
76     long long total;
77     long long used;
78     long long free;
79     }swap_stat_t;
80    
81     typedef struct{
82     char *os_name;
83     char *os_release;
84     char *os_version;
85     char *platform;
86     char *hostname;
87     time_t uptime;
88     }general_stat_t;
89    
90     typedef struct {
91     char *device_name;
92     char *fs_type;
93     char *mnt_point;
94     long long size;
95     long long used;
96     long long avail;
97     long long total_inodes;
98     long long used_inodes;
99     long long free_inodes;
100     }disk_stat_t;
101    
102     typedef struct{
103 pajs 1.4 char *disk_name;
104     long long read_bytes;
105     long long write_bytes;
106     time_t systime;
107     }diskio_stat_t;
108    
109     typedef struct{
110 pajs 1.1 int total;
111     int running;
112     int sleeping;
113     int stopped;
114     int zombie;
115     }process_stat_t;
116    
117     typedef struct{
118     char *interface_name;
119     long long tx;
120     long long rx;
121     time_t systime;
122     }network_stat_t;
123    
124     typedef struct{
125 pajs 1.2 long long pages_pagein;
126     long long pages_pageout;
127 pajs 1.1 time_t systime;
128     }page_stat_t;
129    
130     cpu_states_t *get_cpu_totals();
131     cpu_states_t *get_cpu_diff();
132     cpu_percent_t *cpu_percent_usage();
133    
134     mem_stat_t *get_memory_stats();
135    
136     load_stat_t *get_load_stats();
137    
138     user_stat_t *get_user_stats();
139    
140     swap_stat_t *get_swap_stats();
141    
142     general_stat_t *get_general_stats();
143    
144     disk_stat_t *get_disk_stats(int *entries);
145 pajs 1.5 diskio_stat_t *get_diskio_stats(int *entries);
146 pajs 1.7 diskio_stat_t *get_diskio_stats_diff(int *entries);
147 pajs 1.1
148     process_stat_t *get_process_stats();
149    
150     network_stat_t *get_network_stats(int *entries);
151 pajs 1.4 network_stat_t *get_network_stats_diff(int *entries);
152 pajs 1.2
153     page_stat_t *get_page_stats();
154 pajs 1.3 page_stat_t *get_page_stats_diff();
155 pajs 1.14
156     int statgrab_init(void);