GithubHelp home page GithubHelp logo

hubot-archive / hubot-pager-me Goto Github PK

View Code? Open in Web Editor NEW
74.0 6.0 93.0 1.25 MB

PagerDuty integration for Hubot

Home Page: https://www.npmjs.com/package/hubot-pager-me

License: MIT License

Shell 0.96% JavaScript 99.04%
hubot hubot-scripts pagerduty hacktoberfest

hubot-pager-me's Introduction

hubot-pager-me

npm version Node CI

PagerDuty integration for Hubot.

Installation

In your hubot repository, run:

npm install hubot-pager-me --save

Then add hubot-pager-me to your external-scripts.json:

["hubot-pager-me"]

Configuration

Upgrading from v2.x? The HUBOT_PAGERDUTY_SUBDOMAIN parameter has been replaced with HUBOT_PAGERDUTY_FROM_EMAIL, which is sent along as a header to indicate the actor for the incident creation workflow. This would be the email address for a bot user in PagerDuty.

Environment Variable Required? Description
HUBOT_PAGERDUTY_API_KEY Yes The REST API Key for this integration.
HUBOT_PAGERDUTY_FROM_EMAIL Yes The email of the default "actor" user for incident creation and modification.
HUBOT_PAGERDUTY_USER_ID No* The user ID of a PagerDuty user for your bot. This is only required if you want chat users to be able to trigger incidents without their own PagerDuty user.
HUBOT_PAGERDUTY_SERVICE_API_KEY No* The Incident Service Key to use when creating a new incident. This should be assigned to a dummy escalation policy that doesn't actually notify, as Hubot will trigger on this before reassigning it.
HUBOT_PAGERDUTY_SERVICES No Provide a comma separated list of service identifiers (e.g. PFGPBFY,AFBCGH) to restrict queries to only those services.
HUBOT_PAGERDUTY_SCHEDULES No Provide a comma separated list of schedules identifiers (e.g. PFGPBFY,AFBCGH) to restrict queries to only those schedules.

* - May be required for certain actions.

Webhook

Environment Variable Required? Description
HUBOT_PAGERDUTY_ENDPOINT Yes PagerDuty webhook listener on your Hubot's server. Must be public. Example: /hook.
HUBOT_PAGERDUTY_ROOM Yes Room in which you want the pagerduty webhook notifications to appear. Example: #pagerduty

To setup the webhooks and get the alerts in your chatrooms, you need to add the endpoint you define here (e.g /hooks) in the service settings of your PagerDuty accounts. You also need to define the room in which you want them to appear. That is, unless you want to spam all the rooms with alerts, but we don't believe that should be the default behavior. ๐Ÿ˜

Example interactions

Trigger an incident assigned to a specific user:

technicalpickles> hubot pager trigger jnewland omgwtfbbq
hubot> technicalpickles: :pager: triggered! now assigning it to the right user...
hubot> technicalpickles: :pager: assigned to jnewland!

Trigger an incident assigned to an escalation policy:

technicalpickles> hubot pager trigger ops site is down
hubot> Shell: :pager: triggered! now assigning it to the right user...
hubot> Shell: :pager: assigned to ops!

Check on open incidents:

technicalpickles> hubot pager sup
hubot>
      Triggered:
      ----------
      8: 2014-11-05T20:17:50Z site is down - @technicalpickles - assigned to jnewland

      Acknowledged:
      -------------
      7: 2014-11-05T20:16:29Z omgwtfbbq - @technicalpickles - assigned to jnewland

Acknowledge triggered alerts assigned to you:

jnewland> /pager ack
hubot> jnewland: Incident 9 acknowledged

Resolve acknowledged alerts assigned to you:

jnewland> /pager resolve
hubot> jnewland: Incident 9 resolved

Check up coming schedule, and schedule shift overrides on it:

technicalpickles> hubot pager schedules
hubot> * Ops - https://urcompany.pagerduty.com/schedules#DEADBEE
technicalpickles> hubot pager schedule ops
hubot> * 2014-06-24T09:06:45-07:00 - 2014-06-25T03:00:00-07:00 technicalpickles
       * 2014-06-25T03:00:00-07:00 - 2014-06-26T03:00:00-07:00 jnewland
       * 2014-06-26T03:00:00-07:00 - 2014-06-27T03:00:00-07:00 technicalpickles
       * 2014-06-27T03:00:00-07:00 - 2014-06-28T03:00:00-07:00 jnewland
       * 2014-06-28T03:00:00-07:00 - 2014-06-29T03:00:00-07:00 technicalpickles
technicalpickles> hubot pager override ops 2014-06-25T03:00:00-07:00 - 2014-06-26T03:00:00-07:00 chrislundquist
hubot> Override setup! chrislundquist has the pager from 2014-06-25T06:00:00-04:00 until 2014-06-26T06:00:00-04:00
technicalpickles> hubot pager schedule
hubot> * 2014-06-24T09:06:45-07:00 - 2014-06-25T03:00:00-07:00 technicalpickles
       * 2014-06-25T03:00:00-07:00 - 2014-06-26T03:00:00-07:00 chrislundquist
       * 2014-06-26T03:00:00-07:00 - 2014-06-27T03:00:00-07:00 technicalpickles
       * 2014-06-27T03:00:00-07:00 - 2014-06-28T03:00:00-07:00 jnewland
       * 2014-06-28T03:00:00-07:00 - 2014-06-29T03:00:00-07:00 technicalpickles

Conventions

hubot-pager-me makes some assumptions about how you are using PagerDuty:

  • PagerDuty email matches chat email
    • override with hubot pager me as <pagerduty email>
  • The Service used by hubot-pager-me should not be assigned to an escalation policy with real people on it. Instead, it should be a dummy user that doesn't have any notification rules. If this isn't done, the escalation policy assigned to it will be notified, and then Hubot will immediately reassign to the proper team

Development

Fork this repository, and clone it locally. To start using with an existing Hubot for testing:

  • Run npm install in hubot-pager-me repository
  • Run npm link in hubot-pager-me repository
  • Run npm link hubot-pager-me in your Hubot directory
  • NOTE: if you are using something like nodenv or similar, make sure your npm link from the same node version

There's a few environment variables useful for testing:

  • HUBOT_PAGERDUTY_NOOP: Don't actually make POST/PUT HTTP requests.
  • HUBOT_PAGERDUTY_TEST_EMAIL: Force email of address to this for testing.

Resources

hubot-pager-me's People

Contributors

aaronblythe avatar alindeman avatar antonio avatar awiddersheim avatar biggless avatar bobzoller avatar cce avatar chrislundquist avatar codywilbourn avatar danriti avatar dependabot-preview[bot] avatar dependabot[bot] avatar dirkaholic avatar eldios avatar frodebjerke avatar keescbakker avatar marcelog avatar mmrobins avatar mwarkentin avatar nobert avatar somenugget avatar stephenyeargin avatar stevefranks avatar stovoy avatar technicalpickles avatar thefynx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

hubot-pager-me's Issues

who's on call for XYZ loops if multiple matches exist

Whenever I type "Who's on call for XYZ", and there are more matches than just XYZ, then the replies loop, displaying +1 entry every time.

Example:

Who's on call for XYZ

A batch of responses comes, one after another:

Person A is on call for XYZ
Person A is on call for XYZ
Person B is on call for XYZ1
Person A is on call for XYZ
Person B is on call for XYZ1
Person C is on call for XYZ2
Person A is on call for XYZ
Person B is on call for XYZ1
Person C is on call for XYZ2
Person D is on call for XYZ3

...and so on, until it loops through all the possible matches of XYZ

Duplicated output

We seem to be having an odd issue with our hubot-pager-me integration where query responses are returned twice:
ss-hubot-pd

Hubot> hubot pager schedules
Hubot> * Data - https://acme.pagerduty.com/schedules#ABCDEF1
* SRE - https://acme.pagerduty.com/schedules#ABCDEF2

* Data - https://acme.pagerduty.com/schedules#ABCDEF1
* SRE - https://acme.pagerduty.com/schedules#ABCDEF2

We're running hubot in a Marathon container and all dependencies are met.
We use Slack to query Hubot
I have also ensured that the API token points to a legacy API.

Any tips on troubleshooting this please? I have not installed the webhook script, only the two pagerduty.coffee scripts (in ./pageduty.coffee and ./scripts/pagerduty.coffee).

Also the duplication issue is exclusive to hubot-pager-me as none of our other integrations display this behaviour.

Unable to trigger on a schedule

After upgrading to 2.1.10, I'm unable to trigger on a schedule:

<bot> pager trigger <schedule> test

results in:

[Wed Nov 18 2015 22:06:49 GMT+0000 (UTC)] ERROR Error: 400 back from /schedules/undefined/entries
  at PagerDutyError.Error (native)
  at new PagerDutyError (<path>/node_modules/hubot-pager-me/src/pagerduty.coffee:10:1, <js>:26:51)
  at <path>/node_modules/hubot-pager-me/src/pagerduty.coffee:44:20, <js>:74:16
  at IncomingMessage.<anonymous> (<path>/node_modules/scoped-http-client/src/index.js:95:22)
  at IncomingMessage.emit (events.js:129:20)
  at _stream_readable.js:908:16
  at process._tickCallback (node.js:355:11)

[Wed Nov 18 2015 22:06:49 GMT+0000 (UTC)] ERROR TypeError: Cannot read property 'entries' of null
  at <path>/node_modules/hubot-pager-me/src/scripts/pagerduty.coffee:751:7, <js>:866:17
  at <path>/node_modules/hubot-pager-me/src/pagerduty.coffee:46:9, <js>:76:16
  at IncomingMessage.<anonymous> (<path>/node_modules/scoped-http-client/src/index.js:95:22)
  at IncomingMessage.emit (events.js:129:20)
  at _stream_readable.js:908:16
  at process._tickCallback (node.js:355:11)

Figure out and fix why `/pager override` command is failing.

I ran these commands in +Infrastructure:

/pager override infrastructure 2014-09-28T00:00:00+00:00 - 2014-09-28T05:00:00+00:00 rothsa
/pager override infrastructure 2014-09-19T00:00:00+00:00 - 2014-09-19T05:00:00+00:00 azizshamim

There was no response from hubot in Chat to these commands. When I checked in https://github.pagerduty.com/schedules#?offset=5 to see if the commands had worked but not returned a log, I saw that the first one had changed, but not the second. (The first change may have been a manual override by @azizshamim and he didn't mention it)

cc @dbussink as he noticed this as well on his last on-call shift

Limit commands

Is it possible to limit commands that this integration offer?

Currently testing out pager-me integration for my Hubot instance.
There are incredible amount of commands that allows me to do anything and everything I can think of.

However, the @hubot help list is also daunting.
My team currently uses Icinga2 to do all the monitoring work.
Our workflow is to acknowledge and resolve incidents through Icinga's web application.
At least for the time being, majority of the commands are not needed by us.

Is it possible to disable certain commands so the list is more manageable?

am I on call

Hi All,

For some reason this feature is not returning what I expect it to return. When I run "@MYBOT am I on call" I get the following response:

Sorry, I expected to get 1 user back for [email protected], but got 0 :sweat:. If your 
PagerDuty email is not [email protected] use `/pager me as [email protected]

I can verify that in pagerduty my accounts email is [email protected]. I also tried running "@MYBOT pager me as [email protected]" but get the same message.

In pagerduty.coffee I noticed it mentions campfire:

  # Am I on call?
  robot.respond /am i on (call|oncall|on-call)/i, (msg) ->
    if pagerduty.missingEnvironmentForApi(msg)
      return

    campfireUserToPagerDutyUser msg, msg.message.user, (user) ->
      userId = user.name

I'm using Hubot v2.18.0 with the hipchat adapter and the latest hubot-pager-me source. Am I doing something wrong here or are there possibly issues with using the hipchat adapter and this script?

Besides this, most of the other features seem to be working fine.

Thanks in advance, any pointers would be greatly appreciated :)

Cheers,
Dave

[Feature] Add ability to restrict activity to certain services

We have 17 PagerDuty services set up, and some of them can trigger hundreds of errors a day (most auto-resolve quickly). Editor's note: I could get into the folly of using PagerDuty as a log stashing replacement, but I digress. The API can only match on incidents that appear on the first page of a list of incidents, and it can only retrieve a maximum of 100 incidents at a time. We have two or three of those services that actually trigger critical errors, and those are the ones we want to monitor and interact with.

I propose adding a new optional constant, HUBOT_PAGERDUTY_SERVICES, that is a comma-delimited string of service IDs to include. If not set, the default behavior of searching all services persists. If it is set, the service ID string is passed on as part of the relevant request parameters for the API endpoint.

Sanity check `/pager me N`, in case it's accidentally used to ack/resolve something

We've seen times when someone goes like:

hubot pager sup
hubot pager me 1234

... while attempting to acknowledge the 1234 incident. Instead, this adds a schedule override for the user for 1234 minutes. Incident numbers are much higher, which could lead to several weeks of schedule being override. This could be particularly disasterous if multiple groups are within the PagerDuty account, without overlap in skill sets.

Some fixes might include:

  • check if N is an open incident, and warn that they need to ack/resolve it
  • if N > X, then ask for a confirmation
  • if user is not on the configured schedule, ask for confirmation

pager ack! 400 error

I am getting this error when I am doing a Hubot pager ack!

Everything works fine when I do a Hubot pager ack <incident number>

https://gist.github.com/d4v3y0rk/2edb0cab3e324e9ef05b

User: awesomeuser asked me to "botzo pager ack!" in Channel: web-ops
400
{"error":{"message":"Invalid Input Provided","code":2001,"errors":["Status must be a list of triggered, acknowledged, or resolved."]}}
[Fri Oct 30 2015 13:58:00 GMT+0000 (UTC)] ERROR TypeError: Cannot read property 'incidents' of null
  at /opt/botzo/node_modules/hubot-pager-me/src/scripts/pagerduty.coffee:670:7, <js>:810:23
  at /opt/botzo/node_modules/hubot-pager-me/src/scripts/pagerduty.coffee:511:9, <js>:601:16
  at IncomingMessage.<anonymous> (/opt/botzo/node_modules/hubot/node_modules/scoped-http-client/src/index.js:95:22)
  at IncomingMessage.emit (events.js:129:20)
  at _stream_readable.js:908:16
  at process._tickCallback (node.js:355:11)

Problem retrieving user email

I have used this script before and:

email = msg.message.user.pagerdutyEmail || msg.message.user.email_address

used to work and picked up Slack users emails from msg.message.user.email_address

I recently changed bot and it no longer works, it seems as if msg.message.user.email_address returns "undefined"

Doesn't return on-call schedule

Hi,

When I command Hubot 'who's on call', I get a 404 back from schedules. The other commands are working fine. I have pasted my error below.

ERROR Error: 404 back from /schedules/XXXXXXX/entries
at PagerDutyError.Error (native)
at new PagerDutyError (/Users/duolingo4/customhubot2/node_modules/hubot-pager-me/src/pagerduty.coffee:10:1, :26:51)
at /Users/duolingo4/customhubot2/node_modules/hubot-pager-me/src/pagerduty.coffee:44:20, :74:16
at IncomingMessage. (/Users/duolingo4/customhubot2/node_modules/scoped-http-client/src/index.js:95:22)
at emitNone (events.js:72:20)
at IncomingMessage.emit (events.js:166:7)
at endReadableNT (_stream_readable.js:893:12)
at doNTCallback2 (node.js:429:9)
at process._tickCallback (node.js:343:17)

Thanks,

Anudeep

Feature Request: Enable Service to Room map so specific teams can handle issues for specific services

We have numerous development teams that we would like to integrate PagerDuty with. It seems as though using this plugin would allow us to have more support staff deal with issues without the Full PagerDuty experience.

Unfortunately due to the number of services we need to monitor it would be ideal if these services could be announced in different rooms. Is that a feature that would have merit with you?

"who's on call" broke in hubot-pager-me 2.1.14

Prior to hubot-pager-me 2.1.14 the sub-command "who's on call" returned the appropriate list of users and schedules, starting at 2.1.14 and beyond an empty set is returned.

โžœ  sbo-slack-hubot git:(augie-dev) grep pager package.json
    "hubot-pager-me": "2.1.13",
sbo-slack-hubot> sbo-slack-hubot who's on call
sbo-slack-hubot> [Thu Jul 14 2016 13:37:20 GMT-0700 (PDT)] DEBUG Message 'sbo-slack-hubot who's on call' matched regex //^\s*[@]?sbo\-slack\-hubot[:,]?\s*(?:who(?:โ€™s|'s|s| is|se)? (?:on call|oncall|on-call)(?: (?:for )?(.*?)(?:\?|$))?)/i/; listener.options = { id: null }
[Thu Jul 14 2016 13:37:20 GMT-0700 (PDT)] DEBUG Executing listener callback for Message 'sbo-slack-hubot who's on call'
* S is on call for 24/7 - https://safari.pagerduty.com/schedules#PP6
* R is on call for Client Services Day - https://foo.pagerduty.com/schedules#PAU
* C is on call for Escalation Backup - https://foo.pagerduty.com/schedules#PN1
* A is on call for A - Business Hours - https://foo.pagerduty.com/schedules#P81
* M is on call for M - Business Hours - https://foo.pagerduty.com/schedules#PZD
* CG is on call for Engineer Triage - https://foo.pagerduty.com/schedules#P2P
* C is on call for C - Business Hours - https://foo.pagerduty.com/schedules#P60
โžœ  sbo-slack-hubot git:(augie-dev) โœ— grep pager package.json
    "hubot-pager-me": "2.1.14",
sbo-slack-hubot> sbo-slack-hubot who's on call
sbo-slack-hubot> [Thu Jul 14 2016 13:40:46 GMT-0700 (PDT)] DEBUG Message 'sbo-slack-hubot who's on call' matched regex //^\s*[@]?sbo\-slack\-hubot[:,]?\s*(?:who(?:โ€™s|'s|s| is|se)? (?:on call|oncall|on-call)(?: (?:for )?(.*?)(?:\?|$))?)/i/; listener.options = { id: null }
[Thu Jul 14 2016 13:40:46 GMT-0700 (PDT)] DEBUG Executing listener callback for Message 'sbo-slack-hubot who's on call'

Filter links?

Yo,

Using hubot-pager-me in Slack. Not sure if this is a problem with the slack adapter or something that can be done here, but Hubot receives formatted messages for emails:

$ /pager me [email protected] test
[Thu Mar 26 2015 19:31:58 GMT+0000 (UTC)] DEBUG Received message: 'pager trigger <mailto:[email protected]|[email protected]> test' in channel: parker, from: parker

Would it be possible to filter the user here or allow us to default the user domain like:

HUBOT_PAGERDUTY_DEFAULT_USER_DOMAIN=vsco.co
$ /pager me user test
[Thu Mar 26 2015 19:31:58 GMT+0000 (UTC)] DEBUG Received message: 'pager trigger user test' in channel: parker, from: parker
[Thu Mar 26 2015 19:31:58 GMT+0000 (UTC)] DEBUG Sending to PagerDuty: 'test to [email protected]'

`hubot pager incident` matches multiple listeners

I noticed this while refactoring some other things:

Hubot> /pager incident 234
234: 2015-09-30T20:38:50Z test - @technicalpickles - assigned to 

I couldn't determine exactly which schedule you meant by incident. Can you be more specific?

I think it's just a matter of doing msg.finish() in the incident listener.

Incorrect PD API call?

When I run pager my schedule I get a stacktrace that looks like the following:

[Mon Oct 17 2016 13:00:05 GMT-0700 (PDT)] ERROR Error: 404 back from /schedules/AAAAAAA/entries
  at PagerDutyError.Error (native)
  at new PagerDutyError (/Users/zach/hubot/node_modules/hubot-pager-me/src/pagerduty.coffee:10:1, <js>:26:51)
  at /Users/zach/hubot/node_modules/hubot-pager-me/src/pagerduty.coffee:44:20, <js>:74:16
  at IncomingMessage.<anonymous> (/Users/zach/hubot/node_modules/scoped-http-client/src/index.js:95:22)
  at emitNone (events.js:91:20)
  at IncomingMessage.emit (events.js:185:7)
  at endReadableNT (_stream_readable.js:974:12)
  at _combinedTickCallback (internal/process/next_tick.js:74:11)
  at process._tickCallback (internal/process/next_tick.js:98:9)

I'm only guessing, but I think that call should be /schedules#AAAAAAA/entries. If not an incorrect API call, what have I done wrong?

Test coverage for commands

This package is getting a bit unwieldy with new commands and lacks spec coverage. As important as it is to a lot of folks using it, it would be worthwhile to investigate getting a mocking layer between the package script and the PagerDuty API so we can run a more robust test suite than "does our regex match?"

@rick has done some pretty solid work with getting a graph-me clone testable. We may be able to borrow some ideas from there: https://github.com/rick/hubot-graphme/blob/master/test/graph-me_test.coffee

Slack adapter and 'pager me as ...'

I think there may be a compatability issue with the Slack adapter. Oddly, it appears to allow a !pager ack command to go through (with the same warning) but not to append notes.

Stephen> !pager me as [email protected]
Hubot> Okay, I'll remember your PagerDuty email is <mailto:[email protected]|[email protected]>
Stephen> !pager note 74075 Already fixed in PR #2136
Hubot> Sorry, I expected to get 1 user back for <mailto:[email protected]|[email protected]>, but got 0 ๐Ÿ˜“. Can you make sure that is actually a real user on PagerDuty?

Case sensitivity of schedule names

This is likely a limitation with the PD API, but it would be helpful if "who is on call for schedule" didn't care about the case of the schedule name. For example we have a "SysOps" schedule and "who is on call for sysops" doesn't find it, but "who is on call for SysOps" does.

who is on call not working

I am getting this when I use who is on call after updating to v2.1.7

ERROR ReferenceError: json is not defined
  at /Users/me/dev/hubot/node_modules/hubot-pager-me/src/scripts/pagerduty.coffee:695:27
  at /Users/me/dev/hubot/node_modules/hubot-pager-me/src/pagerduty.coffee:138:7
  at /Users/me/dev/hubot/node_modules/hubot-pager-me/src/pagerduty.coffee:46:9
  at IncomingMessage.<anonymous> (/Users/me/dev/hubot/node_modules/hubot-pager-me/node_modules/scoped-http-client/src/index.js:95:22)
  at IncomingMessage.emit (events.js:129:20)
  at _stream_readable.js:908:16
  at process._tickCallback (node.js:355:11)

No oncalls returns if `HUBOT_PAGERDUTY_SCHEDULES` is unset

I believe this issue was introduced in: #117

If the HUBOT_PAGERDUTY_SCHEDULES environment variable is unset, allowed_schedules is an empty array.

I think the intention of the line:

if !allowed_schedules or schedule.id in allowed_schedules

Is to allow all results if the environment variable is unset, however, the !allowed_schedules check is not truthy for empty arrays:

https://repl.it/repls/LoudLimpOolanguage

So instead, it allows no results.

I suspect a better check would be

if !allowed_schedules.length or schedule.id in allowed_schedules

Incidents reassigned to HUBOT_PAGERDUTY_FROM_EMAIL

I may be confused about how this should work.

When I am on call, new incidents are assigned to me, naturally. But when I misty pager ack, they are reassigned to the user with HUBOT_PAGERDUTY_FROM_EMAIL. See below (our hubot is called misty):

screenshot_20190102_141752

According to the v1 to v2 migration docs, requester should be specified in the From header. It seems to me that this should be set to the user who's issuing the command (i.e. whatever I set with misty pager me as ...).

However, it's always set to the same value (HUBOT_PAGERDUTY_FROM_EMAIL). This poor guy gets reassigned every ticket.

https://github.com/hubot-scripts/hubot-pager-me/blob/414608b3e198b5dacaf5046ae1a9d25692646b57/src/pagerduty.coffee#L15-L19

Am I missing something here?

Pager override should prompt you to use `pager me as`

When I ran the following command:

/pager me redacted 180

I got this error:

Sorry, I expected to get 1 user back for [email protected], but got 0 ๐Ÿ˜“. Can you make sure that is actually a real user on PagerDuty?

Sure enough, that's not my email address on PagerDuty. To resolve the issue, I needed to run this command:

/pager me as <actual-email-address>

In talking with @technicalpickles, he said:

There are other code paths that should prompt you to use /pager me as. Not sure why the override didn't prompt you.

When the override command can't find your user in PagerDuty, it would be โœจ if it prompted to you use /pager me as to aid you in resolving the issue.

Update `/pager sup` to only show your assigned tickets

Since #4, ack and resolve will only act on your own incidents by default. They support ack! and resolve! to disregard that.

I think it'd make sense to keep parity of those for /pager sup to list only your things, with a ! version listing them all.

Doesn't seem to support spaces in the name of a schedule

Asking pager schedules returns a list of schedules fine, but running pager me Ops Level 2 Schedule 1 or pager me Ops\ Level\ 2\ Schedule 1 or pager me "Ops Level 2 Schedule 1" or pager me "Ops\ Level\ 2\ Schedule" 1 all fail to find the correct schedule. The obvious answer is to rename our schedules, but a fix here would keep me from having to make that change across are numerous schedules.

hubot pager schedule myschedule fails

The following error appears on the console:
[Tue Nov 17 2015 10:44:16 GMT+0100 (CET)] ERROR TypeError: undefined is not a function
at SlackBot.send (/home/ingard/src/chatops/hubot/node_modules/hubot-slack/src/slack.coffee:217:47, :265:19)
at Response.send (/home/ingard/src/chatops/hubot/node_modules/hubot/src/response.coffee:22:5, :20:47)
at /home/ingard/src/chatops/hubot/node_modules/hubot-pager-me/src/scripts/pagerduty.coffee:696:9, :786:17
at /home/ingard/src/chatops/hubot/node_modules/hubot-pager-me/src/scripts/pagerduty.coffee:689:7, :775:16
at /home/ingard/src/chatops/hubot/node_modules/hubot-pager-me/src/pagerduty.coffee:138:7, :185:16
at /home/ingard/src/chatops/hubot/node_modules/hubot-pager-me/src/pagerduty.coffee:46:9, :76:16
at IncomingMessage. (/home/ingard/src/chatops/hubot/node_modules/hubot-pager-me/node_modules/scoped-http-client/src/index.js:95:22)
at IncomingMessage.emit (events.js:129:20)
at _stream_readable.js:908:16
at process._tickCallback (node.js:355:11)

No response given for invalid issue numbers

When triggered with an invalid/non existent issue number while adding notes eg pager note 999999 chicken on fire Hubot does not respond in the chat/channel to say there's been an issue adding the note.

While there's no response given by hubot in the channel an http 400 error message is seen in the hubot logs:

ERROR Error: 400 back from /incidents/999999/notes
    at PagerDutyError.Error (native)
    at new PagerDutyError (/home/hubot/node_modules/hubot-pager-me/src/pagerduty.coffee:10:7)
    at /home/hubot/node_modules/hubot-pager-me/src/pagerduty.coffee:86:23
    at IncomingMessage.<anonymous> (/home/hubot/node_modules/hubot-pager-me/node_modules/scoped-http-client/src/index.js:95:22)
    at emitNone (events.js:72:20)
    at IncomingMessage.emit (events.js:166:7)
    at endReadableNT (_stream_readable.js:923:12)
    at nextTickCallbackWith2Args (node.js:511:9)
    at process._tickCallback (node.js:425:17)

Pager schedules returns only the first 100 schedules

Hello,
whenever I try to get the list of all schedules by running "pager schedule" I only get the first 100 (in 3 messages total: message#1&2 = 48 entries each, message#3 = 4 entries). However, we have more than 100 schedules, ca. 150, so not all of them are displayed.

@awiddersheim

After acking or resolving, show all open incidents

If someone is paged, and they are in chat, it's usually easiest to just /pager ack from chat. The only output is a list of incident numbers acknowledged. So, usually there's a follow up /pager sup to see open list.

It'd be cool to include this by default. Or, if not that, then at least have a short summary of what's triggered vs acknowledged.

cc @jnewland @jssjr

"pagerduty registers a pager on call listener" test failure

Seem

  1) pagerduty registers a pager on call listener:
     expected respond to have been called with arguments /who('s|s| is|se)? (on call|oncall|on-call)( (?:for )?(.+))?/i
    respond(/pager( me)?$/i, function () {}) at module.exports (/Users/technicalpickles/github/hubot-pager-me/src/scripts/pagerduty.coffee:32:11)
    respond(/pager(?: me)? as (.*)$/i, function () {}) at module.exports (/Users/technicalpickles/github/hubot-pager-me/src/scripts/pagerduty.coffee:60:11)
    respond(/pager forget me$/i, function () {}) at module.exports (/Users/technicalpickles/github/hubot-pager-me/src/scripts/pagerduty.coffee:66:11)
    respond(/(pager|major)( me)? incident (.*)$/i, function () {}) at module.exports (/Users/technicalpickles/github/hubot-pager-me/src/scripts/pagerduty.coffee:70:11)
    respond(/(pager|major)( me)? (inc|incidents|sup|problems)$/i, function () {}) at module.exports (/Users/technicalpickles/github/hubot-pager-me/src/scripts/pagerduty.coffee:75:11)
    respond(/(pager|major)( me)? (?:trigger|page) ([\w\-]+)$/i, function () {}) at module.exports (/Users/technicalpickles/github/hubot-pager-me/src/scripts/pagerduty.coffee:101:11)
    respond(/(pager|major)( me)? (?:trigger|page) ([\w\-]+) (.+)$/i, function () {}) at module.exports (/Users/technicalpickles/github/hubot-pager-me/src/scripts/pagerduty.coffee:104:11)
    respond(/(?:pager|major)(?: me)? ack(?:nowledge)? (.+)$/i, function () {}) at module.exports (/Users/technicalpickles/github/hubot-pager-me/src/scripts/pagerduty.coffee:158:11)
    respond(/(pager|major)( me)? ack(nowledge)?(!)?$/i, function () {}) at module.exports (/Users/technicalpickles/github/hubot-pager-me/src/scripts/pagerduty.coffee:164:11)
    respond(/(?:pager|major)(?: me)? res(?:olve)?(?:d)? (.+)$/i, function () {}) at module.exports (/Users/technicalpickles/github/hubot-pager-me/src/scripts/pagerduty.coffee:191:11)
    respond(/(pager|major)( me)? res(olve)?(d)?(!)?$/i, function () {}) at module.exports (/Users/technicalpickles/github/hubot-pager-me/src/scripts/pagerduty.coffee:197:11)
    respond(/(pager|major)( me)? notes (.+)$/i, function () {}) at module.exports (/Users/technicalpickles/github/hubot-pager-me/src/scripts/pagerduty.coffee:224:11)
    respond(/(pager|major)( me)? note ([\d\w]+) (.+)$/i, function () {}) at module.exports (/Users/technicalpickles/github/hubot-pager-me/src/scripts/pagerduty.coffee:239:11)
    respond(/(pager|major)( me)? schedules( (.+))?$/i, function () {}) at module.exports (/Users/technicalpickles/github/hubot-pager-me/src/scripts/pagerduty.coffee:265:11)
    respond(/(pager|major)( me)? (schedule|overrides)( ([\w\-]+))?( ([^ ]+))?$/i, function () {}) at module.exports (/Users/technicalpickles/github/hubot-pager-me/src/scripts/pagerduty.coffee:286:11)
    respond(/(pager|major)( me)? my schedule( ([^ ]+))?$/i, function () {}) at module.exports (/Users/technicalpickles/github/hubot-pager-me/src/scripts/pagerduty.coffee:342:11)
    respond(/(pager|major)( me)? (override) ([\w\-]+) ([\w\-:\+]+) - ([\w\-:\+]+)( (.*))?$/i, function () {}) at module.exports (/Users/technicalpickles/github/hubot-pager-me/src/scripts/pagerduty.coffee:404:11)
    respond(/(pager|major)( me)? (overrides?) ([\w\-]*) (delete) (.*)$/i, function () {}) at module.exports (/Users/technicalpickles/github/hubot-pager-me/src/scripts/pagerduty.coffee:454:11)
    respond(/pager( me)? (.+) (\d+)$/i, function () {}) at module.exports (/Users/technicalpickles/github/hubot-pager-me/src/scripts/pagerduty.coffee:470:11)
    respond(/am i (on call|oncall|on-call)(.+)?/i, function () {}) at module.exports (/Users/technicalpickles/github/hubot-pager-me/src/scripts/pagerduty.coffee:511:11)
    respond(/who(โ€™s|'s|s| is|se)? (on call|oncall|on-call)( (?:for )?(.+))?/i, function () {}) at module.exports (/Users/technicalpickles/github/hubot-pager-me/src/scripts/pagerduty.coffee:545:11)
    respond(/(pager|major)( me)? services$/i, function () {}) at module.exports (/Users/technicalpickles/github/hubot-pager-me/src/scripts/pagerduty.coffee:572:11)
    respond(/(pager|major)( me)? maintenance (\d+) (.+)$/i, function () {}) at module.exports (/Users/technicalpickles/github/hubot-pager-me/src/scripts/pagerduty.coffee:588:11)
  AssertionError: expected respond to have been called with arguments /who('s|s| is|se)? (on call|oncall|on-call)( (?:for )?(.+))?/i
      respond(/pager( me)?$/i, function () {}) at module.exports (src/scripts/pagerduty.coffee:32:11)
      respond(/pager(?: me)? as (.*)$/i, function () {}) at module.exports (src/scripts/pagerduty.coffee:60:11)
      respond(/pager forget me$/i, function () {}) at module.exports (src/scripts/pagerduty.coffee:66:11)
      respond(/(pager|major)( me)? incident (.*)$/i, function () {}) at module.exports (src/scripts/pagerduty.coffee:70:11)
      respond(/(pager|major)( me)? (inc|incidents|sup|problems)$/i, function () {}) at module.exports (src/scripts/pagerduty.coffee:75:11)
      respond(/(pager|major)( me)? (?:trigger|page) ([\w\-]+)$/i, function () {}) at module.exports (src/scripts/pagerduty.coffee:101:11)
      respond(/(pager|major)( me)? (?:trigger|page) ([\w\-]+) (.+)$/i, function () {}) at module.exports (src/scripts/pagerduty.coffee:104:11)
      respond(/(?:pager|major)(?: me)? ack(?:nowledge)? (.+)$/i, function () {}) at module.exports (src/scripts/pagerduty.coffee:158:11)
      respond(/(pager|major)( me)? ack(nowledge)?(!)?$/i, function () {}) at module.exports (src/scripts/pagerduty.coffee:164:11)
      respond(/(?:pager|major)(?: me)? res(?:olve)?(?:d)? (.+)$/i, function () {}) at module.exports (src/scripts/pagerduty.coffee:191:11)
      respond(/(pager|major)( me)? res(olve)?(d)?(!)?$/i, function () {}) at module.exports (src/scripts/pagerduty.coffee:197:11)
      respond(/(pager|major)( me)? notes (.+)$/i, function () {}) at module.exports (src/scripts/pagerduty.coffee:224:11)
      respond(/(pager|major)( me)? note ([\d\w]+) (.+)$/i, function () {}) at module.exports (src/scripts/pagerduty.coffee:239:11)
      respond(/(pager|major)( me)? schedules( (.+))?$/i, function () {}) at module.exports (src/scripts/pagerduty.coffee:265:11)
      respond(/(pager|major)( me)? (schedule|overrides)( ([\w\-]+))?( ([^ ]+))?$/i, function () {}) at module.exports (src/scripts/pagerduty.coffee:286:11)
      respond(/(pager|major)( me)? my schedule( ([^ ]+))?$/i, function () {}) at module.exports (src/scripts/pagerduty.coffee:342:11)
      respond(/(pager|major)( me)? (override) ([\w\-]+) ([\w\-:\+]+) - ([\w\-:\+]+)( (.*))?$/i, function () {}) at module.exports (src/scripts/pagerduty.coffee:404:11)
      respond(/(pager|major)( me)? (overrides?) ([\w\-]*) (delete) (.*)$/i, function () {}) at module.exports (src/scripts/pagerduty.coffee:454:11)
      respond(/pager( me)? (.+) (\d+)$/i, function () {}) at module.exports (src/scripts/pagerduty.coffee:470:11)
      respond(/am i (on call|oncall|on-call)(.+)?/i, function () {}) at module.exports (src/scripts/pagerduty.coffee:511:11)
      respond(/who(โ€™s|'s|s| is|se)? (on call|oncall|on-call)( (?:for )?(.+))?/i, function () {}) at module.exports (src/scripts/pagerduty.coffee:545:11)
      respond(/(pager|major)( me)? services$/i, function () {}) at module.exports (src/scripts/pagerduty.coffee:572:11)
      respond(/(pager|major)( me)? maintenance (\d+) (.+)$/i, function () {}) at module.exports (src/scripts/pagerduty.coffee:588:11)
      at Context.<anonymous> (test/pager-me-test.coffee:75:54)

Will need to git-bisect to find when it was introduced, but possible related to #45 ?

Can't take pager for schedule like `Incident.*`

If I say @Hubot pager me Incident Commander 5, Hubot crashes:

at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
--
at endReadableNT (node:internal/streams/readable:1696:12)
at IncomingMessage.emit (node:events:530:35)
at IncomingMessage.<anonymous> (/hubot/node_modules/scoped-http-client/src/index.js:95:22)
at /hubot/node_modules/hubot-pager-me/src/pagerduty.js:60:14
at /hubot/node_modules/hubot-pager-me/src/pagerduty.js:156:7
at /hubot/node_modules/hubot-pager-me/src/scripts/pagerduty.js:108:16
at formatIncident (/hubot/node_modules/hubot-pager-me/src/scripts/pagerduty.js:1006:25)
TypeError: Cannot read properties of undefined (reading 'title')
ย 
^
const summary = inc.title;
/hubot/node_modules/hubot-pager-me/src/scripts/pagerduty.js:1006

This appears to be a matching issue with https://github.com/hubot-archive/hubot-pager-me/blob/main/src/scripts/pagerduty.js#L95 doing case-insensitive matching?

Any advice on fixing this would be great.

Acknowledging incidents doesn't work

Issuing the command pager ack to acknowledge unacknowleged incidents no longer works. In the logs all I see is these errors when issuing the command to hubot:

{"error":{"message":"Invalid Input Provided","code":2001,"errors":["Status must be a list of triggered, acknowledged, or resolved."]}}
[Tue Nov 03 2015 15:26:03 GMT-0600 (CST)] ERROR Ugh... TypeError: Cannot read property 'incidents' of null

If I issue pager ack <incident no> it works though

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.