sensu-plugins / sensu-plugins-opsgenie

Sensu plugins for OpsGenie
http://sensu-plugins.io
MIT License
4 stars 24 forks source link

Field "teams" on README needs to be updated #31

Closed epierotto closed 6 years ago

epierotto commented 6 years ago

According to OpsGenie alert API docs the field teams should look like this:

"teams":[{"id":"4513b7ea-3b91-438f-b7e4-e3e54af9147c"}, {"name":"rocket_team"}]

Either id or name of each team should be provided.

On the current README that field is just an array of strings which is incorrect and causes that the alert is being rejected by OpsGenie alert API:

{
  "opsgenie": {
    "customerKey": "the-key",
    "teams": ["teams"],
    "recipients": "the-recipients",
    "source": "alert-source",
    "overwrite_quiet_hours": true,
    "tags": ["sensu"]
  }
}

The example should be:

{
  "opsgenie": {
    "customerKey": "the-key",
    "teams":[{"id":"4513b7ea-3b91-438f-b7e4-e3e54af9147c"}, {"name":"rocket_team"}],
    "recipients": "the-recipients",
    "source": "alert-source",
    "overwrite_quiet_hours": true,
    "tags": ["sensu"]
  }
}

This is the error that you get if you send an array of strings on teams field:

HTTP 422 Unprocessable Entity: {\"message\":\"'teams#null' is invalid\",\"took\":0.003,\"requestId\":\"88551b5a-4ac4-40cd-8ff2-25822ed9f86a\"}\n"]}

Castaglia commented 6 years ago

@majormoses I think this ticket can be closed now, as addressed/fixed?