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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to enable integration with OpsGenie?

Hello,
I had to install OpsGenie Edge Connector on our test Jira server but when I am trying to submit alert on OpsGenie side, I can't get Jira SD to make ticket from that alert. Communication works from OpsGenie (OG) to Jira SD server. This is part of the output.txt file:
WARNING:root:[createIssue] Could not execute at Jira Service Desk; response: b'{"errorMessages":[],"errors":{"components":"Component/s is required."}}' status code: 400
In the settings for that project there are fields which are needed for creation of the ticket. "Component/s" is there as hidden. I was not able to remove it completely. When I made it blank - didn't help
I tried to define "Component/s" on OG side but no success as well. I am still getting above warning.
Can you please help me get thru that error message so Jira SD could create tickets based on OG alerts?

1 answer

1 vote
Robert Atlassian Team Jul 02, 2020

Hi @pavol_cvincek01 !

 

If the Jira project and issue type you are sending alerts to have (non-standard) required fields (like a component), there are two main options for getting them filled:

 

  1. Use Manual Issue Creation for Jira Software. This flow will essentially bring up the same Create Issue modal from Jira, including custom fields. The downside of this option is it isn't automated; a user would have to click the "Create Issue" button in an alert. 2020-07-02_11-50-38_01.png
  2. Customize the OEC script to include component in the createIssue action: https://github.com/opsgenie/oec-scripts/blob/master/Jira/scripts/actionExecutor.py#L113

    This would end up looking something like this:
     content_params = {
    "fields": {
    "project": {
    "key": project_key
    },
    "issuetype": {
    "name": issue_type_name
    },
    "summary": queue_message.get("summary"),
    "description": queue_message.get("description"),
    "labels": [toLabel.replace("\\s", "")],
    "components": [{
    "id": component
    }]
    }
    }

Hope this helps!

Hello Robert,
First of all, thanks a lot for your feedback. Option 1 is not suitable for us so I went for second one. I added "compoment" there as suggested but after I started OEC I could see there error saying " NameError: name 'component' is not defined". I tried to define it by adding "import component" on the top of the actionExecutor.py but another problem appeared - "ImportError: No module named 'component". It would be great if you would be able to advice with this as well.
Thank you in advance and have a nice day.

Robert Atlassian Team Jul 13, 2020

Hi @pavol_cvincek01 !

 

The "component" I had included in that snippet was an example variable name, so there's no need to do any additional imports in the script.

You would need to define "component" somewhere in the script, or at least substitute it with your component ID:

 

 content_params = {
"fields": {
"project": {
"key": project_key
},
"issuetype": {
"name": issue_type_name
},
"summary": queue_message.get("summary"),
"description": queue_message.get("description"),
"labels": [toLabel.replace("\\s", "")],
"components": [{
"id": "12345"
}]
}
}

Hope this helps clarify things a bit!

Hi @Robert 
Yep, I used our value for component at first but no success as mentioned above. Afterwards I changed "id" to "name" and it finally works. Thanks a lot for that, it helped significantly.


Unfortunately now I can see this there:
"WARNING:root:[createIssue] Could not execute at Jira Service Desk; response: b'{"errorMessages":[],"errors":{"customfield_13040":"Field Customer Request Type is required.","customfield_15340":"Field Did It work in the past? is required."}}' status code: 400"

Field Customer Request Type should be "Alerts"
Field Did It work in the past? should be "Yes"

When I tried the same approach like for "components" I wasn't successful. Can you advice how the code should looks like?

Thanks in advance and have a nice day.

Robert Atlassian Team Jul 15, 2020

@pavol_cvincek01 I think you're on the right track by following the same process as the first field. My first guess is those fields might be a different "type" of custom field though, so the format in the API request may need to be modified.

 

This page has some great examples in the Creating an issue using custom fields section. I'd check the types of those custom fields and make sure they're using the format mentioned in those docs.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Opsgenie

New! Investigate and re-deploy stable deployments from the Incident Investigation view in Opsgenie

We’re excited to announce the latest enhancement to Opsgenie’s Incident Investigation view. Now when an incident occurs users can select the previous stable deployment, and begin the redeployment pro...

305 views 0 3
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you