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_ACTIVE_H
21 #define ZABBIX_ACTIVE_H
22 
23 #include "threads.h"
24 
25 extern char	*CONFIG_SOURCE_IP;
26 extern char	*CONFIG_HOSTNAME;
27 extern char	*CONFIG_HOST_METADATA;
28 extern char	*CONFIG_HOST_METADATA_ITEM;
29 extern char	*CONFIG_HOST_INTERFACE;
30 extern char	*CONFIG_HOST_INTERFACE_ITEM;
31 extern int	CONFIG_REFRESH_ACTIVE_CHECKS;
32 extern int	CONFIG_BUFFER_SEND;
33 extern int	CONFIG_BUFFER_SIZE;
34 extern int	CONFIG_MAX_LINES_PER_SECOND;
35 extern char	*CONFIG_LISTEN_IP;
36 extern int	CONFIG_LISTEN_PORT;
37 
38 #define HOST_METADATA_LEN	255	/* UTF-8 characters, not bytes */
39 #define HOST_INTERFACE_LEN	255	/* UTF-8 characters, not bytes */
40 
41 typedef struct
42 {
43 	char		*host;
44 	unsigned short	port;
45 }
46 ZBX_THREAD_ACTIVECHK_ARGS;
47 
48 typedef struct
49 {
50 	char		*host;
51 	char		*key;
52 	char		*value;
53 	unsigned char	state;
54 	zbx_uint64_t	lastlogsize;
55 	int		timestamp;
56 	char		*source;
57 	int		severity;
58 	zbx_timespec_t	ts;
59 	int		logeventid;
60 	int		mtime;
61 	unsigned char	flags;
62 	zbx_uint64_t	id;
63 }
64 ZBX_ACTIVE_BUFFER_ELEMENT;
65 
66 typedef struct
67 {
68 	ZBX_ACTIVE_BUFFER_ELEMENT	*data;
69 	int				count;
70 	int				pcount;
71 	int				lastsent;
72 	int				first_error;
73 }
74 ZBX_ACTIVE_BUFFER;
75 
76 ZBX_THREAD_ENTRY(active_checks_thread, args);
77 
78 #endif	/* ZABBIX_ACTIVE_H */
79