zabbix-agent2/src/libs/zbxhistory/history.c
/************************************************************************************
 *                                                                                  *
 * Function: zbx_history_init                                                       *
 *                                                                                  *
 * Purpose: initializes history storage                                             *
 *                                                                                  *
 * Comments: History interfaces are created for all values types based on           *
 *           configuration. Every value type can have different history storage     *
 *           backend.                                                               *
 *                                                                                  *
 ************************************************************************************/
zbx_history_init

Purpose: initializes history storage

Comments: History interfaces are created for all values types based on
configuration. Every value type can have different history storage
backend.
zbx_history_init Purpose : initializes history storage Comments : History interfaces are created for all values types based on configuration . Every value type can have different history storage backend .
int	zbx_history_init(char **error)
{
	int		i, ret;
	const char	*opts[] = {"dbl", "str", "log", "uint", "text"};
	for (i = 0; i < ITEM_VALUE_TYPE_MAX; i++)
	{
		if (NULL == CONFIG_HISTORY_STORAGE_URL || NULL == strstr(CONFIG_HISTORY_STORAGE_OPTS, opts[i]))
			ret = zbx_history_sql_init(&history_ifaces[i], i, error);
		else
			ret = zbx_history_elastic_init(&history_ifaces[i], i, error);
		if (FAIL == ret)
			return FAIL;
	}
	return SUCCEED;
}
int zbx_history_init ( char * * error ) { int i , ret ; const char * opts [ ] = { " " , " " , " " , " " , " " } ; for ( i = 0 ; i < ITEM_VALUE_TYPE_MAX ; i ++ ) { if ( NULL == CONFIG_HISTORY_STORAGE_URL || NULL == strstr ( CONFIG_HISTORY_STORAGE_OPTS , opts [ i ] ) ) ret = zbx_history_sql_init ( & history_ifaces [ i ] , i , error ) ; else ret = zbx_history_elastic_init ( & history_ifaces [ i ] , i , error ) ; if ( FAIL == ret ) return FAIL ; } return SUCCEED ; }
Function: zbx_history_init                                                       
                                                                                  
 Purpose: initializes history storage                                             
                                                                                  
 Comments: History interfaces are created for all values types based on           
           configuration.
Function : zbx_history_init Purpose : initializes history storage Comments : History interfaces are created for all values types based on configuration .
/* TODO: support per value type specific configuration */