summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 60dd66c)
raw | patch | inline | side by side (parent: 60dd66c)
author | Pavel Rochnyack <pavel2000@ngs.ru> | |
Wed, 4 Oct 2017 16:35:58 +0000 (23:35 +0700) | ||
committer | Pavel Rochnyack <pavel2000@ngs.ru> | |
Wed, 4 Oct 2017 16:35:58 +0000 (23:35 +0700) |
src/collectd.conf.pod | patch | blob | history | |
src/curl_xml.c | patch | blob | history |
diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod
index 51cea1156e85c15013dff8240a9b91c393ff4b92..3fa91596d5831ee165f2d269796ce2ffcc64bc1c 100644 (file)
--- a/src/collectd.conf.pod
+++ b/src/collectd.conf.pod
@@ -1902,6 +1902,7 @@ The B<curl_xml plugin> uses B<libcurl> (L<http://curl.haxx.se/>) and B<libxml2>
Type "magic_level"
#InstancePrefix "prefix-"
InstanceFrom "td[1]"
+ #PluginInstanceFrom "td[1]"
ValuesFrom "td[2]/span[@class=\"level\"]"
</XPath>
</URL>
diff --git a/src/curl_xml.c b/src/curl_xml.c
index 8931407b027af47c85c200ca9275c084d89aa32f..f5a29b0fa80bdeb225f0f89c60103f3db705716b 100644 (file)
--- a/src/curl_xml.c
+++ b/src/curl_xml.c
while (le != NULL) {
llentry_t *le_next = le->next;
+ /* this also frees xpath->path used for le->key */
cx_xpath_free(le->value);
le = le_next;
}
llist_destroy(list);
-} /* }}} void cx_list_free */
+} /* }}} void cx_xpath_list_free */
static void cx_free(void *arg) /* {{{ */
{
if (tmp_size == 0) {
WARNING("curl_xml plugin: "
- "relative xpath expression \"%s\" %sdoesn't match "
+ "relative xpath expression \"%s\" from '%s' doesn't match "
"any of the nodes.",
- expr, (from_option == NULL) ? "" : from_option);
+ expr, from_option);
xmlXPathFreeObject(values_node_obj);
return NULL;
}
if (tmp_size > 1) {
WARNING("curl_xml plugin: "
- "relative xpath expression \"%s\" %sis expected to return "
+ "relative xpath expression \"%s\" from '%s' is expected to return "
"only one text node. Skipping the node.",
- expr, (from_option == NULL) ? "" : from_option);
+ expr, from_option);
xmlXPathFreeObject(values_node_obj);
return NULL;
}
/* ignoring the element if other than textnode/attribute*/
if (cx_if_not_text_node(values_node->nodeTab[0])) {
WARNING("curl_xml plugin: "
- "relative xpath expression \"%s\" %sis expected to return "
+ "relative xpath expression \"%s\" from '%s' is expected to return "
"only text/attribute node which is not the case. "
"Skipping the node.",
- expr, (from_option == NULL) ? "" : from_option);
+ expr, from_option);
xmlXPathFreeObject(values_node_obj);
return NULL;
}
value_list_t *vl, int index) {
char *node_value = cx_get_text_node_value(
- xpath_ctx, xpath->values[index].path, "from 'ValuesFrom' ");
+ xpath_ctx, xpath->values[index].path, "ValuesFrom");
if (node_value == NULL)
return -1;
/* Handle type instance */
if (xpath->instance != NULL) {
- char *node_value = cx_get_text_node_value(xpath_ctx, xpath->instance,
- "from 'InstanceFrom' ");
+ char *node_value =
+ cx_get_text_node_value(xpath_ctx, xpath->instance, "InstanceFrom");
if (node_value == NULL)
return -1;
/* Handle plugin instance */
if (xpath->plugin_instance_from != NULL) {
char *node_value = cx_get_text_node_value(
- xpath_ctx, xpath->plugin_instance_from, "from 'PluginInstanceFrom' ");
+ xpath_ctx, xpath->plugin_instance_from, "PluginInstanceFrom");
if (node_value == NULL)
return -1;
"since the base xpath expression \"%s\" "
"returned multiple results. Skipping the xpath block...",
xpath->path);
+ xmlXPathFreeObject(base_node_obj);
return -1;
}