Portertech I need your help. I have everything you need to create a mutator, but its not all syncing up. Where is my wrong turn?
…/mutators/hide.rb
#!/usr/bin/env ruby
require ‘rubygems’
require ‘json’
event = JSON.parse(STDIN.read, :symbolize_names => true)
event[:check][:command].gsub!(/ -p\S*/, ’ -pXXX’)
puts event.to_json
…/conf.d/check.json
{
“checks”: {
“mysql_long_queries_dbprod-00”: {
“handlers”: [
“mailer_mysql_lq”
],
“command”: "/etc/sensu/plugins/check_mysql_longqueries.pl -H example.hey.com -P3306 -uuser -pD8F7 -w240 -c300 ",
“interval”: 300,
“occurrences”: 1,
“subscribers”: [
“mysql”
]
},
…/conf.d/handlers_email.json
{
“handlers”: {
“email_alerts”: {
“type”: “pipe”,
“command”: “mail -s ‘sensu alert’ k@example.com”
},
“mailer_mysql_lq”: {
“type”: “pipe”,
“mutator”: “hide”,
“command”: “/etc/sensu/handlers/mailer_with_options.rb --from sensu+mysql@example.com”
},
…/conf.d/mutators.json
{
“mutators”: {
“hide”: {
“command”: “/etc/sensu/mutators/hide.rb”
}
}
}
Did you ever figure this out? I am having the same issue. I think it may be due to the mutator command hide.rb needs to be on the sensu-server end instead of the sensu-client. I have to test this soon.
···
On Monday, August 12, 2013 11:18:43 AM UTC-7, Micah Hoffmann wrote:
Portertech I need your help. I have everything you need to create a mutator, but its not all syncing up. Where is my wrong turn?
…/mutators/hide.rb
#!/usr/bin/env ruby
require ‘rubygems’
require ‘json’
event = JSON.parse(STDIN.read, :symbolize_names => true)
event[:check][:command].gsub!(/ -p\S*/, ’ -pXXX’)
puts event.to_json
…/conf.d/check.json
{
“checks”: {
“mysql_long_queries_dbprod-00”: {
“handlers”: [
“mailer_mysql_lq”
],
“command”: "/etc/sensu/plugins/check_mysql_longqueries.pl -H example.hey.com -P3306 -uuser -pD8F7 -w240 -c300 ",
“interval”: 300,
“occurrences”: 1,
“subscribers”: [
“mysql”
]
},
…/conf.d/handlers_email.json
{
“handlers”: {
“email_alerts”: {
“type”: “pipe”,
“command”: “mail -s ‘sensu alert’ k...@example.com”
},
“mailer_mysql_lq”: {
“type”: “pipe”,
“mutator”: “hide”,
“command”: “/etc/sensu/handlers/mailer_with_options.rb --from sensu...@example.com”
},
…/conf.d/mutators.json
{
“mutators”: {
“hide”: {
“command”: “/etc/sensu/mutators/hide.rb”
}
}
}