summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authoralex <alex@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2007-01-30 10:37:56 +0000
committeralex <alex@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2007-01-30 10:37:56 +0000
commitfbc8b79bea9d0fb7547b930ed382f98e7e083499 (patch)
tree18b24880333c8e02bec29d78bd938ba6bba7a485 /src
parent1e34b8021aaffb957079ea38549bf30c7622c265 (diff)
Improvement for WEB monitoring.
git-svn-id: svn://svn.zabbix.com/trunk@3770 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'src')
-rw-r--r--src/zabbix_server/httppoller/httptest.c53
-rw-r--r--src/zabbix_server/httppoller/httptest.h2
2 files changed, 53 insertions, 2 deletions
diff --git a/src/zabbix_server/httppoller/httptest.c b/src/zabbix_server/httppoller/httptest.c
index 59b9fce2..f37cef8f 100644
--- a/src/zabbix_server/httppoller/httptest.c
+++ b/src/zabbix_server/httppoller/httptest.c
@@ -110,16 +110,60 @@ static size_t HEADERFUNCTION2( void *ptr, size_t size, size_t nmemb, void *strea
return size*nmemb;
}
+static void process_test_data(DB_HTTPTEST *httptest, S_ZBX_HTTPSTAT *stat)
+{
+#ifdef HAVE_LIBCURL
+ DB_RESULT result;
+ DB_ROW row;
+ DB_HTTPTESTITEM httptestitem;
+
+ AGENT_RESULT value;
+
+ zabbix_log(LOG_LEVEL_WARNING, " TEST [%s]: Time %f Last step %d",
+ httptest->name, stat->test_total_time, stat->test_last_step);
+
+ result = DBselect("select httptestitemid,httptestid,itemid,type from httptestitem where httptestid=" ZBX_FS_UI64,
+ httptest->httptestid);
+
+ while((row=DBfetch(result)))
+ {
+ ZBX_STR2UINT64(httptestitem.httptestitemid, row[0]);
+ ZBX_STR2UINT64(httptestitem.httptestid, row[1]);
+ ZBX_STR2UINT64(httptestitem.itemid, row[2]);
+ httptestitem.type=atoi(row[3]);
+
+ switch (httptestitem.type) {
+ case ZBX_HTTPITEM_TYPE_TIME:
+ init_result(&value);
+ SET_DBL_RESULT(&value, stat->test_total_time);
+ process_value(httptestitem.itemid,&value);
+ free_result(&value);
+ break;
+ case ZBX_HTTPITEM_TYPE_LASTSTEP:
+ init_result(&value);
+ SET_UI64_RESULT(&value, stat->test_last_step);
+ process_value(httptestitem.itemid,&value);
+ free_result(&value);
+ break;
+ default:
+ break;
+ }
+ }
+
+ DBfree_result(result);
+#endif
+}
+
static void process_step_data(DB_HTTPTEST *httptest, DB_HTTPSTEP *httpstep, S_ZBX_HTTPSTAT *stat)
{
+#ifdef HAVE_LIBCURL
DB_RESULT result;
DB_ROW row;
DB_HTTPSTEPITEM httpstepitem;
AGENT_RESULT value;
-#ifdef HAVE_LIBCURL
zabbix_log(LOG_LEVEL_WARNING, " Step [%s] [%s]: Rsp %d Time %f Speed %f",
httpstep->name, httpstep->url, stat->rspcode, stat->total_time, stat->speed_download);
@@ -152,6 +196,8 @@ static void process_step_data(DB_HTTPTEST *httptest, DB_HTTPSTEP *httpstep, S_ZB
process_value(httpstepitem.itemid,&value);
free_result(&value);
break;
+ default:
+ break;
}
}
@@ -361,7 +407,10 @@ zabbix_log(LOG_LEVEL_ERR, "[%s]", page.data);
httptest->time,
httptest->httptestid);
-// process_test_data(httptest, httptest->time);
+ stat.test_total_time = httptest->time;
+ stat.test_last_step = lastfailedstep;
+
+ process_test_data(httptest, &stat);
zabbix_log(LOG_LEVEL_WARNING, "TOTAL: Time %f", httptest->time);
diff --git a/src/zabbix_server/httppoller/httptest.h b/src/zabbix_server/httppoller/httptest.h
index dc167f3b..933cacd1 100644
--- a/src/zabbix_server/httppoller/httptest.h
+++ b/src/zabbix_server/httppoller/httptest.h
@@ -34,6 +34,8 @@ S_ZBX_HTTPSTAT
long rspcode;
double total_time;
double speed_download;
+ double test_total_time;
+ int test_last_step;
};
void process_httptests(int now);