Code

collectd.conf(5): Document the per-plugin interval configuration.
[collectd.git] / src / curl.c
index a533e147b1b6e2af1dcf00ff7634667b20bf4784..16de82216e810927e12d4aa71a8b2bda0d93099b 100644 (file)
@@ -370,6 +370,7 @@ static int cc_page_init_curl (web_page_t *wp) /* {{{ */
     return (-1);
   }
 
+  curl_easy_setopt (wp->curl, CURLOPT_NOSIGNAL, 1);
   curl_easy_setopt (wp->curl, CURLOPT_WRITEFUNCTION, cc_curl_callback);
   curl_easy_setopt (wp->curl, CURLOPT_WRITEDATA, wp);
   curl_easy_setopt (wp->curl, CURLOPT_USERAGENT,
@@ -571,13 +572,12 @@ static void cc_submit (const web_page_t *wp, const web_match_t *wm, /* {{{ */
     const cu_match_value_t *mv)
 {
   value_t values[1];
-  value_list_t vl = VALUE_LIST_INIT;
+  value_list_t vl = VALUE_LIST_INIT (plugin_interval);
 
   values[0] = mv->value;
 
   vl.values = values;
   vl.values_len = 1;
-  vl.time = time (NULL);
   sstrncpy (vl.host, hostname_g, sizeof (vl.host));
   sstrncpy (vl.plugin, "curl", sizeof (vl.plugin));
   sstrncpy (vl.plugin_instance, wp->instance, sizeof (vl.plugin_instance));
@@ -590,13 +590,12 @@ static void cc_submit (const web_page_t *wp, const web_match_t *wm, /* {{{ */
 static void cc_submit_response_time (const web_page_t *wp, double seconds) /* {{{ */
 {
   value_t values[1];
-  value_list_t vl = VALUE_LIST_INIT;
+  value_list_t vl = VALUE_LIST_INIT (plugin_interval);
 
   values[0].gauge = seconds;
 
   vl.values = values;
   vl.values_len = 1;
-  vl.time = time (NULL);
   sstrncpy (vl.host, hostname_g, sizeof (vl.host));
   sstrncpy (vl.plugin, "curl", sizeof (vl.plugin));
   sstrncpy (vl.plugin_instance, wp->instance, sizeof (vl.plugin_instance));
@@ -674,11 +673,13 @@ static int cc_shutdown (void) /* {{{ */
   return (0);
 } /* }}} int cc_shutdown */
 
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
 {
+  PLUGIN_INIT_INTERVAL (data);
+
   plugin_register_complex_config ("curl", cc_config);
   plugin_register_init ("curl", cc_init);
-  plugin_register_read ("curl", cc_read);
+  plugin_register_read ("curl", cc_read, plugin_interval);
   plugin_register_shutdown ("curl", cc_shutdown);
 } /* void module_register */