We've recently updated our OpsGenie handler (opsgenie.rb
) to the current community version, found here.
Our handler is defined as:
"opsgenie-pager" : {
"type": "pipe",
"command": "/etc/sensu/handlers/opsgenie.rb -j opsgenie-pager"
}
And our json config for opsgenie-pager
is:
{
"opsgenie-pager": {
"customerKey": "<Our API Key>",
"recipients": "<Our Schedule>,<Our Escalation>",
"source": "Admiral Ackbar",
"overwrite_quiet_hours": false,
"tags": [ "admAckbar", "live", "pager" ]
}
}
When a check returns as 'CRITICAL' and the opsgenie
handler is called, the sensu-server.log reports:
{"timestamp":"2015-02-03T06:16:17.804061-0700","level":"info","message":"handler output","handler":{"type":"pipe","command":"/etc/sensu/handlers/opsgenie.rb -j opsgenie-pager","name":"opsgenie-pager"},"output":"/etc/sensu/handlers/opsgenie.rb:15:in `<class:Opsgenie>': undefined method `option' for Opsgenie:Class (NoMethodError)\n"}
{"timestamp":"2015-02-03T06:16:17.804210-0700","level":"info","message":"handler output","handler":{"type":"pipe","command":"/etc/sensu/handlers/opsgenie.rb -j opsgenie-pager","name":"opsgenie-pager"},"output":"\tfrom /etc/sensu/handlers/opsgenie.rb:13:in `<main>'\n"}
In our "dev instance" (vagrant box), we're able to successfully use the OpsGenie handler to create alerts.
Any ideas what would be causing the undefined method 'option' for Opsgenie:Class (NoMethodError)
error?
Looks like this was the result of an outdated gem.
Out of chance I checked the installed packages (rpms and gems) between our "dev instance" and "production".
The sensu-pluign
gem in our dev instance (installed during a vagrant up
) was the current version (1.1.0) whereas the version installed on Production was an older version (0.6.3).
Updating this gem with
gem update sensu-plugin
solved this issue!