This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Install | |
| sudo apt-get install postgres-contrib | |
| # In postgres.conf | |
| shared_preload_libraries = 'pg_stat_statements' | |
| pg_stat_statements.max = 10000 | |
| pg_stat_statements.track = all | |
| # In any database | |
| create extension pg_stat_statements; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <VirtualHost *:80> | |
| ServerName amon.cx | |
| RewriteEngine on | |
| RewriteCond %{SERVER_PORT} !=443 | |
| RewriteCond %{REQUEST_URI} !^/ | |
| RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [NC,R=301,L] | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "host": "https://subdomain.amon:9001" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from datetime import datetime | |
| from boto.ec2.cloudwatch import CloudWatchConnection | |
| # Create the connection to Cloud Watch | |
| cw = CloudWatchConnection( | |
| aws_access_key_id=<aws_access_key>, | |
| aws_secret_access_key=<aws_secret_key> | |
| ) | |
| metrics = ["CPUUtilization", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /usr/bin/env bash | |
| set -xe | |
| export DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
| export DEBIAN_FRONTEND=noninteractive | |
| export ITERATION=`date +%s` | |
| export PACKAGE=circus | |
| export DESCRIPTION='circus, A Process & Socket Manager built with zmq' | |
| export VERSION=0.9.2 | |
| export WEB_VERSION=0.4.1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Django's SMTP EmailBackend doesn't support an SMTP_SSL connection necessary to interact with Amazon SES's newly announced SMTP server. We need to write a custom EmailBackend overriding the default EMailBackend's open(). Thanks to https://github.com/bancek/django-smtp-ssl for the example. | |
| """ | |
| --- settings.py | |
| EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' | |
| EMAIL_HOST = 'email-smtp.us-east-1.amazonaws.com' | |
| EMAIL_PORT = 465 | |
| EMAIL_HOST_USER = 'username' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Django's SMTP EmailBackend doesn't support an SMTP_SSL connection necessary to interact with Amazon SES's newly announced SMTP server. We need to write a custom EmailBackend overriding the default EMailBackend's open(). Thanks to https://github.com/bancek/django-smtp-ssl for the example. | |
| """ | |
| --- settings.py | |
| EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' | |
| EMAIL_HOST = 'email-smtp.us-east-1.amazonaws.com' | |
| EMAIL_PORT = 465 | |
| EMAIL_HOST_USER = 'username' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from amonagent.modules.plugins import AmonPlugin | |
| class AmonPlugin(AmonPlugin): | |
| def collect(self): | |
| self.gauge('requests.per.second', requests_per_second) | |
| self.counter('purchases', purchases) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [supervisord] | |
| nodaemon=true | |
| loglevel=debug | |
| [program:amon] | |
| command=gunicorn -c gunicorn.conf.py wsgi | |
| directory=/amon | |
| autostart=true | |
| autorestart=true | |
| redirect_stderr=true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM martinrusev/amon:latest | |
| COPY requirements.txt /var/requirements.txt | |
| RUN pip install -r /var/requirements.txt | |
| COPY crontab.txt /var/crontab.txt | |
| RUN crontab /var/crontab.txt | |
| RUN chmod 600 /etc/crontab | |
| COPY supervisord.conf /etc/supervisord.conf |