Having issues with remediation

I am trying to get remediation working with sensu and having no luck.

Any insight would be very helpful

···

{

“handlers”: {

“remediator”: {

“type”: “pipe”,

“command”: “/etc/sensu/community/handlers/remediation/remediation.rb”

}

},

“checks”: {

“fail_with_remediation”: {

“command”: “/usr/bin/ruby /etc/sensu/community/plugins/processes/check-procs.rb -p overdraft -W 1”,

“interval”: 60,

“standalone”: true,

“publish”: false,

“subscribers”: [“overdraft”],

“handlers”: [“remediator”],

“remediation”: {

“remediation”: {

“occurrences”: [“2+”],

“severities”: [2]

}

}

},

“remediation”: {

“command”: “/bin/touch /tmp/remediation_this_shit”,

“standalone”: true,

“publish”: false,

“interval”: 60,

“subscribers”: [“overdraft”]

}

}

}

Hey Jennifer,

It might be that the ‘standalone’ setting for the remediation check. I’m not sure if the ‘publish:false’ actually disables that if it is standalone. I would put standalone:false and publish:false.

Nick

···

On Tuesday, April 1, 2014 9:45:15 AM UTC-7, Jennifer Fountain wrote:

I am trying to get remediation working with sensu and having no luck.

Any insight would be very helpful

{

“handlers”: {

“remediator”: {

“type”: “pipe”,

“command”: “/etc/sensu/community/handlers/remediation/remediation.rb”

}

},

“checks”: {

“fail_with_remediation”: {

“command”: “/usr/bin/ruby /etc/sensu/community/plugins/processes/check-procs.rb -p overdraft -W 1”,

“interval”: 60,

“standalone”: true,

“publish”: false,

“subscribers”: [“overdraft”],

“handlers”: [“remediator”],

“remediation”: {

“remediation”: {

“occurrences”: [“2+”],

“severities”: [2]

}

}

},

“remediation”: {

“command”: “/bin/touch /tmp/remediation_this_shit”,

“standalone”: true,

“publish”: false,

“interval”: 60,

“subscribers”: [“overdraft”]

}

}

}

Hi

Thanks for getting back to me. I did change it to look like this:

{
“checks”: {
“check_with_remediation”: {
“command”: “/usr/bin/ruby /etc/sensu/community/plugins/processes/check-procs.rb -p jenntest -W 1”,
“interval”: 60,
“subscribers”: [“test”],
“handlers”: [“remediator”],
“remediation”: {
“light_remediation”: {
“occurrences”: [1, 2],
“severities”: [1]
},
“medium_remediation”: {
“occurrences”: [“3-10”],
“severities”: [1]
},
“heavy_remediation”: {
“occurrences”: [“1+”],
“severities”: [2]
}
}
},
“light_remediation”: {
“command”: “/bin/touch /tmp/remediation_light”,
“subscribers”: [“test”],
“handlers”: [“mailer”],
“publish”: false
},
“medium_remediation”: {
“command”: “/bin/touch /tmp/remediation_light”,
“subscribers”: [“test”],
“handlers”: [“mailer”],
“publish”: false
},
“heavy_remediation”: {
“command”: “/bin/touch /tmp/remediation_light”,
“subscribers”: [“test”],
“handlers”: [“mailer”],
“publish”: false
}
}
}

and it appears to be working according to the log:

{“timestamp”:“2014-04-02T11:56:23.168189-0400”,“level”:“info”,“message”:“handling event”,“event”:{“client”:{“name”:“testserver.local.net”,“address”:“10.1.2.3”,“subscriptions”:[“default”,“test”],“timestamp”:1396454165},“check”:{“command”:“/usr/bin/ruby /etc/sensu/community/plugins/processes/check-procs.rb -p jenntest -W 1”,“interval”:60,“subscribers”:[“test”],“handlers”:[“remediator”],“remediation”:{“light_remediation”:{“occurrences”:[1,2],“severities”:[1]},“medium_remediation”:{“occurrences”:[“3-10”],“severities”:[1]},“heavy_remediation”:{“occurrences”:[“1+”],“severities”:[2]}},“name”:“check_with_remediation”,“issued”:1396454183,“executed”:1396454183,“output”:“CheckProcs CRITICAL: Found 0 matching processes; cmd /jenntest/\n”,“status”:2,“duration”:0.104,“history”:[“2”,“2”,“2”,“2”,“2”,“2”,“2”,“2”,“2”,“2”,“2”,“2”,“2”,“2”,“2”,“2”,“2”,“2”,“2”,“2”,“2”]},“occurrences”:1212,“action”:“create”},“handler”:{“type”:“pipe”,“command”:“/etc/sensu/community/handlers/remediation/sensu.rb”,“name”:“remediator”}}
{“timestamp”:“2014-04-02T11:56:23.282658-0400”,“level”:“info”,“message”:“handler output”,“handler”:{“type”:“pipe”,“command”:“/etc/sensu/community/handlers/remediation/sensu.rb”,“name”:“remediator”},“output”:“REMEDIATION: Evaluating remediation: testserver.local.net {"light_remediation"=>{"occurrences"=>[1, 2], "severities"=>[1]}, "medium_remediation"=>{"occurrences"=>["3-10"], "severities"=>[1]}, "heavy_remediation"=>{"occurrences"=>["1+"], "severities"=>[2]}} #=1212 sev=2\n”}
{“timestamp”:“2014-04-02T11:56:23.282813-0400”,“level”:“info”,“message”:“handler output”,“handler”:{“type”:“pipe”,“command”:“/etc/sensu/community/handlers/remediation/sensu.rb”,“name”:“remediator”},“output”:“REMEDIATION: Matchdata: #<MatchData "1+" 1:"1">\n”}
{“timestamp”:“2014-04-02T11:56:23.282856-0400”,“level”:“info”,“message”:“handler output”,“handler”:{“type”:“pipe”,“command”:“/etc/sensu/community/handlers/remediation/sensu.rb”,“name”:“remediator”},“output”:“REMEDIATION: Triggering remediation check ‘heavy_remediation’ for ["testserver.local.net"]\n”}
{“timestamp”:“2014-04-02T11:56:23.282892-0400”,“level”:“info”,“message”:“handler output”,“handler”:{“type”:“pipe”,“command”:“/etc/sensu/community/handlers/remediation/sensu.rb”,“name”:“remediator”},“output”:“REMEDIATION: Recieved API Response (202): {"issued":1396454183}, exiting.\n”}

But I do not see the file on the server. Any help would be appreciated and I will send you beer or whatever :smiley:

thanks!!

···

On Wednesday, April 2, 2014 1:20:01 PM UTC-4, Nick Stielau wrote:

Hey Jennifer,

It might be that the ‘standalone’ setting for the remediation check. I’m not sure if the ‘publish:false’ actually disables that if it is standalone. I would put standalone:false and publish:false.

Nick

On Tuesday, April 1, 2014 9:45:15 AM UTC-7, Jennifer Fountain wrote:

I am trying to get remediation working with sensu and having no luck.

Any insight would be very helpful

{

“handlers”: {

“remediator”: {

“type”: “pipe”,

“command”: “/etc/sensu/community/handlers/remediation/remediation.rb”

}

},

“checks”: {

“fail_with_remediation”: {

“command”: “/usr/bin/ruby /etc/sensu/community/plugins/processes/check-procs.rb -p overdraft -W 1”,

“interval”: 60,

“standalone”: true,

“publish”: false,

“subscribers”: [“overdraft”],

“handlers”: [“remediator”],

“remediation”: {

“remediation”: {

“occurrences”: [“2+”],

“severities”: [2]

}

}

},

“remediation”: {

“command”: “/bin/touch /tmp/remediation_this_shit”,

“standalone”: true,

“publish”: false,

“interval”: 60,

“subscribers”: [“overdraft”]

}

}

}

Same here too, has anyone been able to find an update?

I keep seeing this sensu-api log but nothing on the subscriber

{“timestamp”:“2014-05-19T00:04:28.743815+0400”,“level”:“info”,“message”:“publishing check request”,“payload”:{“name”:“light_remediation”,“command”:“touch /tmp/hello.txt”,“issued”:1400443468},“subscribers”:[“test”]}

···

On Wednesday, April 2, 2014 10:28:24 PM UTC+4, Jennifer Fountain wrote:

Hi

Thanks for getting back to me. I did change it to look like this:

{
“checks”: {
“check_with_remediation”: {
“command”: “/usr/bin/ruby /etc/sensu/community/plugins/processes/check-procs.rb -p jenntest -W 1”,
“interval”: 60,
“subscribers”: [“test”],
“handlers”: [“remediator”],
“remediation”: {
“light_remediation”: {
“occurrences”: [1, 2],
“severities”: [1]
},
“medium_remediation”: {
“occurrences”: [“3-10”],
“severities”: [1]
},
“heavy_remediation”: {
“occurrences”: [“1+”],
“severities”: [2]
}
}
},
“light_remediation”: {
“command”: “/bin/touch /tmp/remediation_light”,
“subscribers”: [“test”],
“handlers”: [“mailer”],
“publish”: false
},
“medium_remediation”: {
“command”: “/bin/touch /tmp/remediation_light”,
“subscribers”: [“test”],
“handlers”: [“mailer”],
“publish”: false
},
“heavy_remediation”: {
“command”: “/bin/touch /tmp/remediation_light”,
“subscribers”: [“test”],
“handlers”: [“mailer”],
“publish”: false
}
}
}

and it appears to be working according to the log:

{“timestamp”:“2014-04-02T11:56:23.168189-0400”,“level”:“info”,“message”:“handling event”,“event”:{“client”:{“name”:“testserver.local.net”,“address”:“10.1.2.3”,“subscriptions”:[“default”,“test”],“timestamp”:1396454165},“check”:{“command”:“/usr/bin/ruby /etc/sensu/community/plugins/processes/check-procs.rb -p jenntest -W 1”,“interval”:60,“subscribers”:[“test”],“handlers”:[“remediator”],“remediation”:{“light_remediation”:{“occurrences”:[1,2],“severities”:[1]},“medium_remediation”:{“occurrences”:[“3-10”],“severities”:[1]},“heavy_remediation”:{“occurrences”:[“1+”],“severities”:[2]}},“name”:“check_with_remediation”,“issued”:1396454183,“executed”:1396454183,“output”:“CheckProcs CRITICAL: Found 0 matching processes; cmd /jenntest/\n”,“status”:2,“duration”:0.104,“history”:[“2”,“2”,“2”,“2”,“2”,“2”,“2”,“2”,“2”,“2”,“2”,“2”,“2”,“2”,“2”,“2”,“2”,“2”,“2”,“2”,“2”]},“occurrences”:1212,“action”:“create”},“handler”:{“type”:“pipe”,“command”:“/etc/sensu/community/handlers/remediation/sensu.rb”,“name”:“remediator”}}
{“timestamp”:“2014-04-02T11:56:23.282658-0400”,“level”:“info”,“message”:“handler output”,“handler”:{“type”:“pipe”,“command”:“/etc/sensu/community/handlers/remediation/sensu.rb”,“name”:“remediator”},“output”:“REMEDIATION: Evaluating remediation: testserver.local.net {"light_remediation"=>{"occurrences"=>[1, 2], "severities"=>[1]}, "medium_remediation"=>{"occurrences"=>["3-10"], "severities"=>[1]}, "heavy_remediation"=>{"occurrences"=>["1+"], "severities"=>[2]}} #=1212 sev=2\n”}
{“timestamp”:“2014-04-02T11:56:23.282813-0400”,“level”:“info”,“message”:“handler output”,“handler”:{“type”:“pipe”,“command”:“/etc/sensu/community/handlers/remediation/sensu.rb”,“name”:“remediator”},“output”:“REMEDIATION: Matchdata: #<MatchData "1+" 1:"1">\n”}
{“timestamp”:“2014-04-02T11:56:23.282856-0400”,“level”:“info”,“message”:“handler output”,“handler”:{“type”:“pipe”,“command”:“/etc/sensu/community/handlers/remediation/sensu.rb”,“name”:“remediator”},“output”:“REMEDIATION: Triggering remediation check ‘heavy_remediation’ for ["testserver.local.net"]\n”}
{“timestamp”:“2014-04-02T11:56:23.282892-0400”,“level”:“info”,“message”:“handler output”,“handler”:{“type”:“pipe”,“command”:“/etc/sensu/community/handlers/remediation/sensu.rb”,“name”:“remediator”},“output”:“REMEDIATION: Recieved API Response (202): {"issued":1396454183}, exiting.\n”}

But I do not see the file on the server. Any help would be appreciated and I will send you beer or whatever :smiley:

thanks!!

On Wednesday, April 2, 2014 1:20:01 PM UTC-4, Nick Stielau wrote:

Hey Jennifer,

It might be that the ‘standalone’ setting for the remediation check. I’m not sure if the ‘publish:false’ actually disables that if it is standalone. I would put standalone:false and publish:false.

Nick

On Tuesday, April 1, 2014 9:45:15 AM UTC-7, Jennifer Fountain wrote:

I am trying to get remediation working with sensu and having no luck.

Any insight would be very helpful

{

“handlers”: {

“remediator”: {

“type”: “pipe”,

“command”: “/etc/sensu/community/handlers/remediation/remediation.rb”

}

},

“checks”: {

“fail_with_remediation”: {

“command”: “/usr/bin/ruby /etc/sensu/community/plugins/processes/check-procs.rb -p overdraft -W 1”,

“interval”: 60,

“standalone”: true,

“publish”: false,

“subscribers”: [“overdraft”],

“handlers”: [“remediator”],

“remediation”: {

“remediation”: {

“occurrences”: [“2+”],

“severities”: [2]

}

}

},

“remediation”: {

“command”: “/bin/touch /tmp/remediation_this_shit”,

“standalone”: true,

“publish”: false,

“interval”: 60,

“subscribers”: [“overdraft”]

}

}

}