Closed Bug 1152910 Opened 9 years ago Closed 9 years ago

SNS -> irc gateway bot

Categories

(Infrastructure & Operations :: RelOps: General, task)

x86
macOS
task
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: arich, Assigned: selenamarie)

References

Details

We have at least two services that can send notifications via SNS. Being able to get those SNS messages into #buildduty where all of our other alerts take place would be a huge win. I was chatting with lonnen, and his irc bot is pretty customizable with plugins and can handle http/s endpoints. He thinks he can put something together reasonably easily and asked for some details.

Amazon's SNS documentation on setting up the HTTP/S endpoints: https://docs.aws.amazon.com/sns/latest/dg/SendMessageToHttp.html#SendMessageToHttp.prepare

In order to make this plugin generic and usable by other SNS topics, I suggested that the bot parse the x-amz-sns-topic-arn header and use the last field (the topic name) as the irc channel to send to. In our case, I made a topic called buildduty which should send messages to #buildduty (the bot will need to join this channel, but it has no key, so this should be relatively trivial). Since these messages are going to a public channel, I think we're good to just use HTTP instead of HTTPS (unless we wind up needing to do auth with a secret key).

The bot should also parse the x-amz-sns-message-id header and make sure that it's not seeing a retry of the message so we aren't printing out the same message multiple times.

I don't think we care much about printing out SubscriptionConfirmation messages to the channel, but the bot needs to confirm the subscription somehow. 

When it comes to output, I think the only two fields we care about are Subject and Message. Some of the messages may be pretty long in length, so we may need to split into multiple lines or truncate. I suggest that we start out with trying to have output in the following format and see how that pans out:

Subject: Message

Once we have a bot set up, I can set the HTTP endpoint for the buildduty topic to it and do some testing.

Lonnen, you need any more info?
Flags: needinfo?(chris.lonnen)
Blocks: 1150557
This looks convenient!  Lonnen, are hubot and leeroy similar enough that we can just use this?

https://gist.github.com/jasonthomas/4568942
They are, in face, the same! I just went looking for this in the hubot script repositories the other day. I'll package it up and put it on NPM on Monday so other people can find it too.
Flags: needinfo?(chris.lonnen)
in fact*

bugzilla, why u no edit
After further conversation, apparently releng is already running hubot. I've cced hwine so he can comment here about our instance.
I rolled it up into a plugin here: https://github.com/lonnen/hubot-aws-sns

Haven't been able to set up the SNS queue to properly test it yet, but once I do I'll publish it on NPM.
I have a queue that we can use to test.
Assignee: chris.lonnen → sdeckelmann
I've published a bot at https://github.com/selenamarie/relengbot  and ended up using https://github.com/mdouglass/hubot-sns/ for the sns subscription. 

The bot is talking and available in #buildduty.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.