Forum Discussion
Hi Brandon,
I think LogicMonitor does not have feature to send notification based on AWS tag like owner name etc. but it can discover it. You can create small solution using AWS API Gateway, Lambda and SES. I have done it for testing purpose and was working fine.
Flow would be:
Alert Rule -->Escalation Chain -->HTTP JSON integration (POST) --> AWS API getaway --> Lambda function (python or Node.js) --> SES services.
Below is simple python code for this.
Quote
import json
import boto3
import re
from botocore.exceptions import ClientErrordef lambda_handler(event, context):
# Replace sender@example.com with your "From" address.
# This address must be verified with Amazon SES.
SENDER = "sender@yourcompany.com"
# Make a regular expression
# For validating an Email
regex = '^[a-z0-9]+[\._]?[a-z0-9]+[@]\w+[.]\w{2,3}$'
# Replace recipient@example.com with a "To" address. If your account
# is still in the sandbox, this address must be verified.
if(re.search(regex,event['recipient'].strip())):
RECIPIENT = event['recipient']
else:
RECIPIENT="defaultemail@yourcompany.com >"
AWS_REGION = "ap-south-1"
# The subject line for the email.
SUBJECT = "LogicMonitor " + event['level'] + " " + event['hostname']
# The email body for recipients with non-HTML email clients.
BODY_TEXT = ("LogicMonitor Genrated Mail\r\n"
"This email was sent for threshold breach "
"on your system."
)
# The HTML body of the email.
BODY_HTML = """<html>
<head></head>
<body>
<h1>LogicMonitor Alert</h1>
<p>
<table style="width:100%">
<tr>
<td>Hostname</td>
<td>"""+event['hostname']+"""</td>
</tr>
<tr>
<td>Alert Message</td>
<td>"""+event['message']+"""</td>
</tr>
<tr>
<td>Start Time</td>
<td>"""+event['start']+"""</td>
</tr>
</table>
</p>
</body>
</html>
LogicMonitor HTTP integration screenshot
Related Content
- 4 months ago
- 2 years ago