zabbix-agent2/src/libs/zbxdbcache/dbconfig.c
/******************************************************************************
 *                                                                            *
 * Function: zbx_dc_requeue_unreachable_items                                 *
 *                                                                            *
 * Purpose: requeue unreachable items                                         *
 *                                                                            *
 * Parameters: itemids     - [IN] the item id array                           *
 *             itemids_num - [IN] the number of values in itemids array       *
 *                                                                            *
 * Comments: This function is used when items must be put back in the queue   *
 *           without polling them. For example if a poller has taken a batch  *
 *           of items from queue, host becomes unreachable during while       *
 *           polling the items, so the unpolled items of the same host must   *
 *           be returned to queue without updating their status.              *
 *                                                                            *
 ******************************************************************************/
zbx_dc_requeue_unreachable_items

Purpose: requeue unreachable items

Parameters: itemids     - [IN] the item id array
itemids_num - [IN] the number of values in itemids array

Comments: This function is used when items must be put back in the queue
without polling them. For example if a poller has taken a batch
of items from queue, host becomes unreachable during while
polling the items, so the unpolled items of the same host must
be returned to queue without updating their status.
zbx_dc_requeue_unreachable_items Purpose : requeue unreachable items Parameters : itemids - [ IN ] the item id array itemids_num - [ IN ] the number of values in itemids array Comments : This function is used when items must be put back in the queue without polling them . For example if a poller has taken a batch of items from queue host becomes unreachable during while polling the items so the unpolled items of the same host must be returned to queue without updating their status .
void	zbx_dc_requeue_unreachable_items(zbx_uint64_t *itemids, size_t itemids_num)
{
	size_t			i;
	ZBX_DC_ITEM		*dc_item;
	ZBX_DC_HOST		*dc_host;
	ZBX_DC_INTERFACE	*dc_interface;
	WRLOCK_CACHE;
	for (i = 0; i < itemids_num; i++)
	{
		if (NULL == (dc_item = (ZBX_DC_ITEM *)zbx_hashset_search(&config->items, &itemids[i])))
			continue;
		if (ZBX_LOC_POLLER == dc_item->location)
			dc_item->location = ZBX_LOC_NOWHERE;
		if (ITEM_STATUS_ACTIVE != dc_item->status)
			continue;
		if (NULL == (dc_host = (ZBX_DC_HOST *)zbx_hashset_search(&config->hosts, &dc_item->hostid)))
			continue;
		if (HOST_STATUS_MONITORED != dc_host->status)
			continue;
		dc_interface = (ZBX_DC_INTERFACE *)zbx_hashset_search(&config->interfaces, &dc_item->interfaceid);
		dc_requeue_item(dc_item, dc_host, dc_interface, ZBX_ITEM_COLLECTED | ZBX_HOST_UNREACHABLE,
				time(NULL));
	}
	UNLOCK_CACHE;
}
void zbx_dc_requeue_unreachable_items ( zbx_uint64_t * itemids , size_t itemids_num ) { size_t i ; ZBX_DC_ITEM * dc_item ; ZBX_DC_HOST * dc_host ; ZBX_DC_INTERFACE * dc_interface ; WRLOCK_CACHE ; for ( i = 0 ; i < itemids_num ; i ++ ) { if ( NULL == ( dc_item = ( ZBX_DC_ITEM * ) zbx_hashset_search ( & config -> items , & itemids [ i ] ) ) ) continue ; if ( ZBX_LOC_POLLER == dc_item -> location ) dc_item -> location = ZBX_LOC_NOWHERE ; if ( ITEM_STATUS_ACTIVE != dc_item -> status ) continue ; if ( NULL == ( dc_host = ( ZBX_DC_HOST * ) zbx_hashset_search ( & config -> hosts , & dc_item -> hostid ) ) ) continue ; if ( HOST_STATUS_MONITORED != dc_host -> status ) continue ; dc_interface = ( ZBX_DC_INTERFACE * ) zbx_hashset_search ( & config -> interfaces , & dc_item -> interfaceid ) ; dc_requeue_item ( dc_item , dc_host , dc_interface , ZBX_ITEM_COLLECTED | ZBX_HOST_UNREACHABLE , time ( NULL ) ) ; } UNLOCK_CACHE ; }
Function: zbx_dc_requeue_unreachable_items                                 
                                                                            
 Purpose: requeue unreachable items                                         
                                                                            
 Parameters: itemids     - [IN] the item id array                           
             itemids_num - [IN] the number of values in itemids array       
                                                                            
 Comments: This function is used when items must be put back in the queue   
           without polling them.
Function : zbx_dc_requeue_unreachable_items Purpose : requeue unreachable items Parameters : itemids - [ IN ] the item id array itemids_num - [ IN ] the number of values in itemids array Comments : This function is used when items must be put back in the queue without polling them .