Skip to content

Instantly share code, notes, and snippets.

View dblackdblack's full-sized avatar

David Black dblackdblack

  • Benchling
  • San Francisco
View GitHub Profile
@dblackdblack
dblackdblack / postgresql.py
Created April 15, 2016 17:52 — forked from robertsosinski/postgresql.py
DataDog script for collecting PostgreSQL stats
# Create the datadog user with select only permissions:
# CREATE USER datadog WITH PASSWORD '<complex_password>';
#
# Grant select permissions on a table or view that you want to monitor:
# GRANT SELECT ON <schema>.<table> TO datadog;
#
# Grant permissions for a specific column on a table or view that you want to monitor:
# GRANT SELECT (id, name) ON <schema>.<table> TO datadog;
#
# Let non-superusers look at pg_stat_activity in a read-only fashon.
@dblackdblack
dblackdblack / bootstrap_salt_cloudinit.rst
Last active April 7, 2016 16:36 — forked from akoumjian/bootstrap_salt_cloudinit.rst
Bootstrapping Salt on Linux EC2 with CloudInit

Boostrapping Salt on Linux EC2 with Cloud-Init

Salt is a great tool for remote execution and configuration management, however you will still need to bootstrap the daemon when spinning up a new node. One option is to create and save a custom AMI, but this creates another resource to maintain and document.

A better method for Linux machines uses Canonical's CloudInit to run a bootstrap script during an EC2 Instance initialization. Cloud-init takes the user_data string passed into a new AWS instance and runs it in a manner similar to rc.local. The bootstrap script needs to:

  1. Install Salt with dependencies
  2. Point the minion to the master