--- zabbix-1.8.4/src/libs/zbxdbcache/dbconfig.c 2011-01-04 14:57:50.000000000 +0100 +++ zabbix-1.8.4-fellowtech/src/libs/zbxdbcache/dbconfig.c 2011-02-09 21:56:58.480167401 +0100 @@ -398,14 +398,53 @@ { ZBX_DC_HOST_PH *host_ph, host_ph_local; + zabbix_log(LOG_LEVEL_WARNING, "--- find host proxy_hostid=%d hostname=%s status=%d", proxy_hostid, hostname, HOST_STATUS_MONITORED); host_ph_local.proxy_hostid = proxy_hostid; host_ph_local.status = HOST_STATUS_MONITORED; host_ph_local.host = hostname; if (NULL == (host_ph = zbx_hashset_search(&config->hosts_ph, &host_ph_local))) + { + zabbix_log(LOG_LEVEL_WARNING, "--- find again host hostname=%s status=5", hostname); + host_ph_local.proxy_hostid = 0; + host_ph_local.status = 5; + host_ph_local.host = hostname; + + if (NULL == (host_ph = zbx_hashset_search(&config->hosts_ph, &host_ph_local))) + { + zabbix_log(LOG_LEVEL_WARNING, "--- second try failed"); + return NULL; + } + else + { + ZBX_DC_HOST *host; + zabbix_log(LOG_LEVEL_WARNING, "--- ok second try, proxy_host_id = %X", host_ph->host_ptr); + host = host_ph->host_ptr; + + zabbix_log(LOG_LEVEL_WARNING, "--- third try with proxy_hostid = %d", host->hostid); + + host_ph_local.proxy_hostid = host->hostid; + host_ph_local.status = HOST_STATUS_MONITORED; + host_ph_local.host = hostname; + if (NULL == (host_ph = zbx_hashset_search(&config->hosts_ph, &host_ph_local))) + { + zabbix_log(LOG_LEVEL_WARNING, "--- third try failed, giving up..."); + return NULL; + } + else + { + zabbix_log(LOG_LEVEL_WARNING, "--- third try success... year :-)"); + return host_ph->host_ptr; + } + } + zabbix_log(LOG_LEVEL_WARNING, "--- we do not get up to here..."); return NULL; + } else + { + zabbix_log(LOG_LEVEL_WARNING, "--- ok first try"); return host_ph->host_ptr; + } } static void DCstrpool_replace(int found, const char **curr, const char *new) @@ -1624,10 +1663,16 @@ LOCK_CACHE; if (NULL == (dc_host = DCfind_host(proxy_hostid, hostname))) + { + zabbix_log(LOG_LEVEL_WARNING, "--- get item by key, failed find_host"); goto unlock; + } if (NULL == (dc_item = DCfind_item(dc_host->hostid, key))) + { + zabbix_log(LOG_LEVEL_WARNING, "--- get item by key, failed find_item"); goto unlock; + } DCget_host(&item->host, dc_host); DCget_item(item, dc_item);