Handle all Events


#1

Hi everyone !

There is a way to send all events to a handle, to externalize the events to a bigdata ?

I try to do this, but only when has a state change the event is send to my handle.

Tks !


#2

Might not be the best way to do it, but you can enable debug log and read the sensu-server.log into your bigdata.

···

On Friday, 2 September 2016 20:03:48 UTC+5:30, Alex Baule wrote:

Hi everyone !

There is a way to send all events to a handle, to externalize the events to a bigdata ?

I try to do this, but only when has a state change the event is send to my handle.

Tks !


#3

From what I remember, you can set the 'refresh' parameter from your checks
to 0 and every event will be sent. This means however that all handlers
will receive them.

Search for 'refresh' in the documentation here:
https://sensuapp.org/docs/latest/reference/plugins

···

On Fri, Sep 2, 2016 at 10:33 AM, Alex Baule <alexwbaule@gmail.com> wrote:

There is a way to send all events to a handle, to externalize the events
to a bigdata ?

I try to do this, but only when has a state change the event is send to my
handle.


#4

If you want all events (instead of a state change) you need to set the “type: metric” in the check definition:
https://sensuapp.org/docs/0.25/guides/getting-started/intro-to-checks.html#create-the-check-definition-for-cpu-metrics

···

On Fri, Sep 2, 2016 at 3:17 PM, Moises Silva moises.silva@gmail.com wrote:

On Fri, Sep 2, 2016 at 10:33 AM, Alex Baule alexwbaule@gmail.com wrote:

There is a way to send all events to a handle, to externalize the events to a bigdata ?

I try to do this, but only when has a state change the event is send to my handle.

From what I remember, you can set the ‘refresh’ parameter from your checks to 0 and every event will be sent. This means however that all handlers will receive them.

Search for ‘refresh’ in the documentation here: https://sensuapp.org/docs/latest/reference/plugins


#5

It is unlikely a PR for such a feature would be merged, Sensu in a sense already sends all its events to its own datastore (redis), just not the one you want (bigdata?).

Probably the best way to extend Sensu’s functionality like this is with an Extension:

https://sensuapp.org/docs/0.25/reference/extensions.html

Here is some prior art for what it sounds like you are trying to achieve:

https://github.com/jswoods/sensu-flapjack/blob/master/sensu/extensions/handlers/flapjack.rb

https://github.com/sensu/sensu-community-plugins/tree/d7f987a23699bf18cb923ed68a4a434f035751d2/extensions/handlers

···

On Tue, Sep 6, 2016 at 6:29 AM, Alex Baule alexwbaule@gmail.com wrote:

Im look into source code, and i will do a pull request with a new configuration item to stream all events to a external database.

2016-09-03 0:33 GMT-03:00 Kyle Anderson kyle@xkyle.com:

If you want all events (instead of a state change) you need to set the “type: metric” in the check definition:
https://sensuapp.org/docs/0.25/guides/getting-started/intro-to-checks.html#create-the-check-definition-for-cpu-metrics

On Fri, Sep 2, 2016 at 3:17 PM, Moises Silva moises.silva@gmail.com wrote:

On Fri, Sep 2, 2016 at 10:33 AM, Alex Baule alexwbaule@gmail.com wrote:

There is a way to send all events to a handle, to externalize the events to a bigdata ?

I try to do this, but only when has a state change the event is send to my handle.

From what I remember, you can set the ‘refresh’ parameter from your checks to 0 and every event will be sent. This means however that all handlers will receive them.

Search for ‘refresh’ in the documentation here: https://sensuapp.org/docs/latest/reference/plugins


#6

Kyle Anderson has the right idea, extensions are the best method to forward info from sensu to any other source instead of handling each event. When using an extension the info is already loaded into sensu and a new env or fork doesnt have to be created but there is two catches: you can crash sensu serve if wrong (not isolated), and you might block event machince if you code wrong which can cause metrics to go missing.

At any rate, if your sending all metrics to another datasource I would recoomend looking at this handler (relay) that is made for sending data to graphite and mutator combo

https://github.com/opower/sensu-metrics-relay

···

On Friday, 2 September 2016 08:33:48 UTC-6, Alex Baule wrote:

Hi everyone !

There is a way to send all events to a handle, to externalize the events to a bigdata ?

I try to do this, but only when has a state change the event is send to my handle.

Tks !


#7

more particularly there is a tcp and a udp extension built into sensu now too

···

On Tuesday, 6 September 2016 18:15:45 UTC-6, Fox wrote:

Kyle Anderson has the right idea, extensions are the best method to forward info from sensu to any other source instead of handling each event. When using an extension the info is already loaded into sensu and a new env or fork doesnt have to be created but there is two catches: you can crash sensu serve if wrong (not isolated), and you might block event machince if you code wrong which can cause metrics to go missing.

At any rate, if your sending all metrics to another datasource I would recoomend looking at this handler (relay) that is made for sending data to graphite and mutator combo

https://github.com/opower/sensu-metrics-relay

On Friday, 2 September 2016 08:33:48 UTC-6, Alex Baule wrote:

Hi everyone !

There is a way to send all events to a handle, to externalize the events to a bigdata ?

I try to do this, but only when has a state change the event is send to my handle.

Tks !


#8

Have a look at this post which gives an example config (although directed towards graphite). In spite of my previous post in the thread about using sensu-metrics-relay, we have now moved to using the built in tcp extension as it allows us to send some metrics to multiple graphite servers and is more flexible.

Cheers,

Joel

···

On Wednesday, 7 September 2016 01:27:43 UTC+1, Fox wrote:

more particularly there is a tcp and a udp extension built into sensu now too

On Tuesday, 6 September 2016 18:15:45 UTC-6, Fox wrote:

Kyle Anderson has the right idea, extensions are the best method to forward info from sensu to any other source instead of handling each event. When using an extension the info is already loaded into sensu and a new env or fork doesnt have to be created but there is two catches: you can crash sensu serve if wrong (not isolated), and you might block event machince if you code wrong which can cause metrics to go missing.

At any rate, if your sending all metrics to another datasource I would recoomend looking at this handler (relay) that is made for sending data to graphite and mutator combo

https://github.com/opower/sensu-metrics-relay

On Friday, 2 September 2016 08:33:48 UTC-6, Alex Baule wrote:

Hi everyone !

There is a way to send all events to a handle, to externalize the events to a bigdata ?

I try to do this, but only when has a state change the event is send to my handle.

Tks !


#9

to complete this thread,

Looking better to the source code, there is a “bridge” handler, it’s used by flapjack to send the checks and metrics. The bridge is called without treatment, every metric or check.

So, i will get the flapjack extension and modify it.

Tks for the answers !

···

Em quarta-feira, 7 de setembro de 2016 05:22:17 UTC-3, joel....@hscic.gov.uk escreveu:

Have a look at this post which gives an example config (although directed towards graphite). In spite of my previous post in the thread about using sensu-metrics-relay, we have now moved to using the built in tcp extension as it allows us to send some metrics to multiple graphite servers and is more flexible.

Cheers,

Joel

On Wednesday, 7 September 2016 01:27:43 UTC+1, Fox wrote:

more particularly there is a tcp and a udp extension built into sensu now too

On Tuesday, 6 September 2016 18:15:45 UTC-6, Fox wrote:

Kyle Anderson has the right idea, extensions are the best method to forward info from sensu to any other source instead of handling each event. When using an extension the info is already loaded into sensu and a new env or fork doesnt have to be created but there is two catches: you can crash sensu serve if wrong (not isolated), and you might block event machince if you code wrong which can cause metrics to go missing.

At any rate, if your sending all metrics to another datasource I would recoomend looking at this handler (relay) that is made for sending data to graphite and mutator combo

https://github.com/opower/sensu-metrics-relay

On Friday, 2 September 2016 08:33:48 UTC-6, Alex Baule wrote:

Hi everyone !

There is a way to send all events to a handle, to externalize the events to a bigdata ?

I try to do this, but only when has a state change the event is send to my handle.

Tks !


#10

Alex,

A bridge extension is definitely the correct way to implement this, and that Flapjack extension is one of very few examples, so it is a good place to start.

Alternatively, please note that Sensu Enterprise provides a built-in “event stream” integration that provides this functionality out of the box: https://sensuapp.org/docs/latest/enterprise/integrations/event_stream.html

I hope this helps!

#monitoringlove

···

On Tuesday, September 13, 2016 at 10:53:57 AM UTC-7, Alex Baule wrote:

to complete this thread,

Looking better to the source code, there is a “bridge” handler, it’s used by flapjack to send the checks and metrics. The bridge is called without treatment, every metric or check.

So, i will get the flapjack extension and modify it.

Tks for the answers !

Em quarta-feira, 7 de setembro de 2016 05:22:17 UTC-3, joel....@hscic.gov.uk escreveu:

Have a look at this post which gives an example config (although directed towards graphite). In spite of my previous post in the thread about using sensu-metrics-relay, we have now moved to using the built in tcp extension as it allows us to send some metrics to multiple graphite servers and is more flexible.

Cheers,

Joel

On Wednesday, 7 September 2016 01:27:43 UTC+1, Fox wrote:

more particularly there is a tcp and a udp extension built into sensu now too

On Tuesday, 6 September 2016 18:15:45 UTC-6, Fox wrote:

Kyle Anderson has the right idea, extensions are the best method to forward info from sensu to any other source instead of handling each event. When using an extension the info is already loaded into sensu and a new env or fork doesnt have to be created but there is two catches: you can crash sensu serve if wrong (not isolated), and you might block event machince if you code wrong which can cause metrics to go missing.

At any rate, if your sending all metrics to another datasource I would recoomend looking at this handler (relay) that is made for sending data to graphite and mutator combo

https://github.com/opower/sensu-metrics-relay

On Friday, 2 September 2016 08:33:48 UTC-6, Alex Baule wrote:

Hi everyone !

There is a way to send all events to a handle, to externalize the events to a bigdata ?

I try to do this, but only when has a state change the event is send to my handle.

Tks !