Skip to content

Opsgenie Stream Connector does not close alerts #160

@agougo

Description

@agougo

Description

When an alert is closed, any monitoring system (including Centreon) should not send a new alert in Opsgenie, but it should close the existing one.

Steps to Reproduce

This is reproducible by just shutting down a host (Centreon will send a Critical notification) and then powering it up (Centreon will send an OK notification).

Describe the received result

The received result is a new alert in Opsgenie

Describe the expected result

The expected result is to close the existing alert in Opsgenie.

Additional relevant information

Opsgenie has a feature called alert de-duplication. This feature is used for 2 things:
/ To increment existing alerts, and thus reducing incoming noise to Opsgenie
/ To close an alert if the issue is shown as resolved in Centreon

Opsgenie does that by using the Alias field. The best way to do it (for example for a service) would be to change this line:

alias = string.sub(event.cache.host.name .. "" .. event.cache.service.description .. "" .. state, 1, 512)
to this line
alias = string.sub(event.cache.host.name .. "_" .. event.cache.service.description, 1, 512)

... so that the alias is the same for the critical event and the OK event.

And then, for Closing the alert to send a POST request to the https://api.opsgenie.com/v2/alerts/:identifier:/close URL - instead of the https://api.opsgenie.com/v2/alerts, as per the Close Alert API documentation: https://docs.opsgenie.com/docs/alert-api#close-alert

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions