{
"info": {
"author": "Gene Wood",
"author_email": "gene_wood@cementhorizon.com",
"bugtrack_url": null,
"classifiers": [
"Development Status :: 3 - Alpha",
"Intended Audience :: System Administrators",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Topic :: System :: Monitoring"
],
"description": "AWS Lambda Monitor\n==================\n\nAWS Lambda Monitor is a small monitoring tool which runs in AWS Lambda.\nThe tool is triggered either regularly by a CloudWatch scheduled task or\non demand by an email triggered event. With this tool you can monitor\nservices on servers out on the internet for free and receive alert\nemails when there are problems.\n\nWhy create another monitoring tool?\n-----------------------------------\n\nThe rationale behind creating this tool (instead of using one of the\nmany existing monitoring tools in existence) is to take advantage of the\n`AWS Lambda pricing model `__ to\nget free monitoring forever. AWS provides 37 days of 128MB memory Lambda\nexecution per month. Unlike the EC2 free tier, the Lambda free tier\ndoesn't expire after the first year.\n\nThe reason the tool uses email for input (triggering a monitoring run)\nand output (alerting on problems) is that the `AWS SES pricing\nmodel `__ allows for 1000 emails\nper month. The alternative interface for AWS Lambda would be the `AWS\nAPI Gateway `__ which costs\n$3.50/month.\n\nHow to build and upload awslambdamonitor to AWS\n===============================================\n\nBuild and package virtualenv\n----------------------------\n\nTo build the zip file containing the virtualenv, spin up an Amazon Linux\nEC2 instance (as this is the environment that AWS Lambda functions run\nin). Create the zip file as follows\n\n::\n\n sudo yum groupinstall 'Development Tools'\n sudo yum install libyaml-devel libffi-devel openssl-devel\n virtualenv build-aws-lambda-monitor-environment\n build-aws-lambda-monitor-environment/bin/pip install pyOpenSSL paramiko ecdsa pycrypto python-whois PyYAML ndg-httpsclient pyasn1 requests\n pushd build-aws-lambda-monitor-environment/lib/python2.7/dist-packages/\n zip -r ~/awslambdamonitor.zip *\n popd\n\n pushd build-aws-lambda-monitor-environment/lib64/python2.7/dist-packages/\n zip -r ~/awslambdamonitor.zip *\n popd\n\n rm -rf build-aws-lambda-monitor-environment\n\nscp fetch the file from the amazon linux machine\n------------------------------------------------\n\nDownload the resulting zipped virtualenv from the EC2 instance and\ndestroy the instance.\n\nAdd the monitor to the zipped virtualenv\n----------------------------------------\n\n::\n\n zip --junk-paths awslambdamonitor.zip awslambdamonitor/monitor.py\n\nAdd your config to the zipped virtualenv\n----------------------------------------\n\n::\n\n zip --junk-paths awslambdamonitor.zip awslambdamonitor/monitor.yaml\n\nPublish package to AWS Lambda and setup CloudWatch scheduled job\n----------------------------------------------------------------\n\n::\n\n AWS_ACCOUNT_ID=123456789012\n AWS_PROFILE=myprofilename\n AWS_REGION=us-west-2\n aws lambda create-function --function-name monitor --runtime python2.7 --timeout 30 --role arn:aws:iam::$AWS_ACCOUNT_ID:role/lambda_basic_execution --handler monitor.monitor --zip-file fileb://awslambdamonitor.zip --profile $AWS_PROFILE --region $AWS_REGION\n aws lambda invoke --function-name monitor --log-type Tail --payload '{\"account\": \"123456789012\",\"region\": \"us-east-1\",\"detail\": {},\"detail-type\": \"Scheduled Event\",\"source\": \"aws.events\",\"time\": \"1970-01-01T00:00:00Z\",\"id\": \"cdc73f9d-aea9-11e3-9d5a-835b769c0d9c\",\"resources\": [\"arn:aws:events:us-east-1:123456789012:rule/AWSLambdaMonitor5Minutes\"]}' --profile $AWS_PROFILE --region $AWS_REGION output.txt\n\n aws lambda update-function-code --function-name monitor --zip-file fileb://awslambdamonitor.zip --profile $AWS_PROFILE --region $AWS_REGION\n\n aws events put-rule --name AWSLambdaMonitor5Minutes --schedule-expression 'rate(5 minutes)' --state ENABLED --profile $AWS_PROFILE --region $AWS_REGION\n aws events put-rule --name AWSLambdaMonitorDaily --schedule-expression 'rate(1 day)' --state ENABLED --profile $AWS_PROFILE --region $AWS_REGION\n\n aws lambda add-permission --function-name monitor --statement-id AWSLambdaMonitor5MinutesID --action 'lambda:monitor' --principal events.amazonaws.com --source-arn arn:aws:events:$AWS_REGION:$AWS_ACCOUNT_ID:rule/AWSLambdaMonitor5Minutes --profile $AWS_PROFILE --region $AWS_REGION\n aws lambda add-permission --function-name monitor --statement-id AWSLambdaMonitorDailyID --action 'lambda:monitor' --principal events.amazonaws.com --source-arn arn:aws:events:$AWS_REGION:$AWS_ACCOUNT_ID:rule/AWSLambdaMonitorDaily --profile $AWS_PROFILE --region $AWS_REGION\n\n aws events put-targets --rule AWSLambdaMonitor5Minutes --targets '{\"Id\" : \"AWSLambdaMonitor5Minutes-monitor\", \"Arn\": \"arn:aws:lambda:$AWS_REGION:$AWS_ACCOUNT_ID:function:monitor\"}' --profile $AWS_PROFILE --region $AWS_REGION\n aws events put-targets --rule AWSLambdaMonitorDaily --targets '{\"Id\" : \"AWSLambdaMonitorDaily-monitor\", \"Arn\": \"arn:aws:lambda:$AWS_REGION:$AWS_ACCOUNT_ID:function:monitor\"}' --profile $AWS_PROFILE --region $AWS_REGION\n\nIterate on code by updating and uploading\n-----------------------------------------\n\nIf you want to extend or modify the monitor you can update the running\ncode like this\n\n::\n\n # Update the file in the zip archive \n zip --junk-paths awslambdamonitor.zip awslambdamonitor/monitor.py\n\n # Upload the new zip file\n aws lambda update-function-code --function-name monitor --zip-file fileb://awslambdamonitor.zip --profile $AWS_PROFILE --region $AWS_REGION\n\nIf you want to change your configuration\n\n::\n\n # Update the file in the zip archive \n zip --junk-paths awslambdamonitor.zip awslambdamonitor/monitor.yaml\n\n # Upload the new zip file\n aws lambda update-function-code --function-name monitor --zip-file fileb://awslambdamonitor.zip --profile $AWS_PROFILE --region $AWS_REGION\n\nTest Event\n==========\n\nHere is an example event that you can use in the AWS Lambda web console\nto test the monitor\n\n::\n\n {\n \"account\": \"123456789012\",\n \"region\": \"us-east-1\",\n \"detail\": {},\n \"detail-type\": \"Scheduled Event\",\n \"source\": \"aws.events\",\n \"time\": \"1970-01-01T00:00:00Z\",\n \"id\": \"cdc73f9d-aea9-11e3-9d5a-835b769c0d9c\",\n \"resources\": [\n \"arn:aws:events:us-east-1:123456789012:rule/AWSLambdaMonitor5Minutes\"\n ]\n }",
"description_content_type": null,
"docs_url": null,
"download_url": "",
"downloads": {
"last_day": -1,
"last_month": -1,
"last_week": -1
},
"home_page": "https://github.com/gene1wood/awslambdamonitor",
"keywords": "aws lambda monitoring ses",
"license": "GPL-3.0",
"maintainer": "",
"maintainer_email": "",
"name": "awslambdamonitor",
"package_url": "https://pypi.org/project/awslambdamonitor/",
"platform": "UNKNOWN",
"project_url": "https://pypi.org/project/awslambdamonitor/",
"project_urls": {
"Homepage": "https://github.com/gene1wood/awslambdamonitor"
},
"release_url": "https://pypi.org/project/awslambdamonitor/1.0.0/",
"requires_dist": null,
"requires_python": "",
"summary": "A small monitoring tool which runs in AWS Lambda",
"version": "1.0.0"
},
"last_serial": 2317269,
"releases": {
"1.0.0": [
{
"comment_text": "",
"digests": {
"md5": "3230c32231bf351cbf752921a2f90814",
"sha256": "7cf07d01716d0ed214bad3517b8441619e6aa02020591005d0ee58ead69edc7d"
},
"downloads": -1,
"filename": "awslambdamonitor-1.0.0-py2-none-any.whl",
"has_sig": true,
"md5_digest": "3230c32231bf351cbf752921a2f90814",
"packagetype": "bdist_wheel",
"python_version": "py2",
"requires_python": null,
"size": 11858,
"upload_time": "2016-08-31T23:01:11",
"url": "https://files.pythonhosted.org/packages/aa/3d/bde0faa7b394559e6421845689f9bf3242400b9cd844046a51d8fdaab480/awslambdamonitor-1.0.0-py2-none-any.whl"
},
{
"comment_text": "",
"digests": {
"md5": "23ad07a96f6acc1029c38f8581faf5e1",
"sha256": "c7848271d3ce00d05a49960d19cf56cf27d3bb936ae8455c196cf3a271aca92d"
},
"downloads": -1,
"filename": "awslambdamonitor-1.0.0.tar.gz",
"has_sig": true,
"md5_digest": "23ad07a96f6acc1029c38f8581faf5e1",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 9165,
"upload_time": "2016-08-31T23:01:13",
"url": "https://files.pythonhosted.org/packages/0c/35/1db20f9a9fab3c745d0b220bc911a5e3e90bea34fc094eed1a79a47228a4/awslambdamonitor-1.0.0.tar.gz"
}
]
},
"urls": [
{
"comment_text": "",
"digests": {
"md5": "3230c32231bf351cbf752921a2f90814",
"sha256": "7cf07d01716d0ed214bad3517b8441619e6aa02020591005d0ee58ead69edc7d"
},
"downloads": -1,
"filename": "awslambdamonitor-1.0.0-py2-none-any.whl",
"has_sig": true,
"md5_digest": "3230c32231bf351cbf752921a2f90814",
"packagetype": "bdist_wheel",
"python_version": "py2",
"requires_python": null,
"size": 11858,
"upload_time": "2016-08-31T23:01:11",
"url": "https://files.pythonhosted.org/packages/aa/3d/bde0faa7b394559e6421845689f9bf3242400b9cd844046a51d8fdaab480/awslambdamonitor-1.0.0-py2-none-any.whl"
},
{
"comment_text": "",
"digests": {
"md5": "23ad07a96f6acc1029c38f8581faf5e1",
"sha256": "c7848271d3ce00d05a49960d19cf56cf27d3bb936ae8455c196cf3a271aca92d"
},
"downloads": -1,
"filename": "awslambdamonitor-1.0.0.tar.gz",
"has_sig": true,
"md5_digest": "23ad07a96f6acc1029c38f8581faf5e1",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 9165,
"upload_time": "2016-08-31T23:01:13",
"url": "https://files.pythonhosted.org/packages/0c/35/1db20f9a9fab3c745d0b220bc911a5e3e90bea34fc094eed1a79a47228a4/awslambdamonitor-1.0.0.tar.gz"
}
]
}