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_ACTIONS_H
21 #define ZABBIX_ACTIONS_H
22 
23 #include "common.h"
24 #include "db.h"
25 
26 #define ZBX_ACTION_RECOVERY_NONE	0
27 #define ZBX_ACTION_RECOVERY_OPERATIONS	1
28 
29 typedef struct
30 {
31 	zbx_uint64_t	eventid;
32 	zbx_uint64_t	acknowledgeid;
33 	zbx_uint64_t	taskid;
34 }
35 zbx_ack_task_t;
36 
37 typedef struct
38 {
39 	zbx_uint64_t	taskid;
40 	zbx_uint64_t	actionid;
41 	zbx_uint64_t	eventid;
42 	zbx_uint64_t	triggerid;
43 	zbx_uint64_t	acknowledgeid;
44 }
45 zbx_ack_escalation_t;
46 
47 typedef struct
48 {
49 	zbx_uint64_t			conditionid;
50 	zbx_uint64_t			actionid;
51 	char				*value;
52 	char				*value2;
53 	unsigned char			conditiontype;
54 	unsigned char			op;
55 	zbx_vector_uint64_t		eventids;
56 }
57 zbx_condition_t;
58 
59 int	check_action_condition(const DB_EVENT *event, zbx_condition_t *condition);
60 void	process_actions(const zbx_vector_ptr_t *events, const zbx_vector_uint64_pair_t *closed_events);
61 int	process_actions_by_acknowledgements(const zbx_vector_ptr_t *ack_tasks);
62 void	get_db_actions_info(zbx_vector_uint64_t *actionids, zbx_vector_ptr_t *actions);
63 void	free_db_action(DB_ACTION *action);
64 
65 #endif
66