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
write_sensu plugin implementation #912
Conversation
Is there a way how to test this plugin with collectd-5.1.0 installed from rpmforge (http://apt.sw.be/redhat/el6/en/x86_64/testing/RPMS/)? |
@jtyr, yes, something close to this should do the trick: Keep in mind that Please give us some feedback about this plugin once you've succeeded getting it to work ! Thanks ! |
Thanks for the compilation command. I have tested it a bit and works just fine. Only when I forgot to define handlers (
I think it would be nice to catch this exception and print some human-readable message, it that's possible to do from the plugin. |
I have one more question. When the |
770cb2e
to
c68d8b3
Compare
@jtyr Fixed the bug with empty |
@jtyr yes this is the notification drawback with that toolchain. if |
I can confirm that the module do not fail when there is no We use CollectD in a very similar setup to yours. We collect metrics by CollectD and store them in InfluxdDB via We also use the Let's say we have a threshold which starts alerting and we find out that it needs to be changed. We go and set the threshold to a value that doesn't alert, we restart collectd to load the new config and as it doesn't send That could be fixed by adding a new option (e.g. What do you think about the |
@jtyr Thanks for confirming. Nice setup too :) For the case you mention you need only change the |
I believe that the Let's say we have a metric with a value of 82 and the following threshold applied to it before
When we change the threshold to the following (assuming the metric value did not change):
and we restart the |
@jtyr I see what you mean now. But wouldn't starting with |
The Regarding the situation where the state of the metric did not change during the restart is that if the metric is still in alerting state, |
@jtyr sorry for the confusion, I understand now. Yup, that would work, and for all plugins too. |
Exactly. I think that the implementation should not be that difficult. I think that it requires to change:
to:
where the |
@jtyr from what I understand, you'd need the threshold plugin to unconditionnally send "OK" values once at startup ? This feels conceptually wrong to me. Does it actually make this plugin unusable ? Or is it one specific setup which has annoying side effects ? |
@mfournier The |
@fabricemarie Please could you make the metrics sending optional? For my use case I would like to send only notifications but no metrics. If you could add option like |
…nt TCP socket. Inspired from write_riemann.
c68d8b3
to
f85010e
Compare
@jtyr I've made the modifications you requested and rebased it at the same time. Could you please test it and see if it works for you? |
@fabricemarie thanks for implementing this. I have just tested it and it works as expected. I have only noticed one problem when I set the
I believe that the Once more time thank you very much for improving this great plugin. I believe that it will be very useful tool for plenty of users. |
@jtyr the current implementation does not enable metrics nor notifications sending by default. Instead it waits for you to enable one or both of them, and aborts if you did not specify any. Similarly, if you don't want metrics then don't set any metrics handler. If you don't want notifications then don't set notification handlers. Setting them means you want them no? I thought it was logical. |
@fabricemarie This is exactly how I do it now :o) Let's leave it as it is. I'm very happy how it works now. I hope it will make it into the 5.5 release! Pitty that there is still the issue with the |
@jtyr Thanks for all the patience, testing and feedback :) |
char *val = NULL; | ||
|
||
if (child->values_num != 2) { | ||
WARNING("sensu attributes need both a key and a value."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran the build with clang's "scan-build" static analysis tool, and I got this warning:
Potential leak of memory pointed to by 'sensu_tags_arr.strs'
Not sure it's worth caring in this case, what do you think ?
@mfournier I originally ran |
@fabricemarie, thanks a lot for this new plugin. I'm not too familiar with sensu, but I trust you and @jtyr the implementation makes sense from sensu's point of view :) One question I have regarding this: no "collectd_host" field is set in the json submitted to sensu. What if someone decides to proxy several collectd nodes (using the network or amqp plugin) behind one central server which submits the values to sensu for all of them ? One other detail I noticed is that no persistent connection is held open with the sensu daemon. It makes the whole connection handling part much simpler, but I'm a bit worried it might lead to performance issue when collectd submits a ton of data to sensu (which would typically happen in the case I describe above). NB: this is just a remark, I wouldn't consider this as a blocker. If needed, this can be implemented later. The code looks good from my point of view, but it would be awesome if one of @octo, @tokkee or @pyr could also take a quick look ! All in all, +1 from me, especially since collectd integration with other tools is something I care a lot about :-) |
@mfournier I couldnt' find the I've fixed the 2 indentations issues you mentioned, as well as the uninitialized I didn't make the plugin send a "collectd_host" key:value pair since I don't think that For the lack of persistent connection I have tested more. When testing manually I noticed that The rationale behind vendoring Hope this helps. Obviously, fell free to pull and merge, and later modify as you see fit :) |
@@ -448,6 +448,9 @@ Features | |||
- write_riemann | |||
Sends data to Riemann, a stream processing and monitoring system. | |||
|
|||
- write_sensu | |||
Sends data to Sensu a stream processing and monitoring system, via sensu client local TCP socket. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sends data to Sensu, a stream processing and monitoring system, via the Sensu client local TCP socket.
Thanks for the detailed explanations @fabricemarie ! I just merged the PR to master, so this plugin will be part of collectd 5.5. Thanks for the great work ! |
@fabricemarie when attempting to build debian packages, which default to compile with
The simple way around this seems to be to remove I'd really like to fix this to avoid putting the burden on debian/ubuntu package maintainers. It would be a shame to have write_sensu not built by default in future releases of these distros because of this. |
#1001 implements the fix I mentioned above. It allows the build to pass when building "hardened" debian packages (which is the case for collectd). |
@fabricemarie FYI I just added 7834021, which allows the plugin to build on a freebsd10 default install. |
Is it possible to use this plugin to send data to sensu over udp instead of tcp? |
In fact the older Solaris implementations are missing |
Plugin to send datapoints and notifications to sensu client's UDP socket. Inspired from write_riemann plugin.