1 /*
2 ** Zabbix
3 ** Copyright (C) 2001-2021 Zabbix SIA
4 **
5 ** This program is free software; you can redistribute it and/or modify
6 ** it under the terms of the GNU General Public License as published by
7 ** the Free Software Foundation; either version 2 of the License, or
8 ** (at your option) any later version.
9 **
10 ** This program is distributed in the hope that it will be useful,
11 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ** GNU General Public License for more details.
14 **
15 ** You should have received a copy of the GNU General Public License
16 ** along with this program; if not, write to the Free Software
17 ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18 **/
19 
20 #ifndef ZABBIX_ZBXSELF_H
21 #define ZABBIX_ZBXSELF_H
22 
23 #define ZBX_PROCESS_STATE_IDLE		0
24 #define ZBX_PROCESS_STATE_BUSY		1
25 #define ZBX_PROCESS_STATE_COUNT		2	/* number of process states */
26 
27 #define ZBX_PROCESS_TYPE_POLLER		0
28 #define ZBX_PROCESS_TYPE_UNREACHABLE	1
29 #define ZBX_PROCESS_TYPE_IPMIPOLLER	2
30 #define ZBX_PROCESS_TYPE_PINGER		3
31 #define ZBX_PROCESS_TYPE_JAVAPOLLER	4
32 #define ZBX_PROCESS_TYPE_HTTPPOLLER	5
33 #define ZBX_PROCESS_TYPE_TRAPPER	6
34 #define ZBX_PROCESS_TYPE_SNMPTRAPPER	7
35 #define ZBX_PROCESS_TYPE_PROXYPOLLER	8
36 #define ZBX_PROCESS_TYPE_ESCALATOR	9
37 #define ZBX_PROCESS_TYPE_HISTSYNCER	10
38 #define ZBX_PROCESS_TYPE_DISCOVERER	11
39 #define ZBX_PROCESS_TYPE_ALERTER	12
40 #define ZBX_PROCESS_TYPE_TIMER		13
41 #define ZBX_PROCESS_TYPE_HOUSEKEEPER	14
42 #define ZBX_PROCESS_TYPE_WATCHDOG	15
43 #define ZBX_PROCESS_TYPE_DATASENDER	16
44 #define ZBX_PROCESS_TYPE_CONFSYNCER	17
45 #define ZBX_PROCESS_TYPE_HEARTBEAT	18
46 #define ZBX_PROCESS_TYPE_SELFMON	19
47 #define ZBX_PROCESS_TYPE_VMWARE		20
48 #define ZBX_PROCESS_TYPE_COLLECTOR	21
49 #define ZBX_PROCESS_TYPE_LISTENER	22
50 #define ZBX_PROCESS_TYPE_ACTIVE_CHECKS	23
51 #define ZBX_PROCESS_TYPE_COUNT		24	/* number of process types */
52 #define ZBX_PROCESS_TYPE_UNKNOWN	255
53 
54 #define ZBX_RTC_LOG_SCOPE_FLAG		0x80
55 #define ZBX_RTC_LOG_SCOPE_PROC		0
56 #define ZBX_RTC_LOG_SCOPE_PID		1
57 
58 #define ZBX_AGGR_FUNC_ONE		0
59 #define ZBX_AGGR_FUNC_AVG		1
60 #define ZBX_AGGR_FUNC_MAX		2
61 #define ZBX_AGGR_FUNC_MIN		3
62 
63 int		get_process_type_by_name(const char *proc_type_str);
64 int		get_process_type_forks(unsigned char process_type);
65 const char	*get_process_type_string(unsigned char process_type);
66 
67 #ifndef _WINDOWS
68 void		init_selfmon_collector(void);
69 void		free_selfmon_collector(void);
70 void		update_selfmon_counter(unsigned char state);
71 void		collect_selfmon_stats(void);
72 void		get_selfmon_stats(unsigned char process_type, unsigned char aggr_func, int process_num,
73 			unsigned char state, double *value);
74 void		zbx_sleep_loop(int sleeptime);
75 void		zbx_sleep_forever(void);
76 void		zbx_wakeup(void);
77 int		zbx_sleep_get_remainder(void);
78 void		zbx_set_sigusr_handler(void (*handler)(int flags));
79 #endif
80 
81 #endif	/* ZABBIX_ZBXSELF_H */
82