zabbix-agent2/src/zabbix_server/alerter/alert_manager.c
/******************************************************************************
 *                                                                            *
 * Function: zbx_am_update_webhook                                            *
 *                                                                            *
 * Purpose: updates additional webhook media type fields                      *
 *                                                                            *
 ******************************************************************************/
zbx_am_update_webhook

Purpose: updates additional webhook media type fields
zbx_am_update_webhook Purpose : updates additional webhook media type fields
static void	zbx_am_update_webhook(zbx_am_t *manager, zbx_am_mediatype_t *mediatype, const char *script,
		const char *timeout)
{
	if (FAIL == is_time_suffix(timeout, &mediatype->timeout, ZBX_LENGTH_UNLIMITED))
	{
		mediatype->error = zbx_strdup(mediatype->error, "Invalid timeout value in media type configuration.");
		return;
	}
	if (NULL == mediatype->script || 0 != strcmp(mediatype->script, script))
	{
		if (SUCCEED != zbx_es_is_env_initialized(&manager->es))
		{
			if (SUCCEED != zbx_es_init_env(&manager->es, &mediatype->error))
				return;
		}
		zbx_free(mediatype->script_bin);
		if (SUCCEED != zbx_es_compile(&manager->es, script, &mediatype->script_bin, &mediatype->script_bin_sz,
				&mediatype->error))
		{
			return;
		}
		mediatype->script = zbx_strdup(mediatype->script, script);
	}
}
static void zbx_am_update_webhook ( zbx_am_t * manager , zbx_am_mediatype_t * mediatype , const char * script , const char * timeout ) { if ( FAIL == is_time_suffix ( timeout , & mediatype -> timeout , ZBX_LENGTH_UNLIMITED ) ) { mediatype -> error = zbx_strdup ( mediatype -> error , " " ) ; return ; } if ( NULL == mediatype -> script || 0 != strcmp ( mediatype -> script , script ) ) { if ( SUCCEED != zbx_es_is_env_initialized ( & manager -> es ) ) { if ( SUCCEED != zbx_es_init_env ( & manager -> es , & mediatype -> error ) ) return ; } zbx_free ( mediatype -> script_bin ) ; if ( SUCCEED != zbx_es_compile ( & manager -> es , script , & mediatype -> script_bin , & mediatype -> script_bin_sz , & mediatype -> error ) ) { return ; } mediatype -> script = zbx_strdup ( mediatype -> script , script ) ; } }
Function: zbx_am_update_webhook                                            
                                                                            
 Purpose: updates additional webhook media type fields
Function : zbx_am_update_webhook Purpose : updates additional webhook media type fields