Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Opsgenie does not notify slack if there are problems with a Jenkins pipeline

João Freire September 20, 2021

Greetings, I'm integrating Opsgenie with Jenkins from pipelines. I created 2 pipelines with the same code that represents a sample code present in this link: https://support.atlassian.com/opsgenie/docs/integrate-opsgenie-with-jenkins/.

In the first case use the groovy sandbox to run the pipeline script and in the second case I ran the script from a Jenkinsfile.

Case 1:

Jenkins Pipeline:

Screenshot at Sep 20 15-01-28.png

Jenkins Pipeline Job:

Screenshot at Sep 20 15-03-32.png

Opsgenie notification (via slack):

Screenshot at Sep 20 15-13-55.png

In this case, everything went as it should. I ran the pipeline and gave an error to verify that the failure notification appeared in Opsgenie and is validated.

Case2:

 

Jenkinsfile:

Screenshot at Sep 20 15-27-55.png

Jenkins Pipeline:

Screenshot at Sep 20 15-28-45.png

Jenkins Pipeline Job:

Screenshot at Sep 20 15-29-51.png
As you can see in the Jenkins pipeline job screenshot, the request for Opsgenie is made. My question or problem is that Opsgenie does not notify slack as it did in the first case, so I would like to have some help here if possible. 
cheers.

1 answer

1 vote
Justin Sitarz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 21, 2021

Hi João!

 

Justin here, from Opsgenie support - happy to help!

 

There are a few common culprits that can prevent a particular alert from sending out to Slack - it may be that the alert that is created is not assigned to the same team as the Slack integration, or it may be that the Slack integration has some filtering in place that is preventing alerts matching certain criteria from sending outbound. 

 

For the first - can you check to see that both of these alerts in Opsgenie are assigned to the same team as your Slack integration? You can find the assigned responder teams here on the alert:

 

alert.png

 

 

You'll want to ensure that this is the same as your Slack integration:

 

integration-team.png

 

 

Additionally, you'll want to check if there are any filters here, on the Slack integration, that might be preventing the alert from sending out to Slack:

 

alert-filter.png

 

 

Those are the most common causes of something like this, but if that doesn't solve the issue, please feel free to respond here, or reach out to us directly at support.atlassian.com. 

 

Thanks!

 

Justin S.

Atlassian Cloud Support

João Freire September 22, 2021


Good morning, thanks for the reply. I think I exposed the error incorrectly. The problem isn't in the slack because the alert doesn't reach Opsgenie. What I exposed already worked correctly with the same code by a pipeline script or a pipeline script by scm.

 

That said, my company only uses scripted pipelines. The code shown above refers to the example of this link : https://support.atlassian.com/opsgenie/docs/integrate-opsgenie-with-jenkins/  .This code is declarative and works correctly, the alert is sent to Opsgenie and later to slack. 

 

But as mentioned above, we only use scripted pipelines and what happens is that when I call the Opsgenie function in this type of pipeline, the output says that the alert is sent but it doesn't reach Opsgenie.

 

Scripted Pipeline Code:

 

Screenshot at Sep 22 12-51-49.png

 

Output of Scripted Pipeline:

 

Screenshot at Sep 22 12-53-37.png


Supposedly job data is sent to Opsgenie but the alert does not appear in Opsgenie when the command is called within a scripted pipeline.

Is something missing in my code or does Opsgenie only allow in-command invocation in declarative pipelines?

Cheers.

Justin Sitarz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 22, 2021

Hi João, 

 

Ah, thanks for the additional information! With that in mind, I *suspect* that the issue has to do with your Opsgenie configuration - it may be that the data is received by Opsgenie, but doesn't match the filter conditions for the rules in the 'Create Alert' action for your integration - see below for a screenshot of where this is found:

 

Screen Shot 2021-09-22 at 8.43.23 AM.png

 

The best way to check this is to view the logs (Settings >> Logs), where all incoming requests will be displayed, whether they trigger an alert to be created or not. You can search the logs using the name or ID of the Jenkins integration, and will see all request received by that integration, and can confirm if the specific notification from your scripted pipeline.

You may also want to reach out to us directly at support.atlassian.com, or through the in-app chat (found in the lower right hand corner of the application - note -i f you don't see the in-app chat option, it may be due to an ad-blocker extension in your browser.)

We may need to gain access to your account to do some additional troubleshooting of the issue, so contacting us directly would be the best way to achieve that. 

 

Thanks!

 

Justin S.

Atlassian Cloud Support

João Freire September 23, 2021

Good morning Justin, thanks for your help. I didn't know where I could see the logs and what was happening was that the status always showed up as "Success". So I added this line in my code and it's working correctly.

 

Screenshot at Sep 23 11-37-58.png

Thanks again for your availability.

Cheers.

Like Steffen Opel _Utoolity_ likes this
Justin Sitarz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 23, 2021

Hi João, 

 

Excellent, glad it's working now! Is there anything else we can help with?

 

Best, 

 

Justin S.

Atlassian Cloud Support

João Freire September 28, 2021

I don't think I have any problems for now, thank you so much for your attention.

Cheers.

Like Justin Sitarz likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events