|
| 1 | +--- |
| 2 | +cog_bundle_version: 3 |
| 3 | + |
| 4 | +name: pagerduty |
| 5 | +version: 0.1.0 |
| 6 | +description: Interact with the pagerduty |
| 7 | +permissions: |
| 8 | + - pagerduty:read |
| 9 | + - pagerduty:write |
| 10 | + - pagerduty:alert |
| 11 | +commands: |
| 12 | + alert: |
| 13 | + executable: /Users/mpeck/op/pagerduty/cog-command |
| 14 | + documentation: | |
| 15 | + pagerduty:alert [-s|--service <service name>] <msg> - Trigger an alert on the specified service |
| 16 | + pagerduty:alert <msg> - Trigger an alert on the default service |
| 17 | +
|
| 18 | + Returns a confirmation message on success |
| 19 | +
|
| 20 | + Requires the following environment variables: |
| 21 | +
|
| 22 | + PAGERDUTY_ACCOUNT_SUBDOMAIN |
| 23 | + PAGERDUTY_ACCOUNT_TOKEN |
| 24 | +
|
| 25 | + Behavior is configured by the following environment variables: |
| 26 | +
|
| 27 | + PAGERDUTY_DEFAULT_SERVICE_KEY - If no service is passed, this is the id of the service to use. |
| 28 | +
|
| 29 | + Note: If no service is passed and the default service key is not set, the command will fail. |
| 30 | +
|
| 31 | + rules: |
| 32 | + - must have pagerduty:alert |
| 33 | + options: |
| 34 | + service: |
| 35 | + type: string |
| 36 | + required: false |
| 37 | + short_flag: s |
| 38 | + oncall: |
| 39 | + executable: /Users/mpeck/op/pagerduty/cog-command |
| 40 | + documentation: | |
| 41 | + pagerduty:oncall - Return a list of services and the name and email of the primary oncall |
| 42 | + pagerduty:oncall <service> - Return the oncall for the sepcified service |
| 43 | +
|
| 44 | + Requires the following environment variables: |
| 45 | +
|
| 46 | + PAGERDUTY_ACCOUNT_SUBDOMAIN |
| 47 | + PAGERDUTY_ACCOUNT_TOKEN |
| 48 | +
|
| 49 | + rules: ["allow"] |
| 50 | + ack: |
| 51 | + executable: /Users/mpeck/op/pagerduty/cog-command |
| 52 | + documentation: | |
| 53 | + pagerduty:ack <incident id> - Acknowledge the incident |
| 54 | + pagerduty:ack [-a | --as <pagerduty user email>] <incident id> Acknowledge the incident as the account specified by the email |
| 55 | +
|
| 56 | + Returns confirmation of acknowledgement |
| 57 | +
|
| 58 | + Requires the following environment variables: |
| 59 | +
|
| 60 | + PAGERDUTY_ACCOUNT_SUBDOMAIN |
| 61 | + PAGERDUTY_ACCOUNT_TOKEN |
| 62 | +
|
| 63 | + Behavior is configured by the following environment variables: |
| 64 | +
|
| 65 | + PAGERDUTY_DEFAULT_EMAIL - The default pagerduty email to acknowledge incidents as |
| 66 | + PAGERDUTY_EMAIL_FOR_<COG USER> - Used to map cog users to pagerduty emails |
| 67 | +
|
| 68 | + An email mapping to a pagerduty account is required in order to ack incidents. If the |
| 69 | + '--as' option has been specified then that email will be used. If not this command will |
| 70 | + first look for an environment variable in the form of 'PAGERDUTY_EMAIL_FOR_<COG USER>', |
| 71 | + so if your user name is 'bob', the env var will be 'PAGERDUTY_EMAIL_FOR_BOB', and use |
| 72 | + that email to acknowledge the incident. If that fails it will try 'PAGERDUTY_DEFAULT_EMAIL' |
| 73 | + If none of those vars are specified and the '--as' option is not passed, the command will |
| 74 | + fail. |
| 75 | +
|
| 76 | + rules: |
| 77 | + - must have pagerduty:write |
| 78 | + options: |
| 79 | + as: |
| 80 | + type: string |
| 81 | + required: false |
| 82 | + short_flag: a |
| 83 | + resolve: |
| 84 | + executable: /Users/mpeck/op/pagerduty/cog-command |
| 85 | + documentation: | |
| 86 | + pagerduty:resolve <incident id> - Resovle the incident |
| 87 | + pagerduty:resolve [-a | --as <pagerduty user email>] <incident id> Resolve the incident as the account specified by the email |
| 88 | +
|
| 89 | + Returns confirmation of resolution |
| 90 | +
|
| 91 | + Requires the following environment variables: |
| 92 | +
|
| 93 | + PAGERDUTY_ACCOUNT_SUBDOMAIN |
| 94 | + PAGERDUTY_ACCOUNT_TOKEN |
| 95 | +
|
| 96 | + Behavior is configured by the following environment variables: |
| 97 | +
|
| 98 | + PAGERDUTY_DEFAULT_EMAIL - The default pagerduty email to acknowledge incidents as |
| 99 | + PAGERDUTY_EMAIL_FOR_<COG USER> - Used to map cog users to pagerduty emails |
| 100 | +
|
| 101 | + An email mapping to a pagerduty account is required in order to resolve incidents. If the |
| 102 | + '--as' option has been specified then that email will be used. If not this command will |
| 103 | + first look for an environment variable in the form of 'PAGERDUTY_EMAIL_FOR_<COG USER>', |
| 104 | + so if your user name is 'bob' the env var will be 'PAGERDUTY_EMAIL_FOR_BOB', and use |
| 105 | + that email to acknowledge the incident. If that fails it will try 'PAGERDUTY_DEFAULT_EMAIL' |
| 106 | + If none of those vars are specified and the '--as' option is not passed, the command will |
| 107 | + fail. |
| 108 | +
|
| 109 | + rules: |
| 110 | + - must have pagerduty:write |
| 111 | + options: |
| 112 | + as: |
| 113 | + type: string |
| 114 | + required: false |
| 115 | + short_flag: a |
| 116 | + incidents: |
| 117 | + executable: /Users/mpeck/op/pagerduty/cog-command |
| 118 | + documentation: | |
| 119 | + pagerduty:incidents [-a | --acked] [-t | --triggered] [-r | --resolved] [-l | --limit] |
| 120 | +
|
| 121 | + Returns incidents matching the specified option. By default, only returns triggered incidents. |
| 122 | +
|
| 123 | + Requires the following environment variables: |
| 124 | +
|
| 125 | + PAGERDUTY_ACCOUNT_SUBDOMAIN |
| 126 | + PAGERDUTY_ACCOUNT_TOKEN |
| 127 | +
|
| 128 | + rules: |
| 129 | + - must have pagerduty:read |
| 130 | + options: |
| 131 | + triggered: |
| 132 | + type: bool |
| 133 | + required: false |
| 134 | + short_flag: t |
| 135 | + acked: |
| 136 | + type: bool |
| 137 | + required: false |
| 138 | + short_flag: a |
| 139 | + resolved: |
| 140 | + type: bool |
| 141 | + required: false |
| 142 | + short_flag: r |
| 143 | + limit: |
| 144 | + type: int |
| 145 | + required: false |
| 146 | + short_flag: l |
| 147 | +templates: |
| 148 | + oncall: |
| 149 | + slack: "{{ name }} - {{ oncall.name }}({{ oncall.email }})" |
| 150 | + hipchat: "{{ name }} - {{ oncall.name }}({{ oncall.email }})" |
| 151 | + incidents: |
| 152 | + slack: "Service: {{ service.name }} {{ url }}\nStatus: {{ status }}\n{{ summary.subject }} {{ summary.description }}\n" |
| 153 | + hipchat: "Service: {{ service.name }} {{ url }}\nStatus: {{ status }}\n{{ summary.subject }} {{ summary.description }}\n" |
| 154 | + noresults: |
| 155 | + slack: "Sorry, no results were returned." |
| 156 | + hipchat: "Sorry, no results were returned." |
0 commit comments