Skip to main content
how-to

Everything you’ve always wanted to know about Centreon and Opsgenie but were afraid to ask

  • November 5, 2021
  • 6 replies
  • 654 views

tcharles
Centreonian
Forum|alt.badge.img+5

Please note that the only procedures supported and maintained by Centreon are those published in the official documentation. If you have a question about this article, post it in the comments.


Centreon, the reference monitoring platform, provides quality data and unparalleled aggregation and correlation capabilities, giving a holistic view from cloud to edge. In an ever-growing IT environment, new tools are designed every day to guarantee the reliability of the digital business IT system. Centreon stands as a connected monitoring solution that can interface with tools such as Opsgenie to enhance the analysis of the IT system health. Here we reveal every secret of Centreon's interconnection with Opsgenie.

 

The importance of connected monitoring

Only 27% of respondents to Centreon’s State of IT Monitoring rate the visibility over IT performance levels as excellent, which might be explained by the fact that only 61% of the IT system is monitored, on average.

These figures make you realize the importance of communicating data and exploiting it within a monitoring system which should be open, adaptable, scalable and above all connected to the rest of the world. You can choose to keep your silos, but in an ultra connected digital environment, it is definitely best to interconnect tools too.

That's why Centreon provides ITOps with a panel of tools to interface with complementary solutions to provide better visibility on the IT system and information on its health and availability, and so much more.

 

Why should you interface the incident management tool Opsgenie with Centreon?

Let's learn a little about Opsgenie, an incident management platform designed to highlight critical incidents and reduce response times for the teams involved. Opsgenie receives alerts from monitoring systems and custom apps and ranks them according to importance and timing.

The tool sends alerts through various communication channels (calls, e-mails, SMS and push messages on cell phones).

It can therefore be a great option to integrate data that Centreon can reliably and accurately collect in order to gain visibility. Such an approach is possible because Opsgenie can be integrated with monitoring, ITSM and chat tools. Connect Centreon with Opsgenie in order to take full advantage of the best of both tools. 

 

Your master key: the Stream Connector

If you’re a Harry Potter fan, sorry to disappoint you. There’s no magic between Opsgenie and Centreon, only technology, a.k.a the Stream Connector, a valuable feature of the Centreon platform to format and transfer monitoring data (metrics or events) from Centreon to an external tool.

To interface your favorite monitoring tool with Opsgenie, Centreon provides you with a Stream Connector. Two things should be noted to find your way back home:

  • Centreon monitoring alerts become alerts in Opsgenie,
  • Application alerts in the Centreon BAM module become incidents in Opsgenie.

 

Let's get down to business: let's configure Opsgenie...

Configuration is done in two steps. 

 

Configuring the API for incidents

  1. Go to the Settings menu.
  2. In the Integrations section, click Integration list.
  3. Add an API integration (Rest API HTTPS over JSON).

     

  4. Configure your integration by going to the Configured integrations sub-menu.
  5. Click the API integration.
  6. Check the Create and Update Access rights.
  7. Make sure you have checked Enabled.
  8. Keep your API Key, you will need it for Centreon.
  9. Save your configuration.

 

Configuring the API for alerts

  1. Go to the Settings menu.
  2. In the APP SETTINGS section, click API key management.
  3. Click the Add new API key button.
  4. Name your API key.
  5. Keep your API Key, you will need it for Centreon.
  6. Check the Create and update box.
  7. Click the Add API key button.

 

... and now let’s configure Centreon

Again, this is done in two steps: 

 

Installing the Stream Connector

  1. Use SSH to log in to the Centreon central server with a root user.
  2. Install the required Lua dependencies
     
    yum install -y lua-curl epel-release

     

  3. Download the Stream Connector
    wget -O /usr/share/centreon-broker/lua/opsgenie.lua https://raw.githubusercontent.com/centreon/centreon-stream-connector-scripts/master/centreon-certified/opsgenie/opsgenie-apiv1.lua

     

  4. Configure the rights
     
    chmod 644 /usr/share/centreon-broker/lua/opsgenie.lua

     

Configuring the Stream Connector

  1. Log in to your Centreon interface with an admin account.
  2. Go to the Configuration > Collectors menu and select Broker Configuration.
  3. Click the broker-central-broker-master configuration.
  4. Go to the Output tab.
  5. Add a new Generic - Stream connector output.
  6. Name it as you wish.
  7. Enter the path of the Stream Connector /usr/share/centreon-broker/lua/opsgenie.lua
  8. Add string parameter named app_api_token, the value of which is the API key from the alerts.
  9. Add string parameter named integration_api_token, the value of which is the API key from the incidents.
  10. Add string parameter named api_url, the value of which is https://api.opsgenie.com or https://api.eu.opsgenie.com for Europe.
  11. Save your configuration.
  12. Go to the Configuration > Collectors menu and select Collectors.
  13. Select the Central collector.
  14. Click the Export configuration button.
  15. Check the Generate configuration filesStart debugging the monitoring engine (-v) and Move generated files boxes.
  16. Click the Export button.
  17. Use SSH to log in to the Centreon central server with a root user.
  18. Restart the cbd Daemon
    systemctl restart cbd

     

Well done! Your Centreon platform is now ready to send alerts to Opsgenie! 

 

Example of a Centreon alert being followed up in Opsgenie

 

Origin: Centreon

Let's take a closer look at the itinerary of an alert. Our host Yellow-submarine is monitored by Centreon. There is an alert on the sky-of-blue service. 

 

Transmission: the Stream Connector

By setting an increased verbosity level for the Stream Connector logs, we get the following information:

Wed Feb 10 11:08:05 2021: INFO: EventQueue:call: request body {"message":"2021-02-10 11:08:05 Yellow-submarine // sky-of-blue is CRITICAL","description":"sky is cloudy","alias":"Yellow-submarine_sky-of-blue_CRITICAL"}
Wed Feb 10 11:08:05 2021: INFO: EventQueue:call: Call url https://api.eu.opsgenie.com/v2/alerts
Wed Feb 10 11:08:05 2021: INFO: EventQueue:call: HTTP Code: 202
Wed Feb 10 11:08:05 2021: INFO: EventQueue:call: Response body: {"result":"Request will be processed","took":0.007,"requestId":"e2543449-9399-44ff-89a9-875040906a0c"}

In its basic operation, we can see the Stream Connector generates a JSON formatted for Opsgenie. The JSON is then sent to the appropriate address. 

Opsgenie indicates the alert has been received. 

 

Reception: Opsgenie

In Opsgenie, we can now see the alert on the sky-of-blue service.

Let's go into the details of this alert.

We can follow up the activities of this alert in Opsgenie, corresponding to the processing done by the Centreon Stream Connector!

 

To go further

The Stream Connector offers numerous options to help refine the alerts sent to Opsgenie. Our documentation dedicated to the Stream Connector will provide every detail to help you customize configuration. 

 

Centreon Support does not actively maintain knowledge articles. If you have questions or require assistance with an article, please create a case or post a comment below.

6 replies

Drakunos
Forum|alt.badge.img+1
  • Steward *
  • September 19, 2023

I would like to check if there is already a way to close calls (events) through the stream connector, just like it is done in Zabbix https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/media/opsgenie/ media_opsgenie.yaml line 378


Today in the version of opsgenie-events-apiv2.lua we do not have this option to close the alerts even in the case of an OK event, in this case it only opens an event in opsgenie as "is OK" there would be a new version with this option. 


raphael.loureiro
Forum|alt.badge.img+1

I would like to check if there is already a way to close calls (events) through the stream connector, just like it is done in Zabbix https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/media/opsgenie/ media_opsgenie.yaml line 378


Today in the version of opsgenie-events-apiv2.lua we do not have this option to close the alerts even in the case of an OK event, in this case it only opens an event in opsgenie as "is OK" there would be a new version with this option. 

I'm also interested in this subject, we have a POC between Centreon x Opsgenie.

I would like Centreon to send the closed for the event on Opsgenie.


tcharles
Centreonian
Forum|alt.badge.img+5
  • Author
  • Centreonian
  • September 28, 2023

Hello @Drakunos 

 

from the look of it, it seems doable. It requires some substantial changes and I do not have the time to do it in the coming days. 

 

I just have a doubt regarding the close alert endpoint. It requires the alert alias and the one we create may not be compatible with this feature.

 

 


Forum|alt.badge.img
  • Steward *
  • October 10, 2023

Actually, the existing logic implemented in opsgenie-events-apiv2.lua is wrong.

 

When an alert is closed, the monitoring system should not send a new alert in Opsgenie, it should close the existing one.

How Opsgenie does that is by using the Alias. So to do this someone needs to modify the script. 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.

 

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

 

It would be great if someone fixed this.


Forum|alt.badge.img+8
  • Steward **
  • November 24, 2023

it’s strange, option to rewrite default parameter does not work with the v2 script. (for ex host_alert_alias)

 

https://docs.centreon.com/fr/docs/integrations/event-management/sc-opsgenie/

 

 


Forum|alt.badge.img+8
  • Steward **
  • January 22, 2024

I don’t understand why centreon is not present on documentation of opsgenie  https://support.atlassian.com/opsgenie/docs/integrate-opsgenie-with-your-apps/

Every monitoring tools was present :(

And a lot of notification script is present here https://github.com/opsgenie/oec-scripts/blob/master/README.md, bug centreon is missing.