Welcome to mirror list, hosted at ThFree Co, Russian Federation.

sysinfo.h « zbxsysinfo « libs « src - github.com/zabbix/zabbix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7c2a2a59a820ddbd0547dc3a79bfb22e9a7d9da7 (plain)
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
/*
** 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

#endif /* ZABBIX_SYSINFO_H */