Monitoring external web scenario’s behind a http proxy with zabbix.
It’s ugly, very ugly. But it’s quick.
If you want to use zabbix to be able to monitor web scenarios through a proxy you need to hack the source, since the latest version (1.6.2) has no other option to specify a proxy to connect through using configuration parameters.
Take a look at httptest.c in src/zabbix_server/httppoller around line 262 you will find the process_httptest function. I added the proxy at line 297 and I hardcode (yuck) it into the code. Please don’t use this hack in production environments.
262 static void process_httptest(DB_HTTPTEST *httptest)
263 {
264 DB_RESULT result;
265 DB_ROW row;
266 DB_HTTPSTEP httpstep;
267 int err;
268 char *err_str = NULL, *esc_err_str = NULL;
269 int now;
270 int lastfailedstep;
271
272 S_ZBX_HTTPSTAT stat;
273 double speed_download = 0;
274 int speed_download_num = 0;
275
276 CURL *easyhandle = NULL;
277
278 INIT_CHECK_MEMORY();
279
280 zabbix_log(LOG_LEVEL_DEBUG, "In process_httptest(httptestid:" ZBX_FS_UI64 ",name:%s)",
281 httptest->httptestid,
282 httptest->name);
283
284 now = time(NULL);
285
286 DBexecute("update httptest set lastcheck=%d where httptestid=" ZBX_FS_UI64,
287 now,
288 httptest->httptestid);
289
290 easyhandle = curl_easy_init();
291 if(easyhandle == NULL)
292 {
293 zabbix_log(LOG_LEVEL_ERR, "Cannot init CURL");
294
295 return;
296 }
297 curl_easy_setopt(easyhandle,CURLOPT_PROXY, "http://proxy.company.nl:8080");
298 if(CURLE_OK != (err = curl_easy_setopt(easyhandle, CURLOPT_COOKIEFILE, "")))
299 {
300 zabbix_log(LOG_LEVEL_ERR, "Cannot set CURLOPT_COOKIEFILE [%s]",
301 curl_easy_strerror(err));
302 (void)curl_easy_cleanup(easyhandle);
303 return;
304 }
No related posts.
Related posts brought to you by Yet Another Related Posts Plugin.
Comments are closed
Comments are currently closed on this entry.