MCPcopy Create free account
hub / github.com/assertible/lambda-cloudwatch-slack / handleAutoScaling

Function handleAutoScaling

index.js:283–312  ·  view source on GitHub ↗
(event, context)

Source from the content-addressed store, hash-verified

281};
282
283var handleAutoScaling = function(event, context) {
284 var subject = "AWS AutoScaling Notification"
285 var message = JSON.parse(event.Records[0].Sns.Message);
286 var timestamp = (new Date(event.Records[0].Sns.Timestamp)).getTime()/1000;
287 var eventname, nodename;
288 var color = "good";
289
290 for(key in message){
291 eventname = key;
292 nodename = message[key];
293 break;
294 }
295 var slackMessage = {
296 text: "*" + subject + "*",
297 attachments: [
298 {
299 "color": color,
300 "fields": [
301 { "title": "Message", "value": event.Records[0].Sns.Subject, "short": false },
302 { "title": "Description", "value": message.Description, "short": false },
303 { "title": "Event", "value": message.Event, "short": false },
304 { "title": "Cause", "value": message.Cause, "short": false }
305
306 ],
307 "ts": timestamp
308 }
309 ]
310 };
311 return _.merge(slackMessage, baseSlackMessage);
312};
313
314var handleCatchAll = function(event, context) {
315

Callers 1

processEventFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected