zabbix-agent2/src/zabbix_server/service/service_manager.c
/******************************************************************************
 *                                                                            *
 * Function: process_event_severities                                         *
 *                                                                            *
 * Purpose: update event severities, service statuses in cache and database   *
 *          according to the event severity changes during acknowledgment     *
 *                                                                            *
 ******************************************************************************/
process_event_severities

Purpose: update event severities, service statuses in cache and database
according to the event severity changes during acknowledgment
process_event_severities Purpose : update event severities service statuses in cache and database according to the event severity changes during acknowledgment
static void	process_event_severities(const zbx_ipc_message_t *message, zbx_service_manager_t *service_manager)
{
	zbx_vector_ptr_t	event_severities;
	int			i, j, severities_num;
	zabbix_log(LOG_LEVEL_DEBUG, "In %s() size:%u" , __func__, message->size);
	zbx_vector_ptr_create(&event_severities);
	zbx_service_deserialize_event_severities(message->data, &event_severities);
	severities_num = event_severities.values_num;
	if (SUCCEED != db_update_service_problems(&event_severities))
	{
		zabbix_log(LOG_LEVEL_WARNING, "cannot update service problem severities in database");
		goto out;
	}
	for (i = 0; i < event_severities.values_num; i++)
	{
		zbx_event_severity_t		*es = (zbx_event_severity_t *)event_severities.values[i];
		zbx_event_t			event_local = {.eventid = es->eventid}, *event = &event_local, **pevent;
		zbx_service_problem_index_t	*pi, pi_local;
		if (NULL == (pevent = (zbx_event_t **)zbx_hashset_search(&service_manager->problem_events, &event)))
			continue;
		(*pevent)->severity = es->severity;
		pi_local.eventid = es->eventid;
		if (NULL == (pi = zbx_hashset_search(&service_manager->service_problems_index, &pi_local)))
			continue;
		for (j = 0; j < pi->services.values_num; j++)
		{
			zbx_service_t	*service = (zbx_service_t *)pi->services.values[j];
			service_update_event_severity(service_manager, service, es->eventid, es->severity);
		}
	}
	db_update_services(service_manager);
out:
	zbx_vector_ptr_clear_ext(&event_severities, zbx_ptr_free);
	zbx_vector_ptr_destroy(&event_severities);
	zabbix_log(LOG_LEVEL_DEBUG, "End of %s() severities_num:%d", __func__, severities_num);
}
static void process_event_severities ( const zbx_ipc_message_t * message , zbx_service_manager_t * service_manager ) { zbx_vector_ptr_t event_severities ; int i , j , severities_num ; zabbix_log ( LOG_LEVEL_DEBUG , " " , __func__ , message -> size ) ; zbx_vector_ptr_create ( & event_severities ) ; zbx_service_deserialize_event_severities ( message -> data , & event_severities ) ; severities_num = event_severities . values_num ; if ( SUCCEED != db_update_service_problems ( & event_severities ) ) { zabbix_log ( LOG_LEVEL_WARNING , " " ) ; goto out ; } for ( i = 0 ; i < event_severities . values_num ; i ++ ) { zbx_event_severity_t * es = ( zbx_event_severity_t * ) event_severities . values [ i ] ; zbx_event_t event_local = { . eventid = es -> eventid } , * event = & event_local , * * pevent ; zbx_service_problem_index_t * pi , pi_local ; if ( NULL == ( pevent = ( zbx_event_t * * ) zbx_hashset_search ( & service_manager -> problem_events , & event ) ) ) continue ; ( * pevent ) -> severity = es -> severity ; pi_local . eventid = es -> eventid ; if ( NULL == ( pi = zbx_hashset_search ( & service_manager -> service_problems_index , & pi_local ) ) ) continue ; for ( j = 0 ; j < pi -> services . values_num ; j ++ ) { zbx_service_t * service = ( zbx_service_t * ) pi -> services . values [ j ] ; service_update_event_severity ( service_manager , service , es -> eventid , es -> severity ) ; } } db_update_services ( service_manager ) ; out : zbx_vector_ptr_clear_ext ( & event_severities , zbx_ptr_free ) ; zbx_vector_ptr_destroy ( & event_severities ) ; zabbix_log ( LOG_LEVEL_DEBUG , " " , __func__ , severities_num ) ; }
Function: process_event_severities                                         
                                                                            
 Purpose: update event severities, service statuses in cache and database   
          according to the event severity changes during acknowledgment
Function : process_event_severities Purpose : update event severities service statuses in cache and database according to the event severity changes during acknowledgment
/* update event severity in problem cache */ /* update event severities in service problems lists */