Skip to content
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

Support for multiple handlers with different routing keys #658

Closed
wants to merge 1 commit into from

Conversation

csmcdermott
Copy link

This change allows you to create multiple handlers with different routing keys, ie:

{
"handlers": {
"victorops": {
"type": "pipe",
"command": "/etc/sensu/handlers/victorops.rb --routingkey everyone",
"severities": [
"ok",
"critical"
]
},
"victorops_database": {
"type": "pipe",
"command": "/etc/sensu/handlers/victorops.rb --routingkey victorops_database",
"severities": [
"ok",
"critical"
]
}
}
}

Alternatively you can leave the --routingkey option off and use this handler exactly like before - this change is backwards compatible.

@@ -10,6 +10,17 @@
require 'net/http'
require 'net/https'
require 'json'
require 'optparse'

$options = {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think global variable here is too much for the purpose, instance variable would be enough.

@piavlo
Copy link
Contributor

piavlo commented Jul 27, 2014

I was also thinking about implementing better key routing mechanism for vitctorops.
I have two ideas

  1. just use the check name as routing key, and then map all the checks to different teams in victorops
    the not mapped checks will just go to default team.

  2. similar to above but instead check name will be mapped to routing keys in sensu config, something like this

{
  "handlers": {
    "victorops": {
      "type": "pipe",
      "command": "/etc/sensu/handlers/victorops.rb"
    }
  },
  "victorops": {
    "api_url": "https://alert.victorops.com/integrations/generic/20131114/xxxxxxxxxxxxxxxxxxx",
    "routing_key": "the-default-fallback-routing-key"
    "routing":  {
      "check_mysql_replication": "database",
      "check_rabbitmq": "messaging",
      "check_disk": "system",
      ...
    }
  }
}

wdyt?

@kalabiyau
Copy link
Contributor

@csmcdermott i think idea is worthy, please look at sensu-plugins/sensu-plugin#66 maybe you can later base your work on that

@kalabiyau
Copy link
Contributor

Still blocked in sensu itself. Closing until that blocker is fixed.

@kalabiyau kalabiyau closed this Oct 6, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants