Closed justdaver closed 8 years ago
It works for me few days back, not working anymore.
Perhaps something changed in the pagerduty API? Anyone else experiencing this issue?
Seems like something change from pagerduty API. According to hubot log, I am see its making the correct call. However not getting anything back. There should be one other stage, call sending
, which basically send data from pager duty to slack channel.
[Tue Mar 01 2016 11:59:58 GMT-0500 (EST)] DEBUG Received message: 'Am I on call?' in channel: ali.ikram, from: ali.ikram
[Tue Mar 01 2016 11:59:58 GMT-0500 (EST)] DEBUG Message 'zeus Am I on call?' matched regex //^\s*[@]?zeus[:,]?\s*(?:am i on (call|oncall|on-call))/i/
[Tue Mar 01 2016 11:59:58 GMT-0500 (EST)] DEBUG Executing listener callback for Message 'zeus Am I on call?'
According to https://developer.pagerduty.com/ the last update to their API was Nov last year. I spoke to support who verified this and said that nothing has changed recently.
I'll try do some research today to see what I can find although my coffee-script & API kung fu is not very strong :)
any luck with this?
Appears to still be working in the shell adapter at least.
hubot@v2.16.0
hubot-pager-me@v2.1.13
HUBOT_LOG_LEVEL=debug
hubot> hubot am i on call?
hubot> [Mon Mar 07 2016 21:04:47 GMT-0600 (CST)] DEBUG Message '!am i on call?' matched regex //^\s*[@]?(?:hubot[:,]?|![:,]?)\s*(?:am i on (call|oncall|on-call))/i/
[Mon Mar 07 2016 21:04:47 GMT-0600 (CST)] DEBUG Executing listener callback for Message '!am i on call?'
* No, you are NOT on call for Ops Oncall Primary (but [name] is)- https://subdomain.pagerduty.com/schedules#PV1AMCY
* No, you are NOT on call for Ops Oncall Secondary (but [name] is)- https://subdomain.pagerduty.com/schedules#PS3I52N
* No, you are NOT on call for Standard Rotation (but [name] is)- https://subdomain.pagerduty.com/schedules#PM279HE
Hi Guys,
Apologies for the delay in responding. After some testing I realised I've been dealing with 2 separate problems. The first problem was that my hipchat account email was registered as dave@example.com, whilst my Pagerduty login was dave@example.co.za. This obviously meant that it would never find my user against the Pagerduty API as it was using my incorrect email address to lookup. My bad, stupid mistake. I've fixed this by ensuring that my hipchat user and pagerduty account user have the same email/login address.
After fixing my mistake above I continued, I turned on DEBUG and issued "hubot am I on call".
Mar 9 15:28:51 der0274 hubot: [Wed Mar 09 2016 15:28:51 GMT+0200 (SAST)] DEBUG Message 'Hubot: am I on call' matched regex //^\s*[@]?Hubot[:,]?\s*(?:am i on (call|oncall|on-call))/i/; listener.options = { id: null }
Mar 9 15:28:51 der0274 hubot: [Wed Mar 09 2016 15:28:51 GMT+0200 (SAST)] DEBUG Executing listener callback for Message 'Hubot: am I on call'
Mar 9 15:28:51 der0274 hubot: [Wed Mar 09 2016 15:28:51 GMT+0200 (SAST)] DEBUG Message 'Hubot: am I on call' matched regex //^\s*[@]?Hubot[:,]?\s*(?:(.*))/i/; listener.options = { id: null }
Mar 9 15:28:51 der0274 hubot: [Wed Mar 09 2016 15:28:51 GMT+0200 (SAST)] DEBUG Executing listener callback for Message 'Hubot: am I on call'
That's it, nothing happens after that.
I then added 2 additional lines to src/scripts/pagerduty.coffee (under Testing 1/2):
# 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.id
renderSchedule = (s, cb) ->
withCurrentOncallId msg, s, (oncallUserid, oncallUsername, schedule) ->
if userId == oncallUserid
cb null, "* Yes, you are on call for #{schedule.name} - https://#{pagerduty.subdomain}.pagerduty.com/schedules##{schedule.id}"
# Testing 1
msg.send "* Yes, you are on call for #{schedule.name} - https://#{pagerduty.subdomain}.pagerduty.com/schedules##{schedule.id}"
else
cb null, "* No, you are NOT on call for #{schedule.name} (but #{oncallUsername} is)- https://#{pagerduty.subdomain}.pagerduty.com/schedules##{schedule.id}"
# Testing 2
msg.send "* No, you are NOT on call for #{schedule.name} (but #{oncallUsername} is)- https://#{pagerduty.subdomain}.pagerduty.com/schedules##{schedule.id}"
Tried again and issued "hubot am I on call" and now it works:
Mar 9 15:39:29 der0274 hubot: [Wed Mar 09 2016 15:39:29 GMT+0200 (SAST)] DEBUG Message 'Hubot: am I on call' matched regex //^\s*[@]?Hubot[:,]?\s*(?:am i on (call|oncall|on-call))/i/; listener.options = { id: null }
Mar 9 15:39:29 der0274 hubot: [Wed Mar 09 2016 15:39:29 GMT+0200 (SAST)] DEBUG Executing listener callback for Message 'Hubot: am I on call'
Mar 9 15:39:29 der0274 hubot: [Wed Mar 09 2016 15:39:29 GMT+0200 (SAST)] DEBUG Message 'Hubot: am I on call' matched regex //^\s*[@]?Hubot[:,]?\s*(?:(.*))/i/; listener.options = { id: null }
Mar 9 15:39:29 der0274 hubot: [Wed Mar 09 2016 15:39:29 GMT+0200 (SAST)] DEBUG Executing listener callback for Message 'Hubot: am I on call
'
Mar 9 15:39:33 der0274 hubot: [Wed Mar 09 2016 15:39:33 GMT+0200 (SAST)] DEBUG building message
Mar 9 15:39:33 der0274 hubot: [Wed Mar 09 2016 15:39:33 GMT+0200 (SAST)] DEBUG * Yes, you are on call for Team_A - https://example.pagerduty.com/schedules#PXCM5IK
Mar 9 15:39:34 der0274 hubot: [Wed Mar 09 2016 15:39:33 GMT+0200 (SAST)] DEBUG OUT > <message to="1_10@chat.btf.hipchat.com" type="chat" from="1_3@chat.btf.hipchat.com/hubot-hipchat"><inactive xmlns="http://jabber/protocol/chatstates"/><body>* Yes, you are on call for Team_A - https://example.pagerduty.com/schedules#PXCM5IK</body></message>
Mar 9 15:39:34 der0274 hubot: [Wed Mar 09 2016 15:39:34 GMT+0200 (SAST)] DEBUG building message
Mar 9 15:39:34 der0274 hubot: [Wed Mar 09 2016 15:39:34 GMT+0200 (SAST)] DEBUG * No, you are NOT on call for Team_B (but Joe Soap is)- https://example.pagerduty.com/schedules#PNNDCIU
Mar 9 15:39:34 der0274 hubot: [Wed Mar 09 2016 15:39:34 GMT+0200 (SAST)] DEBUG OUT > <message to="1_10@chat.btf.hipchat.com" type="chat" from="1_3@chat.btf.hipchat.com/hubot-hipchat"><inactive xmlns="http://jabber/protocol/chatstates"/><body>* No, you are NOT on call for Team_B (but Joe Soap is)- https://example.pagerduty.com/schedules#PNNDCIU</body></message>
Any ideas?
Thanks Dave
Hi Dave, I have tried with those new line it works for me. I am using slack adapter. Thanks a lot.
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:
I can verify that in pagerduty my accounts email is dave@example.com. I also tried running "@mybot pager me as dave@example.com" but get the same message.
In pagerduty.coffee I noticed it mentions campfire:
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