Intersight Alarm Monitor Example

AWS Lambda based Python 3.8 script to check Intersight for alarms generated within the past 15 minutes and post to a Webex room.

Pre-requisites:

  1. Amazon AWS Account w/Lambda and Event Bridge Features (https://aws.amazon.com/)

[As of 3/2021 the free tier of Lambda allows for 1M free requests per month and 400,000 GB-seconds of compute time per month and $1 per month for a million Event Bridge events]

  1. Webex Bot w/API Keys (https://developer.webex.com/docs/bots)
  2. Intersight Account w/API Keys (https://intersight.com/help/features#api_keys)
  3. Linux machine with Python 3.8 installed

Instructions:

  1. Replace contents of SecretKey.txt with Interight API Private Key

  2. Replace contents of .env with Intersight API Key, Webex Room ID, Webex Bot Token

  3. Create AWS Lambda package from root of project directory:

     sudo pip3 install --target ./package cryptography requests python-dotenv
    
     cd package/
    
     zip -r ../my-deployment-package.zip .
    
     cd ..
    
     zip -g my-deployment-package.zip *.py
    
     zip -g my-deployment-package.zip *.txt
    
     zip -g my-deployment-package.zip *.env
    
  4. Create AWS Lambda Function using Python 3.8

  5. Upload my-deployment-package.zip to Lambda Function

  6. Set timeout to 8 seconds on AWS Lambda Function

  7. Create AWS Event Bridge to run Lambda Function at a fixed interval every 15 minutes

View code on GitHub

Code Exchange Community

Get help, share code, and collaborate with other developers in the Code Exchange community.View Community
Disclaimer:
Cisco provides Code Exchange for convenience and informational purposes only, with no support of any kind. This page contains information and links from third-party websites that are governed by their own separate terms. Reference to a project or contributor on this page does not imply any affiliation with or endorsement by Cisco.