New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple Destinations for write_http plugin not working #821

Closed
beanieboi opened this Issue Nov 24, 2014 · 4 comments

Comments

Projects
None yet
2 participants
@beanieboi

beanieboi commented Nov 24, 2014

Hey,

we encounter some problems with multiple (2) destinations for the write_http plugin.
according to the documentation, you have to specify a URL block for each destination.
Each destination you want to post data to needs to have one URL block

This is our custom configuration in /etc/collectd/collectd.conf.d/custom.conf

LoadPlugin "write_http"
LoadPlugin "ping"

<Plugin ping>
  Host "google.com"
</Plugin>

<Plugin "write_http">
  <URL "https://custom-metrics.com/api/v1/metrics">
   Format "JSON"
   User "user"
   Password "password"
  </URL>

  <URL "https://collectd.librato.com/v1/measurements">
    Format "JSON"
    User "user"
    Password "password"
  </URL>
</Plugin>

our collectd version (using official Ubuntu trusty Pacakge):

ii  collectd                         5.4.0-3ubuntu2                   amd64        statistics collection and monitoring daemon
ii  collectd-core                    5.4.0-3ubuntu2                   amd64        statistics collection and monitoring daemon (core system)

Using only 1 URL block works for both configurations independently. Configuring 2 URLs only sends the metrics to the URL configured last.

we see the following line twice in the syslog after starting collectd.

plugin: register_callback: a callback named 'write_http' already exists - overwriting the old entry!

What is the correct way to specify multiple destinations for the writte_http plugin?

thanks for your help.

@mfournier

This comment has been minimized.

Show comment
Hide comment
@mfournier

mfournier Jan 17, 2015

Contributor

@beanieboi, I can confirm this issue. It seems this plugin was forgotten when migrating from the 4.x to the 5.x way of sending data to concurrent destinations.

So your usage of the plugin is correct but I'm afraid there's no real workaround. The good news is that it should be fairly easy to fix.

Contributor

mfournier commented Jan 17, 2015

@beanieboi, I can confirm this issue. It seems this plugin was forgotten when migrating from the 4.x to the 5.x way of sending data to concurrent destinations.

So your usage of the plugin is correct but I'm afraid there's no real workaround. The good news is that it should be fairly easy to fix.

@mfournier mfournier added the Bug label Jan 17, 2015

@mfournier mfournier self-assigned this Jan 17, 2015

@beanieboi

This comment has been minimized.

Show comment
Hide comment
@beanieboi

beanieboi Jan 17, 2015

Cool! Is there anything I can help with?

beanieboi commented Jan 17, 2015

Cool! Is there anything I can help with?

mfournier added a commit to mfournier/collectd that referenced this issue Jan 17, 2015

write_http: make callback names context-dependent
This allows multiple destinations to work again (fixes #821), using the
same logic as other write plugins.

The callback name would now be something like:
    `write_http/http://example.com/endpoint`
which is not very nice.

The next step would be to change this plugin to use `<Node>` blocks
like many others, and pass the URL as a parameter inside each instance
block. So I see this patch as the minimum required to let 5.3 and 5.4
users use this plugin with multiple destinations.
@mfournier

This comment has been minimized.

Show comment
Hide comment
@mfournier

mfournier Jan 17, 2015

Contributor

@beanieboi yes, if you have a way to test the patch referenced above with your setup, it would be great !

NB: the patch is against collectd-5.3. It applies fine on collectd-5.4.0 though. Use whatever version is more convenient for you, write_http.c is exactly the same in both.

Let me know if you need help building from the source code !

Contributor

mfournier commented Jan 17, 2015

@beanieboi yes, if you have a way to test the patch referenced above with your setup, it would be great !

NB: the patch is against collectd-5.3. It applies fine on collectd-5.4.0 though. Use whatever version is more convenient for you, write_http.c is exactly the same in both.

Let me know if you need help building from the source code !

@mfournier

This comment has been minimized.

Show comment
Hide comment
@mfournier

mfournier Jan 20, 2015

Contributor

@beanieboi, also take a look at #902, which is IMHO the proper way to move forward with this plugin.

Contributor

mfournier commented Jan 20, 2015

@beanieboi, also take a look at #902, which is IMHO the proper way to move forward with this plugin.

@mfournier mfournier closed this in bc29180 Feb 2, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment