Ad Widget

Collapse

Version Pre 1.4.2 Build 4458: Web Step Timeouts

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Palmertree
    Senior Member
    • Sep 2005
    • 746

    #1

    Version Pre 1.4.2 Build 4458: Web Step Timeouts

    I found that the Web step timeouts where not working correctly. To fix this, I added 2 settings to the CURL function in the httptest.c file. From initial test, it seems to be working correctly. See additions below which are in red.

    if( !err_str )
    {
    zabbix_log(LOG_LEVEL_DEBUG, "WEBMonitor: Go to URL [%s]", httpstep.url);
    if(CURLE_OK != (err = curl_easy_setopt(easyhandle, CURLOPT_URL, httpstep.url)))
    {
    zabbix_log(LOG_LEVEL_ERR, "Cannot set URL [%s]",
    curl_easy_strerror(err));
    err_str = strdup(curl_easy_strerror(err));
    lastfailedstep = httpstep.no;
    }
    }
    if(CURLE_OK != (err = curl_easy_setopt(easyhandle, CURLOPT_TIMEOUT, httpstep.timeout)))
    {
    zabbix_log(LOG_LEVEL_ERR, "Cannot set URL [%s]", curl_easy_strerror(err));
    return FAIL;
    break;
    }

    if(CURLE_OK != (err = curl_easy_setopt(easyhandle, CURLOPT_CONNECTTIMEOUT, httpstep.timeout)))
    {
    zabbix_log(LOG_LEVEL_ERR, "Cannot set URL [%s]", curl_easy_strerror(err));
    return FAIL;
    break;
    }


    if( !err_str )
    {
    memset(&page, 0, sizeof(page));
    if(CURLE_OK != (err = curl_easy_perform(easyhandle)))
    {
    zabbix_log(LOG_LEVEL_ERR, "Error doing curl_easy_perform [%s]",
    curl_easy_strerror(err));
    err_str = strdup(curl_easy_strerror(err));
    lastfailedstep = httpstep.no;
    }
    else
    {
    Notes on libCURL Setting Variables:
    CURLOPT_TIMEOUT
    Pass a long as parameter containing the maximum time in
    seconds that you allow the libcurl transfer operation to
    take. Normally, name lookups can take a considerable
    time and limiting operations to less than a few minutes
    risk aborting perfectly normal operations. This option
    will cause curl to use the SIGALRM to enable time-outing
    system calls.


    CURLOPT_CONNECTTIMEOUT
    Pass a long. It should contain the maximum time in sec*
    onds that you allow the connection to the server to
    take. This only limits the connection phase, once it
    has connected, this option is of no more use. Set to
    zero to disable connection timeout (it will then only
    timeout on the system's internal timeouts). See also the
    CURLOPT_TIMEOUT option.
  • Alexei
    Founder, CEO
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Sep 2004
    • 5654

    #2
    Thanks for the patch. I don't remember why the CURLOPT_TIMEOUT was commented out in the original code though... Hmm, I will check this anyway.
    Alexei Vladishev
    Creator of Zabbix, Product manager
    New York | Tokyo | Riga
    My Twitter

    Comment

    • maxijose
      Member
      • May 2007
      • 36

      #3
      Thanks a lot, I'm waiting to see if it works

      Comment

      Working...