not sending resolved emails for only some checks?

Is this possible?

Hey Micah,

You can do something like https://gist.github.com/portertech/ca25de27caed8215b432

Add “notify_resolve”: false to your check definitions in which you do not want to mail on resolution.

I haven’t tested the snippets above, just scratched it together.

Sean.

···

On Fri, Jun 7, 2013 at 9:59 AM, Micah Hoffmann micah@pointinside.com wrote:

Is this possible?


Cheers,

Sean Porter

{ blog: “http://portertech.ca”, projects: “https://github.com/portertech” }

Is this an issue or question?

If it’s a question, you could filter by a list of event check names.

···

On Fri, Jun 7, 2013 at 11:59 AM, Micah Hoffmann micah@pointinside.com wrote:

Is this possible?

testing https://gist.github.com/portertech/ca25de27caed8215b432 right now

···

On Friday, June 7, 2013 10:12:28 AM UTC-7, portertech wrote:

Hey Micah,

You can do something like https://gist.github.com/portertech/ca25de27caed8215b432

Add “notify_resolve”: false to your check definitions in which you do not want to mail on resolution.

I haven’t tested the snippets above, just scratched it together.

Sean.

On Fri, Jun 7, 2013 at 9:59 AM, Micah Hoffmann mi...@pointinside.com wrote:

Is this possible?


Cheers,

Sean Porter

{ blog: “http://portertech.ca”, projects: “https://github.com/portertech” }

so I see no place that the sensu-handler.rb is looking for notify_resolve, do I need to update the configs to be able to handle this filter?

···

On Friday, June 7, 2013 9:59:42 AM UTC-7, Micah Hoffmann wrote:

Is this possible?

If you’re using the filter I put in the gist, that’s happening within the Sensu server itself.

···

On Fri, Jun 7, 2013 at 11:26 AM, Micah Hoffmann micah@pointinside.com wrote:

so I see no place that the sensu-handler.rb is looking for notify_resolve, do I need to update the configs to be able to handle this filter?

On Friday, June 7, 2013 9:59:42 AM UTC-7, Micah Hoffmann wrote:

Is this possible?


Cheers,

Sean Porter

{ blog: “http://portertech.ca”, projects: “https://github.com/portertech” }

here is what I am trying…

/etc/sensu/conf.d$ handler_email.json

“mailer_mysql_no_resolve”: {

“type”: “pipe”,

“command”: “/etc/sensu/handlers/mailer_with_options.rb --from sensu+mysql@mycompany.com”,

“filter”: “notify_resolve”

}

/etc/sensu/conf.d$ filters.json

{

“filters”: {

“notify_resolve”: {

“attributes”: {

“check”: {

“status”: 0,

“notify_resolve”: false

}

},

“negate”: true

}

}

}

on sensu-server restart I am receiving this

{

“timestamp”: “2013-06-07T18:50:45.428950+0000”,

“level”: “warn”,

“message”: “config file applied changes”,

“config_file”: “/etc/sensu/conf.d/check_mysql_long_queries.json”,

“changes”: {

“checks”: {

“mysql_long_queries_check”: [

null,

{

“handlers”: [

“mailer_mysql_no_resolve”

],

“command”: "/etc/sensu/plugins/check_mysql_longqueries.pl -H host ",

“interval”: 300,

“occurrences”: 1,

“subscribers”: [

“urls”

]

}

···

On Friday, June 7, 2013 9:59:42 AM UTC-7, Micah Hoffmann wrote:

Is this possible?

add “notify_resolve”: false to that check definition.

···

On Fri, Jun 7, 2013 at 11:55 AM, Micah Hoffmann micah@pointinside.com wrote:

here is what I am trying…

/etc/sensu/conf.d$ handler_email.json

“mailer_mysql_no_resolve”: {

“type”: “pipe”,

“command”: “/etc/sensu/handlers/mailer_with_options.rb --from sensu+mysql@mycompany.com”,

“filter”: “notify_resolve”

}

/etc/sensu/conf.d$ filters.json

{

“filters”: {

“notify_resolve”: {

“attributes”: {

“check”: {

“status”: 0,

“notify_resolve”: false

}

},

“negate”: true

}

}

}

on sensu-server restart I am receiving this

{

“timestamp”: “2013-06-07T18:50:45.428950+0000”,

“level”: “warn”,

“message”: “config file applied changes”,

“config_file”: “/etc/sensu/conf.d/check_mysql_long_queries.json”,

“changes”: {

“checks”: {

“mysql_long_queries_check”: [

null,

{

“handlers”: [

“mailer_mysql_no_resolve”

],

“command”: "/etc/sensu/plugins/check_mysql_longqueries.pl -H host ",

“interval”: 300,

“occurrences”: 1,

“subscribers”: [

“urls”

]

}

On Friday, June 7, 2013 9:59:42 AM UTC-7, Micah Hoffmann wrote:

Is this possible?


Cheers,

Sean Porter

{ blog: “http://portertech.ca”, projects: “https://github.com/portertech” }

“mailer_mysql_no_resolve”: {

“type”: “pipe”,

“command”: “/etc/sensu/handlers/mailer_with_options.rb --from sensu...@mycompany.com”,

“notify_resolve”: false

?

···

On Friday, June 7, 2013 9:59:42 AM UTC-7, Micah Hoffmann wrote:

Is this possible?

update: this technique hasn’t worked for me yet, still receiving resolved emails.

···

On Friday, June 7, 2013 9:59:42 AM UTC-7, Micah Hoffmann wrote:

Is this possible?

@portertech: were you thinking of “auto_resolve”:false?

https://github.com/sensu/sensu/blob/master/lib/sensu/server.rb#L486

···

On Monday, June 10, 2013 3:20:50 PM UTC-7, Micah Hoffmann wrote:

update: this technique hasn’t worked for me yet, still receiving resolved emails.

On Friday, June 7, 2013 9:59:42 AM UTC-7, Micah Hoffmann wrote:

Is this possible?

haven’t got that to work either

···

On Friday, June 7, 2013 9:59:42 AM UTC-7, Micah Hoffmann wrote:

Is this possible?

Gonna bump this. This is something I’d find useful as well for alerts that are more like one-time notifications of an event.

I wasn’t to find any mention of “notify_resolve” in Sensu’s source code and the only search result for it is this thread. I see auto_resolve, but I’m not sure that’s what I want and I wasn’t able to find any documentation for it.

Does anyone know of a way I can accomplish this?

···

On Wednesday, June 12, 2013 3:08:26 PM UTC-5, Micah Hoffmann wrote:

haven’t got that to work either

On Friday, June 7, 2013 9:59:42 AM UTC-7, Micah Hoffmann wrote:

Is this possible?

@nstielau No, I’m not thinking of “auto_resolve” (the feature in core), I’m looking at his filter that uses a custom check attribute to indicate if events should be passed to the mail handler on the resolve action.

@micah Use the event action in your filter, “attributes”: {“action”: “resolve”}, “negate”: true

···

On Thu, Aug 8, 2013 at 10:18 AM, Brian Derickson bderickson88@gmail.com wrote:

Gonna bump this. This is something I’d find useful as well for alerts that are more like one-time notifications of an event.

I wasn’t to find any mention of “notify_resolve” in Sensu’s source code and the only search result for it is this thread. I see auto_resolve, but I’m not sure that’s what I want and I wasn’t able to find any documentation for it.

Does anyone know of a way I can accomplish this?

On Wednesday, June 12, 2013 3:08:26 PM UTC-5, Micah Hoffmann wrote:

haven’t got that to work either

On Friday, June 7, 2013 9:59:42 AM UTC-7, Micah Hoffmann wrote:

Is this possible?


Cheers,

Sean Porter

{ blog: “http://portertech.ca”, projects: “https://github.com/portertech” }