#include "audit/zbxaudit_graph.h"
#include "audit/zbxaudit.h"
static int graph_flag_to_resource_type(int flag)
if (ZBX_FLAG_DISCOVERY_NORMAL == flag || ZBX_FLAG_DISCOVERY_CREATED == flag)
return ZBX_AUDIT_RESOURCE_GRAPH;
else if (ZBX_FLAG_DISCOVERY_PROTOTYPE == flag)
return ZBX_AUDIT_RESOURCE_GRAPH_PROTOTYPE;
zabbix_log(LOG_LEVEL_CRIT, "unexpected audit graph flag detected: ->%d<-", flag);
THIS_SHOULD_NEVER_HAPPEN;
#define GR_OR_GRP(s) (ZBX_AUDIT_RESOURCE_GRAPH == resource_type) ? "graph."#s : "graphprototype."#s
void zbx_audit_graph_create_entry(int audit_context_mode, int audit_action, zbx_uint64_t graphid, const char *name,
zbx_audit_entry_t local_audit_graph_entry, **found_audit_graph_entry;
zbx_audit_entry_t *local_audit_graph_entry_x = &local_audit_graph_entry;
RETURN_IF_AUDIT_OFF(audit_context_mode);
resource_type = graph_flag_to_resource_type(flags);
local_audit_graph_entry.id = graphid;
local_audit_graph_entry.cuid = NULL;
local_audit_graph_entry.id_table = AUDIT_GRAPH_ID;
found_audit_graph_entry = (zbx_audit_entry_t**)zbx_hashset_search(zbx_get_audit_hashset(),
&(local_audit_graph_entry_x));
if (NULL == found_audit_graph_entry)
zbx_audit_entry_t *local_audit_graph_entry_insert;
local_audit_graph_entry_insert = zbx_audit_entry_init(graphid, AUDIT_GRAPH_ID, name, audit_action,
zbx_hashset_insert(zbx_get_audit_hashset(), &local_audit_graph_entry_insert,
sizeof(local_audit_graph_entry_insert));
if (ZBX_AUDIT_ACTION_ADD == audit_action)
zbx_audit_update_json_append_uint64(graphid, AUDIT_GRAPH_ID, AUDIT_DETAILS_ACTION_ADD,
GR_OR_GRP(graphid), graphid, "graphs", "graphid");
void zbx_audit_graph_update_json_add_data(int audit_context_mode, zbx_uint64_t graphid, const char *name, int width,
int height, double yaxismin, double yaxismax, zbx_uint64_t templateid, int show_work_period,
int show_triggers, int graphtype, int show_legend, int show_3d, double percent_left,
double percent_right, int ymin_type, int ymax_type, zbx_uint64_t ymin_itemid, zbx_uint64_t ymax_itemid,
char audit_key[AUDIT_DETAILS_KEY_LEN], audit_key_name[AUDIT_DETAILS_KEY_LEN],
audit_key_width[AUDIT_DETAILS_KEY_LEN], audit_key_height[AUDIT_DETAILS_KEY_LEN],
audit_key_yaxismin[AUDIT_DETAILS_KEY_LEN], audit_key_yaxismax[AUDIT_DETAILS_KEY_LEN],
audit_key_templateid[AUDIT_DETAILS_KEY_LEN], audit_key_show_work_period[AUDIT_DETAILS_KEY_LEN],
audit_key_show_triggers[AUDIT_DETAILS_KEY_LEN], audit_key_graphtype[AUDIT_DETAILS_KEY_LEN],
audit_key_show_legend[AUDIT_DETAILS_KEY_LEN], audit_key_show_3d[AUDIT_DETAILS_KEY_LEN],
audit_key_percent_left[AUDIT_DETAILS_KEY_LEN], audit_key_percent_right[AUDIT_DETAILS_KEY_LEN],