Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"extraProperties" or "Details (Key-Value Based)" on alert create #51

Open
nosretep opened this issue Mar 10, 2019 · 6 comments
Open

"extraProperties" or "Details (Key-Value Based)" on alert create #51

nosretep opened this issue Mar 10, 2019 · 6 comments

Comments

@nosretep
Copy link

Maybe it's staring me in the face, but is there a way to add "extraProperties" during alert create? I know "tags" exist, but they can get messy quick.

@Castaglia
Copy link
Contributor

What sort of extra properties would you want to be adding to the alert creation request?

@nosretep
Copy link
Author

nosretep commented Mar 10, 2019

the "extraProperties" noted here https://docs.opsgenie.com/docs/integration-api.

Within Opsgenie integrations and policies, these are also known as "Details (Key-Value Based)", and can be used to help filter/chain alerts.

screenshots are from a slack integration's "Alert Filter:"

details key value filter

options list

@nosretep
Copy link
Author

nosretep commented Mar 13, 2019

"extraProperties", implemented as "Details (Key-Value Based)" in drop downs, can also be used for policy configurations.

extraProperties for policies

@nosretep
Copy link
Author

nosretep commented Mar 13, 2019

"extraProperties" must be deprecated, I think they now use "details" in its place. Command line curl direct to Opsgenie's REST API, I am sending "details" as JSON, and it is converted to "_extraProperties" within the Opsgenie logs.

"details" is referenced here: https://docs.opsgenie.com/docs/alert-api

You definitely want to consider adding "details" to the sensu-opsgenie API, it is extremely useful.

@nosretep nosretep changed the title "extraProperties" on alert create "extraProperties" or "Details (Key-Value Based)" on alert create Mar 25, 2019
@jayjani10
Copy link

If I manually add the field by selecting from dropdown "Details(Key-Value Based)", I am able to add to opsgenie.
Then, I send GET request to https://www.api.opsgenie.com/v2/integrations/{id}/actions
So, I get

{
    "field": "extra_properties_key_prefix-Entity",
    "not": false,
    "operation": "equals",
    "expectedValue": "Website"
}

But then if I want to push same value (POST method) through code by adding above object, I am not able to. :(

Can someone help me with this?

@jayjani10
Copy link

I got the answer! It's working

While posting data in Opsgenie, for a Key-Value based entity,
keep this in mind:
DOn't forget to put this.
"isExtraPropertiesWithKey":true
And the field name should be our "key", unlike the above GET request "extra_properties_key_prefix-Entity"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants