summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d76b962)
raw | patch | inline | side by side (parent: d76b962)
author | Sebastian Harl <sh@tokkee.org> | |
Mon, 30 May 2016 21:23:59 +0000 (23:23 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Fri, 10 Jun 2016 19:04:49 +0000 (21:04 +0200) |
diff --git a/src/curl.c b/src/curl.c
index 6377780cc255d0fb54760d144bccc09dc233b7ab..cf2e816b8cade4afbc71efd8bf09c3c4aabe4e33 100644 (file)
--- a/src/curl.c
+++ b/src/curl.c
if (wp->response_time)
cc_submit_response_time (wp, cdtime() - start);
if (wp->stats != NULL)
- curl_stats_dispatch (wp->stats, wp->curl, hostname_g, "curl", wp->instance, NULL);
+ curl_stats_dispatch (wp->stats, wp->curl, hostname_g, "curl", wp->instance);
if(wp->response_code)
{
diff --git a/src/curl_json.c b/src/curl_json.c
index 1cf6381ab403ebac37a4deb8310685b12b543a0f..deb8b6e91e5b7c26dad9dc36bf93f0e8111b3161 100644 (file)
--- a/src/curl_json.c
+++ b/src/curl_json.c
return (-1);
}
if (db->stats != NULL)
- curl_stats_dispatch (db->stats, db->curl, cj_host (db), "curl_json", db->instance, NULL);
+ curl_stats_dispatch (db->stats, db->curl, cj_host (db), "curl_json", db->instance);
curl_easy_getinfo(db->curl, CURLINFO_EFFECTIVE_URL, &url);
curl_easy_getinfo(db->curl, CURLINFO_RESPONSE_CODE, &rc);
diff --git a/src/curl_xml.c b/src/curl_xml.c
index 21e09252a376022eb9743ffdc39d2f4d86e37e4d..00a980cf3368d6cdb8c5fea6fde6a273cbffd58e 100644 (file)
--- a/src/curl_xml.c
+++ b/src/curl_xml.c
return (-1);
}
if (db->stats != NULL)
- curl_stats_dispatch (db->stats, db->curl, cx_host (db), "curl_xml", db->instance, NULL);
+ curl_stats_dispatch (db->stats, db->curl, cx_host (db), "curl_xml", db->instance);
curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &url);
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &rc);
diff --git a/src/utils_curl_stats.c b/src/utils_curl_stats.c
index b242a239b6f667d61b1c8aeae92805e51a51bfec..0f2f56ead539bd0b12d7458d6948afb19cea1546 100644 (file)
--- a/src/utils_curl_stats.c
+++ b/src/utils_curl_stats.c
}
if ((c->values_num != 1)
- || ((c->values[0].type != OCONFIG_TYPE_STRING)
- && (c->values[0].type != OCONFIG_TYPE_BOOLEAN))) {
+ || (c->values[0].type != OCONFIG_TYPE_BOOLEAN)) {
ERROR ("curl stats: `%s' expects a single boolean argument", c->key);
free (s);
return NULL;
}
- if (((c->values[0].type == OCONFIG_TYPE_STRING)
- && IS_TRUE (c->values[0].value.string))
- || ((c->values[0].type == OCONFIG_TYPE_BOOLEAN)
- && c->values[0].value.boolean))
+ if (c->values[0].value.boolean)
enable_field (s, field_specs[field].offset);
}
} /* curl_stats_destroy */
int curl_stats_dispatch (curl_stats_t *s, CURL *curl,
- const char *hostname, const char *plugin, const char *plugin_instance,
- const char *instance_prefix)
+ const char *hostname, const char *plugin, const char *plugin_instance)
{
value_list_t vl = VALUE_LIST_INIT;
size_t field;
if (s == NULL)
return 0;
- if (curl == NULL)
+ if ((curl == NULL) || (hostname == NULL) || (plugin == NULL))
+ {
+ ERROR ("curl stats: dispatch() called with missing arguments "
+ "(curl=%p; hostname=%s; plugin=%s)", curl,
+ hostname == NULL ? "<NULL>" : hostname,
+ plugin == NULL ? "<NULL>" : plugin);
return -1;
+ }
- if (hostname != NULL)
- sstrncpy (vl.host, hostname, sizeof (vl.host));
- if (plugin != NULL)
- sstrncpy (vl.plugin, plugin, sizeof (vl.plugin));
+ sstrncpy (vl.host, hostname, sizeof (vl.host));
+ sstrncpy (vl.plugin, plugin, sizeof (vl.plugin));
if (plugin_instance != NULL)
sstrncpy (vl.plugin_instance, plugin_instance, sizeof (vl.plugin_instance));
continue;
sstrncpy (vl.type, field_specs[field].type, sizeof (vl.type));
- ssnprintf (vl.type_instance, sizeof (vl.type_instance), "%s%s",
- instance_prefix ? instance_prefix : "", field_specs[field].name);
+ sstrncpy (vl.type_instance, field_specs[field].name, sizeof (vl.type_instance));
vl.values = NULL;
vl.values_len = 0;
diff --git a/src/utils_curl_stats.h b/src/utils_curl_stats.h
index ef9256053bb7d04e0caa8c86b1baa0d11c24a8c4..69927f77cffd6688998d6b207dc380dcd2308cc1 100644 (file)
--- a/src/utils_curl_stats.h
+++ b/src/utils_curl_stats.h
* cURL session to the daemon.
*/
int curl_stats_dispatch (curl_stats_t *s, CURL *curl,
- const char *hostname, const char *plugin, const char *plugin_instance,
- const char *instance_prefix);
+ const char *hostname, const char *plugin, const char *plugin_instance);
#endif /* UTILS_CURL_STATS_H */