martindstone / pagerduty-cli

A command line interface for PagerDuty
MIT License
91 stars 13 forks source link

Alert Events API #34

Closed zerolaser closed 1 year ago

zerolaser commented 2 years ago

Please develop the event's API feature.

https://developer.pagerduty.com/docs/ZG9jOjExMDI5NTgx-sending-an-alert-event

Ability to Create an alert to any pagerduty service using routing key/integration key.

martindstone commented 2 years ago

Hi @zerolaser, this is something i originally personally thought might be nice but i was conflicted as it seemed too trivial, in other words i didn't see how pd could add any value above what you could do with curl - can you tell me more about how you would imagine this working and how you'd want to use it?

zerolaser commented 2 years ago

Yeah! I understand the use-case for this is very trivial. We have a very special case to trigger an event against all the pagerduty services to Test Readiness of the teams before the holiday period.

We grab the integration key(one key at random) of each service and then run the curl command to trigger an event/incident against each service using that key.

curl -H "Content-type: application/json" -X POST \
              -d "{
                \"payload\": {
                  \"summary\": \"[Alert] PagerDuty Readiness Test \",
                  \"severity\": \"critical\",
                  \"custom_details\": {
                      \"Description\": \"Please Resolve the incident. No further action needed. "
                  }
                  },
                   \"routing_key\": \"$key\",
                   \"event_action\": \"trigger\"
                   }
      }" \
          "https://events.pagerduty.com/v2/enqueue"
martindstone commented 2 years ago

Hi @zerolaser I had a few spare minutes so I made pd event alert to send an alert and pd event change to send a change event, and they actually came out pretty nice. They are in the RC I just published; you can use pd update rc to try it out, pd update stable if you need to go back to the old version... Let me know what you think, I will be promoting it to stable shortly.

martindstone commented 1 year ago

Hi @zerolaser I have promoted 0.1.6 with these additional commands to stable, so I am going to close this issue now... Please let me know if you need anything else related to this issue....