Automation to invoke a Lambda function
Using Site24x7's IT automation framework, create an action profile to invoke a Lambda function. You can set up to automatically trigger the function by mapping it with a threshold or an alert event type (Up, Down and Trouble), or you can call the APIs directly by manually invoking the action from the Site24x7 console.
Permissions required
Please make sure the IAM role assumed by Site24x7 or the IAM user created for Site24x7 has the following permission in the attached policy document to perform the action.
- "lambda:InvokeFunction"
Constraints
- To invoke, the Lambda function needs to be active and monitored by Site24x7
- The necessary permission required to invoke the Lambda function should be present with Site24x7
Create an action profile
- Login to the Site24x7 web console, select Admin > IT Automation Templates
- Click on the drop down and select "Trigger Lambda Function" as Type
- Type in an unique name in the Display Name field for identification purpose
- The action to be performed would get prepopulated in the field below
- Next, click the drop down to select the Lambda function(s) which you want to invoke
- Enter a time out value in the "Max Allowed Action Execution Time" step, allowed range 1 - 90 seconds.
- Share automation results via an email to your User Alert Group configured in the Notification Profile. This email will contain parameters including the automation name, type of automation, incident reason, destination hosts, and more.
- Save the profile
Simulate the Automation
Before mapping the action profile, you can test its functionality by invoking the action manually within the Site24x7 console or by using our REST APIs. This is done to check whether appropriate write level permissions are provided or not. Once you've created the profile, navigate back to the IT Automation summary page and click on the to execute a test run.
Mapping the Automation
Navigate to the Edit monitor page of the monitored AWS resource or application service ("Resouce monitor page" > > Edit) , and map the action profile with any of the following monitor status changes.
- Execute on Down
- Execute on Up
- Execute on Trouble
- Execute on any Status Change
Attribute level mapping
You can also associate the action profile to a metric data point associated with any monitored resource or application service. Navigate to the Edit threshold profile page of the said resource (Edit Monitor page of the resource > click on the Pencil icon adjacent to the Threshold and Availability field) and map the profile to any desired attribute by clicking on the "Select Automation to Execute" field.
Use Case
Troubleshoot application load balancer performance: For example, lets take a scenario where you have authored a Lambda function to push ELB access logs into Elasticsearch. Here, you can create an action profile and map it to the attributes of the monitored load balancers to automatically invoke the Lambda function whenever the metric data points like latency, ELB and target HTTP errors reaches the level you define.