1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
|
/*
** Zabbix
** Copyright (C) 2001-2022 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
#ifndef ZABBIX_SYSINFO_H
#define ZABBIX_SYSINFO_H
#include "zbxsysinfo.h"
#include "module.h"
#define ZBX_PROC_STAT_ALL 0
#define ZBX_PROC_STAT_RUN 1
#define ZBX_PROC_STAT_SLEEP 2
#define ZBX_PROC_STAT_ZOMB 3
#define ZBX_PROC_STAT_DISK 4
#define ZBX_PROC_STAT_TRACE 5
#define ZBX_PROC_MODE_PROCESS 0
#define ZBX_PROC_MODE_THREAD 1
#define ZBX_PROC_MODE_SUMMARY 2
#define ZBX_DO_SUM 0
#define ZBX_DO_MAX 1
#define ZBX_DO_MIN 2
#define ZBX_DO_AVG 3
#define ZBX_DO_ONE 4
#define ZBX_LLD_MACRO_FSNAME "{#FSNAME}"
#define ZBX_LLD_MACRO_FSTYPE "{#FSTYPE}"
#define ZBX_LLD_MACRO_FSLABEL "{#FSLABEL}"
#define ZBX_LLD_MACRO_FSDRIVETYPE "{#FSDRIVETYPE}"
#define ZBX_LLD_MACRO_FSOPTIONS "{#FSOPTIONS}"
#define ZBX_SYSINFO_TAG_FSNAME "fsname"
#define ZBX_SYSINFO_TAG_FSTYPE "fstype"
#define ZBX_SYSINFO_TAG_FSLABEL "fslabel"
#define ZBX_SYSINFO_TAG_FSDRIVETYPE "fsdrivetype"
#define ZBX_SYSINFO_TAG_BYTES "bytes"
#define ZBX_SYSINFO_TAG_INODES "inodes"
#define ZBX_SYSINFO_TAG_TOTAL "total"
#define ZBX_SYSINFO_TAG_FREE "free"
#define ZBX_SYSINFO_TAG_USED "used"
#define ZBX_SYSINFO_TAG_PFREE "pfree"
#define ZBX_SYSINFO_TAG_PUSED "pused"
#define ZBX_SYSINFO_TAG_FSOPTIONS "options"
#define ZBX_SYSINFO_FILE_TAG_TYPE "type"
#define ZBX_SYSINFO_FILE_TAG_BASENAME "basename"
#define ZBX_SYSINFO_FILE_TAG_PATHNAME "pathname"
#define ZBX_SYSINFO_FILE_TAG_DIRNAME "dirname"
#define ZBX_SYSINFO_FILE_TAG_USER "user"
#define ZBX_SYSINFO_FILE_TAG_GROUP "group"
#define ZBX_SYSINFO_FILE_TAG_PERMISSIONS "permissions"
#define ZBX_SYSINFO_FILE_TAG_SID "SID"
#define ZBX_SYSINFO_FILE_TAG_UID "uid"
#define ZBX_SYSINFO_FILE_TAG_GID "gid"
#define ZBX_SYSINFO_FILE_TAG_SIZE "size"
#define ZBX_SYSINFO_FILE_TAG_TIME "time"
#define ZBX_SYSINFO_FILE_TAG_TIMESTAMP "timestamp"
#define ZBX_SYSINFO_FILE_TAG_TIME_ACCESS "access"
#define ZBX_SYSINFO_FILE_TAG_TIME_MODIFY "modify"
#define ZBX_SYSINFO_FILE_TAG_TIME_CHANGE "change"
#if defined(_WINDOWS) || defined(__MINGW32__)
typedef int (*zbx_metric_func_t)(AGENT_REQUEST *request, AGENT_RESULT *result, HANDLE timeout_event);
#else
typedef int (*zbx_metric_func_t)(AGENT_REQUEST *request, AGENT_RESULT *result);
#endif
typedef struct
{
zbx_uint64_t total;
zbx_uint64_t not_used;
zbx_uint64_t used;
double pfree;
double pused;
}
zbx_fs_metrics_t;
typedef struct
{
char fsname[MAX_STRING_LEN];
char fstype[MAX_STRING_LEN];
zbx_fs_metrics_t bytes;
zbx_fs_metrics_t inodes;
char *options;
}
zbx_mpoint_t;
int zbx_execute_threaded_metric(zbx_metric_func_t metric_func, AGENT_REQUEST *request, AGENT_RESULT *result);
void zbx_mpoints_free(zbx_mpoint_t *mpoint);
#ifndef _WINDOWS
int hostname_handle_params(AGENT_REQUEST *request, AGENT_RESULT *result, char *hostname);
typedef struct
{
zbx_uint64_t flag;
const char *name;
}
zbx_mntopt_t;
char *zbx_format_mntopt_string(zbx_mntopt_t mntopts[], int flags);
#endif
/* external system functions */
int get_sensor(AGENT_REQUEST *request, AGENT_RESULT *result);
int kernel_maxfiles(AGENT_REQUEST *request, AGENT_RESULT *result);
int kernel_maxproc(AGENT_REQUEST *request, AGENT_RESULT *result);
int kernel_openfiles(AGENT_REQUEST *request, AGENT_RESULT *result);
#ifdef ZBX_PROCSTAT_COLLECTOR
int proc_cpu_util(AGENT_REQUEST *request, AGENT_RESULT *result);
#endif
int proc_get(AGENT_REQUEST *request, AGENT_RESULT *result);
int proc_mem(AGENT_REQUEST *request, AGENT_RESULT *result);
int proc_num(AGENT_REQUEST *request, AGENT_RESULT *result);
int net_if_in(AGENT_REQUEST *request, AGENT_RESULT *result);
int net_if_out(AGENT_REQUEST *request, AGENT_RESULT *result);
int net_if_total(AGENT_REQUEST *request, AGENT_RESULT *result);
int net_if_collisions(AGENT_REQUEST *request, AGENT_RESULT *result);
int net_if_discovery(AGENT_REQUEST *request, AGENT_RESULT *result);
int net_tcp_listen(AGENT_REQUEST *request, AGENT_RESULT *result);
int net_tcp_socket_count(AGENT_REQUEST *request, AGENT_RESULT *result);
int net_udp_listen(AGENT_REQUEST *request, AGENT_RESULT *result);
int net_udp_socket_count(AGENT_REQUEST *request, AGENT_RESULT *result);
int system_cpu_switches(AGENT_REQUEST *request, AGENT_RESULT *result);
int system_cpu_intr(AGENT_REQUEST *request, AGENT_RESULT *result);
int system_cpu_load(AGENT_REQUEST *request, AGENT_RESULT *result);
int system_cpu_util(AGENT_REQUEST *request, AGENT_RESULT *result);
int system_cpu_num(AGENT_REQUEST *request, AGENT_RESULT *result);
int system_cpu_discovery(AGENT_REQUEST *request, AGENT_RESULT *result);
int system_hostname(AGENT_REQUEST *request, AGENT_RESULT *result);
int system_hw_chassis(AGENT_REQUEST *request, AGENT_RESULT *result);
int system_hw_cpu(AGENT_REQUEST *request, AGENT_RESULT *result);
int system_hw_devices(AGENT_REQUEST *request, AGENT_RESULT *result);
int system_hw_macaddr(AGENT_REQUEST *request, AGENT_RESULT *result);
int system_sw_arch(AGENT_REQUEST *request, AGENT_RESULT *result);
int system_sw_os(AGENT_REQUEST *request, AGENT_RESULT *result);
int system_sw_packages(AGENT_REQUEST *request, AGENT_RESULT *result);
int system_swap_in(AGENT_REQUEST *request, AGENT_RESULT *result);
int system_swap_out(AGENT_REQUEST *request, AGENT_RESULT *result);
int system_swap_size(AGENT_REQUEST *request, AGENT_RESULT *result);
int system_uptime(AGENT_REQUEST *request, AGENT_RESULT *result);
int system_uname(AGENT_REQUEST *request, AGENT_RESULT *result);
int system_boottime(AGENT_REQUEST *request, AGENT_RESULT *result);
int vfs_dev_read(AGENT_REQUEST *request, AGENT_RESULT *result);
int vfs_dev_write(AGENT_REQUEST *request, AGENT_RESULT *result);
int vfs_dev_discovery(AGENT_REQUEST *request, AGENT_RESULT *result);
int vfs_fs_inode(AGENT_REQUEST *request, AGENT_RESULT *result);
int vfs_fs_size(AGENT_REQUEST *request, AGENT_RESULT *result);
int vfs_fs_discovery(AGENT_REQUEST *request, AGENT_RESULT *result);
int vfs_fs_get(AGENT_REQUEST *request, AGENT_RESULT *result);
int vm_memory_size(AGENT_REQUEST *request, AGENT_RESULT *result);
#if defined(_WINDOWS) || defined(__MINGW32__)
int user_perf_counter(AGENT_REQUEST *request, AGENT_RESULT *result);
int perf_counter(AGENT_REQUEST *request, AGENT_RESULT *result);
int perf_counter_en(AGENT_REQUEST *request, AGENT_RESULT *result);
int perf_instance_discovery(AGENT_REQUEST *request, AGENT_RESULT *result);
int perf_instance_discovery_en(AGENT_REQUEST *request, AGENT_RESULT *result);
int service_discovery(AGENT_REQUEST *request, AGENT_RESULT *result);
int service_info(AGENT_REQUEST *request, AGENT_RESULT *result);
int service_state(AGENT_REQUEST *request, AGENT_RESULT *result);
int services(AGENT_REQUEST *request, AGENT_RESULT *result);
int proc_info(AGENT_REQUEST *request, AGENT_RESULT *result);
int net_if_list(AGENT_REQUEST *request, AGENT_RESULT *result);
int wmi_get(AGENT_REQUEST *request, AGENT_RESULT *result);
int wmi_getall(AGENT_REQUEST *request, AGENT_RESULT *result);
int vm_vmemory_size(AGENT_REQUEST *request, AGENT_RESULT *result);
int registry_data(AGENT_REQUEST *request, AGENT_RESULT *result);
int registry_get(AGENT_REQUEST *request, AGENT_RESULT *result);
#endif
#ifdef _AIX
int system_stat(AGENT_REQUEST *request, AGENT_RESULT *result);
#endif
#endif /* ZABBIX_SYSINFO_H */
|