pagerduty: The Cog PagerDuty Command Bundle
!pagerduty:alert Customers complaining the site is down. Need help in #support !pagerduty:oncall !pagerduty:incidents !pagerduty:ack PHNRH53 !pagerduty:resolve PHNRH53
PagerDuty Command: Finding out who is currently oncall
pagerduty bundle adds five new commands: ack, resolve, alert, incidents
- ack - Acknowledge triggered incidents
ack [-a | --as <pagerduty user email>] <incident id>
ackrequires a pagerduty user's email address to acknowledge an incident. If
--asis not passed ack will first look for an env var called
COG USERis the Cog username for the user making the request. If that var isn't found it will fall back to
PAGERDUTY_DEFAULT_EMAIL. If neither are found the command will fail.
- resolve - Resolve incidents
resolve [-a | --as <pagerduty user email>] <incident id>
resolveworks identically to
ack. First looking for
PAGERDUTY_EMAIL_FOR_<COG USER>and then
- alert - Trigger an incident on a specific service.
alert [-s | --service <service name>] <msg>Optionally you can set the
alertwill then trigger incidents on that service when no service is passed.
- incidents - Get a list of incidents
incidents [-a | --acked] [-t | --triggered] [-r | --resolved] [-l | --limit]Get a list of incidents based on the option or options passed. By default incidents will return only incidents in the
- oncall - Get a list of services with the current primary oncall
oncall [service name]If a service is passed only the oncall for that service will be returned. Otherwise a list of services with their corresponding user will be returned.
pagerduty comes bundles with three permissions: pagerduty:alert, pagerduty:read,
pagerduty:write. By default
oncall is 'allowed'. To
alert you will need the
pagerduty:alert permission. To see incidents, pagerduty:read. And to
The pager duty bundle still uses the v1 API. You'll need to select this when creating an account token.
pagerduty uses a few env vars to configure it. All commands require
PAGERDUTY_ACCOUNT_TOKEN to be set. That would
be the subdomain for your PagerDuty account and the api token respectively.
alert has an optional var,
PAGERDUTY_DEFAULT_SERVICE_KEY. This is the integration
key found on the integration tab for the service on PagerDuty's web ui. If set, any
alerts that don't specify a service will be sent here. Note that if the service key
is not set or a service isn't passed to the command, it will fail.
resolve have a couple extra vars.
PAGERDUTY_DEFAULT_EMAIL, similar to
resolve will use this email as the
requester when acking or resolving incidents. Additionally you may attach the
requester to cog accounts. Using vars in the form,
you can specify which PagerDuty email is associated with which Cog user. So for
example, if your Cog username is 'bob', you would set the var
Then whenever you
resolve the proper PagerDuty account is associated with the
curl -O https://raw.githubusercontent.com/cogcmd/pagerduty/master/config.yaml cogctl bundle install config.yaml
To build the Docker image, simply run:
$ rake image
Requires Docker and Rake.