Exemplo n.º 1
0
int	process_events(void)
{
	const char	*__function_name = "process_events";

	size_t		i;

	zabbix_log(LOG_LEVEL_DEBUG, "In %s() events_num:" ZBX_FS_SIZE_T, __function_name, (zbx_fs_size_t)events_num);

	if (0 != events_num)
	{
		save_events();

		process_actions(events, events_num);

		for (i = 0; i < events_num; i++)
		{
			if (EVENT_SOURCE_TRIGGERS == events[i].source)
			{
				DBupdate_services(events[i].objectid, TRIGGER_VALUE_PROBLEM == events[i].value ?
						events[i].trigger.priority : 0, events[i].clock);
			}
		}

		clean_events();
	}

	zabbix_log(LOG_LEVEL_DEBUG, "End of %s()", __function_name);

	return (int)events_num;		/* performance metric */
}
Exemplo n.º 2
0
Arquivo: events.c Projeto: Shmuma/z
/******************************************************************************
 *                                                                            *
 * Function: process_event                                                    *
 *                                                                            *
 * Purpose: process new event                                                 *
 *                                                                            *
 * Parameters: event - event data (event.eventid - new event)                 *
 *                                                                            *
 * Return value: SUCCESS - event added                                        *
 *                                                                            *
 * Author: Alexei Vladishev                                                   *
 *                                                                            *
 * Comments: Cannot use action->userid as it may also be groupid              *
 *                                                                            *
 ******************************************************************************/
int	process_event(DB_EVENT *event)
{
	zabbix_log(LOG_LEVEL_DEBUG,"In process_event(eventid:" ZBX_FS_UI64 ",object:%d,objectid:" ZBX_FS_UI64 ")",
			event->eventid,
			event->object,
			event->objectid);

	add_trigger_info(event);

	event->eventid = DBadd_event_low_level (event->source, event->object, event->objectid, event->clock, event->value);

	if (event->source == EVENT_SOURCE_TRIGGERS)
		HFS_add_event (CONFIG_HFS_PATH, CONFIG_SERVER_SITE, event->eventid, event->objectid, 
			       event->clock, event->value, event->acknowledged, event->hostid);

	/* Cancel currently active alerts */
/*	if(event->value == TRIGGER_VALUE_FALSE || event->value == TRIGGER_VALUE_TRUE)
	{
		DBexecute("update alerts set retries=3,error='Trigger changed its status. Will not send repeats.' where triggerid=" ZBX_FS_UI64 " and repeats>0 and status=%d",
			event->triggerid, ALERT_STATUS_NOT_SENT);
	}*/

	if(event->skip_actions == 0)
	{
		process_actions(event);
	}

	if(event->value == TRIGGER_VALUE_TRUE)
	{
		DBupdate_services(event->objectid, event->trigger_priority);
	}
	else
	{
		DBupdate_services(event->objectid, 0);
	}

	free_trigger_info(event);

	zabbix_log(LOG_LEVEL_DEBUG,"End of process_event()");
	
	return SUCCEED;
}