Acing PagerDuty ChatOps in Slack with YellowAnt
PagerDuty is an incident management platform that lets you know when shit goes down. But more than just a world-class service, PagerDuty is an amazing company with a fantastic team and an awesome culture with a single mission — to make our lives easier. We built a PagerDuty integration for YellowAnt so that the hard working folks that are on-call can resolve incidents with speed and precision through simple ChatOps.
This blog will take you through how to ace ChatOps with Pagerduty in Slack using YellowAnt.
First things first…
- Create an account on YellowAnt. It’s free! If you have Slack account, it takes 5 seconds(and installs @yellowant bot in your Slack) to signup. If not, it takes less than a minute. Do it now.
- Next, click on “Marketplace” and search for PagerDuty.
- Click on “Integrate”
- In the PagerDuty integration page, click on “Add account”
- Get your PagerDuty API token. If you’re on a non-premium plan, ask for an API Token(read or read-write access) from your PagerDuty admin. If you are on the Premium plan, you can get it by following the steps below:
Getting your Pagerduty token
- Login to Pagerduty
- In the top right corner, select My Profile
- Click on User Settings
- Click on Create API Token. Choose v2 API token, add a description and click on Create token. Copy this token
- In the YellowAnt PagerDuty page, enter your API token and your PagerDuty email and click on Save
- YellowAnt will acknowledge the integration and create a new integration with command invoke name pagerduty.
- Head over to the YellowAnt console(or Slack @yellowant DM) and create a Service Notification Webhooks URL in YellowAnt using the command — pagerduty create_webhook
- Copy the webhook
- Go to your PagerDuty page and select your Service from Configuration — -> Services.
- Select the Integrations tab and click on New Extension
- Select Generic Webhook. Give it a name and paste the URL you copied a while ago
- Repeat the above steps for all the Services you want notifications from
Congratulations! You have setup PagerDuty for YellowAnt!
It’s magic time!
Head over to YellowAnt or Slack(@yellowant DM), whichever one you prefer and type the following command:
pagerduty on_call
This will show you all the users that are on call right now!
Querying for incidents
Let’s query for incidents! The syntax is :
pagerduty get_incident incident_number <integer>
So let’s try: pagerduty get_incident incident_number “2”
You can Acknowledge or resolve the incident or list the alters related to the incident. You can also see who is on call!
Notifications and Alerts
YellowAnt sends notifications about all new PagerDuty incidents that you declared while setting up the Notification Webhook. Here is what a new alert looks like:
Let’s go ahead and acknowledge it — just click the Acknowledge button!
Let’s click on Resolve to resolve the incident
There are lots of other commands you can try. Simply type help pagerduty or just pagerduty
You can add notes to incidents, get alerts that triggered the incidents, get schedules and users in a schedule and a lot more.
You can snooze an incident with a simple command —
pagerduty snooze_incident incident_number <integer> duration <time-in-seconds>
Let’s snooze incident 21 for 1 hour.
pagerduty snooze_incident incident_number 21 duration 3600
Coming soon — Part 2 — Making your PagerDuty more powerful with YellowAnt Crumbs(Workflows)
In our next post, we will show you how to create powerful command and event triggered workflows with PagerDuty and other tools like JIRA, Asana, GMail, Jenkins, CircleCI, New Relic, Slack and other tools.
Hope you liked this tutorial — let us know what you think in the comments below or in the YellowAnt community Slack — Join here!