zabbix-agent2/src/zabbix_server/escalator/escalator.c
/******************************************************************************
 *                                                                            *
 * Function: add_ack_escalation_r_eventids                                    *
 *                                                                            *
 * Purpose: check if acknowledgement events of current escalation has related *
 *          recovery events and add those recovery event IDs to array of      *
 *          event IDs if this escalation                                      *
 *                                                                            *
 * Parameters: escalations - [IN] array of escalations to be processed        *
 *             eventids    - [OUT] array of events of current escalation      *
 *             event_pairs - [OUT] the array of event ID and recovery event   *
 *                                 pairs                                      *
 *                                                                            *
 * Comments: additionally acknowledgement event IDs are mapped with related   *
 *           recovery event IDs in get_db_eventid_r_eventid_pairs()           *
 *                                                                            *
 ******************************************************************************/
add_ack_escalation_r_eventids

Purpose: check if acknowledgement events of current escalation has related
recovery events and add those recovery event IDs to array of
event IDs if this escalation

Parameters: escalations - [IN] array of escalations to be processed
eventids    - [OUT] array of events of current escalation
event_pairs - [OUT] the array of event ID and recovery event
pairs

Comments: additionally acknowledgement event IDs are mapped with related
recovery event IDs in get_db_eventid_r_eventid_pairs()
add_ack_escalation_r_eventids Purpose : check if acknowledgement events of current escalation has related recovery events and add those recovery event IDs to array of event IDs if this escalation Parameters : escalations - [ IN ] array of escalations to be processed eventids - [ OUT ] array of events of current escalation event_pairs - [ OUT ] the array of event ID and recovery event pairs Comments : additionally acknowledgement event IDs are mapped with related recovery event IDs in get_db_eventid_r_eventid_pairs ()
static void	add_ack_escalation_r_eventids(zbx_vector_ptr_t *escalations, zbx_vector_uint64_t *eventids,
		zbx_vector_uint64_pair_t *event_pairs)
{
	int			i;
	zbx_vector_uint64_t	ack_eventids, r_eventids;
	zbx_vector_uint64_create(&ack_eventids);
	zbx_vector_uint64_create(&r_eventids);
	for (i = 0; i < escalations->values_num; i++)
	{
		DB_ESCALATION	*escalation;
		escalation = (DB_ESCALATION *)escalations->values[i];
		if (0 != escalation->acknowledgeid)
			zbx_vector_uint64_append(&ack_eventids, escalation->eventid);
	}
	if (0 < ack_eventids.values_num)
	{
		zbx_db_get_eventid_r_eventid_pairs(&ack_eventids, event_pairs, &r_eventids);
		if (0 < r_eventids.values_num)
			zbx_vector_uint64_append_array(eventids, r_eventids.values, r_eventids.values_num);
	}
	zbx_vector_uint64_destroy(&ack_eventids);
	zbx_vector_uint64_destroy(&r_eventids);
}
static void add_ack_escalation_r_eventids ( zbx_vector_ptr_t * escalations , zbx_vector_uint64_t * eventids , zbx_vector_uint64_pair_t * event_pairs ) { int i ; zbx_vector_uint64_t ack_eventids , r_eventids ; zbx_vector_uint64_create ( & ack_eventids ) ; zbx_vector_uint64_create ( & r_eventids ) ; for ( i = 0 ; i < escalations -> values_num ; i ++ ) { DB_ESCALATION * escalation ; escalation = ( DB_ESCALATION * ) escalations -> values [ i ] ; if ( 0 != escalation -> acknowledgeid ) zbx_vector_uint64_append ( & ack_eventids , escalation -> eventid ) ; } if ( 0 < ack_eventids . values_num ) { zbx_db_get_eventid_r_eventid_pairs ( & ack_eventids , event_pairs , & r_eventids ) ; if ( 0 < r_eventids . values_num ) zbx_vector_uint64_append_array ( eventids , r_eventids . values , r_eventids . values_num ) ; } zbx_vector_uint64_destroy ( & ack_eventids ) ; zbx_vector_uint64_destroy ( & r_eventids ) ; }
Function: add_ack_escalation_r_eventids                                    
                                                                            
 Purpose: check if acknowledgement events of current escalation has related 
          recovery events and add those recovery event IDs to array of      
          event IDs if this escalation                                      
                                                                            
 Parameters: escalations - [IN] array of escalations to be processed        
             eventids    - [OUT] array of events of current escalation      
             event_pairs - [OUT] the array of event ID and recovery event   
                                 pairs                                      
                                                                            
 Comments: additionally acknowledgement event IDs are mapped with related   
           recovery event IDs in get_db_eventid_r_eventid_pairs()
Function : add_ack_escalation_r_eventids Purpose : check if acknowledgement events of current escalation has related recovery events and add those recovery event IDs to array of event IDs if this escalation Parameters : escalations - [ IN ] array of escalations to be processed eventids - [ OUT ] array of events of current escalation event_pairs - [ OUT ] the array of event ID and recovery event pairs Comments : additionally acknowledgement event IDs are mapped with related recovery event IDs in get_db_eventid_r_eventid_pairs ()