Skip to content
dhruvservana edited this page Oct 29, 2018 · 5 revisions

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

  1. Clone the repository

  2. Setup a python virtual environment(version > 3.5). Follow through below commands to setup virtual environment

    make sure python 3.5 & above version is installed & python's virtual environment module is installed
    fullPath=`pwd`
    virtualenv -p /usr/bin/python3 $fullPath/pvenv
    source $fullPath/pvenv/bin/activate
    pip install -t . -r $fullPath/requirements.txt
    
  3. Validate the python version & pip version.

    python --version
    pip --version
    

Prerequisites

What things do you need to enable for this pinger lambda to work?

  • Slack incoming webhook and secret creation in AWS EC2 parameter store.

    Follow the instructions specified in link

    Create a secret in parameter store with parameter name: slack_webhook

    Example: https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX

  • S3 bucket to maintain the state of web applications

    export AWS_DEFAULT_REGION = 'eu-west-1';
    export BUCKETNAME = 'some-bucket-name';
    if ! aws s3api head-bucket --bucket $BUCKETNAME 2>/dev/null; then
      aws s3api create-bucket --bucket $BUCKETNAME --region $AWS_DEFAULT_REGION --create-bucket-configuration LocationConstraint=$AWS_DEFAULT_REGION
    fi
    

Deployment

Notes about how to deploy this on a live system

if you are already a Jenkins user, you can simply create a pipeline using Jenkinsfile available within this repository(change the environment variables based on your needs). Add URLs to be monitored to the config file(config.yaml).

Alternatively, you could use below CLI command to get the stack up and running(make sure the artifact is pre-built and pushed to S3). Steps to build code artifact is described in link

 ```
 aws cloudformation deploy \
    	--template-file $fullPath/cfn/pingerCF.yaml \
    	--stack-name $BUCKETNAME-$ENVIRONMENT-stack \
    	--parameter-overrides Environment="$ENVIRONMENT" \
                            Organisation="$ORGANISATION" \
                            BucketName="$BUCKETNAME" \
                            ArtifactName="pinger_$VERSION.zip" \
                            MonitoringFrequency="$MONITORINGFREQUENCY" \
                            CustomMetricFilters="$CUSTOMMETRICFILTERS" \
    	--capabilities CAPABILITY_IAM \
 ```

Custom metrics and Alarms

URL response code and response time are shipped to cloud watch. You can enable the custom metric cloud formation parameter to additional create custom metrics and alarms for overall 4XX and 5XX. You can optionally enable subscription filters to elastic search for analytics of response times.

Kindly note that cloud watch custom metrics, alarms & ElasticSearch have separate pricing on AWS.

Versioning

We use SemVer for versioning & version is currently maintained in static file version.prop

Authors

Servana Managed Services

License

This project is licensed under the MIT Opensource License. Refer license file for more details