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_PREPROC_H 21 #define ZABBIX_PREPROC_H 22 23 #include "common.h" 24 #include "module.h" 25 #include "dbcache.h" 26 #include "zbxvariant.h" 27 28 /* preprocessing step execution result */ 29 typedef struct 30 { 31 zbx_variant_t value; 32 unsigned char action; 33 char *error; 34 } 35 zbx_preproc_result_t; 36 37 typedef struct 38 { 39 zbx_uint64_t itemid; 40 int values_num; 41 int steps_num; 42 } 43 zbx_preproc_item_stats_t; 44 45 /* the following functions are implemented differently for server and proxy */ 46 47 void zbx_preprocess_item_value(zbx_uint64_t itemid, zbx_uint64_t hostid, unsigned char item_value_type, unsigned char item_flags, 48 AGENT_RESULT *result, zbx_timespec_t *ts, unsigned char state, char *error); 49 void zbx_preprocessor_flush(void); 50 zbx_uint64_t zbx_preprocessor_get_queue_size(void); 51 52 void zbx_preproc_op_free(zbx_preproc_op_t *op); 53 void zbx_preproc_result_free(zbx_preproc_result_t *result); 54 55 int zbx_preprocessor_test(unsigned char value_type, const char *value, const zbx_timespec_t *ts, 56 const zbx_vector_ptr_t *steps, zbx_vector_ptr_t *results, zbx_vector_ptr_t *history, 57 char **preproc_error, char **error); 58 59 int zbx_preprocessor_get_diag_stats(int *total, int *queued, int *processing, int *done, 60 int *pending, char **error); 61 62 int zbx_preprocessor_get_top_items(int limit, zbx_vector_ptr_t *items, char **error); 63 int zbx_preprocessor_get_top_oldest_preproc_items(int limit, zbx_vector_ptr_t *items, char **error); 64 #endif /* ZABBIX_PREPROC_H */ 65