sensu-plugins / sensu-plugins-opsgenie

Sensu plugins for OpsGenie
http://sensu-plugins.io
MIT License
4 stars 24 forks source link

Added possibility to specify different priorities per status #57

Open passing opened 5 years ago

passing commented 5 years ago

Pull Request Checklist

Is this in reference to an existing issue? https://github.com/sensu-plugins/sensu-plugins-opsgenie/issues/36

General

passing commented 5 years ago

@Castaglia could you give me a hint, why checks are failing? I don't see any relation to the PR

Castaglia commented 5 years ago

Both of the failed builds look to have failed during package installation. It doesn't look like I have the TravisCI permissions there to re-run the builds, to see if it's a transient build issue.

majormoses commented 5 years ago

I have kicked off another build, you can always use the empty commit trick to kick off CI builds if your CI provider supports build/run on commit.

majormoses commented 5 years ago

I think the issue is that the base image we use is actually based on jessie which is now in the LTS phase and maybe some repositories are no longer accessible or contain the artifacts requested. When I have some time I will try to sit down and figure it out.

majormoses commented 5 years ago

I will have to look at if its possible for us to inject this early enough without going to newer builds: https://superuser.com/questions/1423486/issue-with-fetching-http-deb-debian-org-debian-dists-jessie-updates-inrelease

hadret commented 2 years ago

This works like expected except when alert recovers and needs to be updated, it hits this error:

{"timestamp":"2022-08-18T14:41:17.697585+0100","level":"error","message":"handler output","handler":{"type":"pipe","command":"/etc/sensu/handlers/opsgenie.rb","filters":["occurrences"],"name":"opsgenie"},"event":{"id":"e6e207d8-5693-42d4-99ef-0473afb12d92"},"output":["/etc/sensu/handlers/opsgenie.rb:157:in `event_priority': undefined method `upcase' for {\"critical\"=>\"P4\", \"warning\"=>\"P4\", \"unknown\"=>\"P5\"}:Hash (NoMethodError)
    from /etc/sensu/handlers/opsgenie.rb:182:in `post_to_opsgenie'
    from /etc/sensu/handlers/opsgenie.rb:115:in `close_alert'
    from /etc/sensu/handlers/opsgenie.rb:62:in `block in process'
    from /opt/sensu/embedded/lib/ruby/2.4.0/timeout.rb:93:in `block in timeout'
    from /opt/sensu/embedded/lib/ruby/2.4.0/timeout.rb:33:in `block in catch'
    from /opt/sensu/embedded/lib/ruby/2.4.0/timeout.rb:33:in `catch'
    from /opt/sensu/embedded/lib/ruby/2.4.0/timeout.rb:33:in `catch'
    from /opt/sensu/embedded/lib/ruby/2.4.0/timeout.rb:108:in `timeout'
    from /etc/sensu/handlers/opsgenie.rb:57:in `process'
    from /etc/sensu/handlers/opsgenie.rb:43:in `handle'
    from /opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/sensu-plugin-4.0.0/lib/sensu-handler.rb:91:in `block in <class:Handler>'
"]}

I suppose this is because upcase expects string but it receives a hash. When upcase is ditched everything works as expected 👌🏻