Skip to content

Instantly share code, notes, and snippets.

@coldclimate
coldclimate / monitoring-alerting-mvp.markdown
Last active August 2, 2023 16:42
WIP 101 what to monitor and alert on.

Monitoring and Alerting Minimum Viable Product

A checklist for those attempting to only get out of bed when it's important and to be able to debug critial and non-critial issues.

Those emphesised should probably get you out of bed when they're too high/low/gone.

This is super opinionated but I welcome feedback. It's biased to retrofitting/cleaning up/brownfield type work because that's what I know best.

HTTP(S) Services

@coldclimate
coldclimate / gist:7f1bfd0e96af8582cf72
Created March 24, 2016 12:33
AWS S3 upload only to specific bucket
# I always have to look this up. You need PutObjectAcl as well as putting the object itself.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt1458821885000",
"Effect": "Allow",
@coldclimate
coldclimate / gist:464e6e5174d9a5ffcc6a
Created March 24, 2016 08:51
Get a list of all access keys on an AWS account
for USERNAME in `aws iam list-users | jq -r '.Users[].UserName'`
do
KEYS=$(aws iam list-access-keys --user-name $USERNAME | jq '.AccessKeyMetadata[].AccessKeyId')
echo $USERNAME, $KEYS
done
@coldclimate
coldclimate / gist:2507f829581f9aa7220d
Created January 30, 2016 12:04
Get HAPorxy stats from the command line
# adapted from https://tech.fawk.eu/111/
echo "show stat" | nc -U /var/lib/haproxy/stats
@coldclimate
coldclimate / Instructions
Created October 17, 2015 13:26
Installing Supervisord on Centos 66
Based on http://www.alphadevx.com/a/455-Installing-Supervisor-and-Superlance-on-CentOS
Vgrnt box used: https://github.com/tommy-muehle/puppet-vagrant-boxes/releases/download/1.0.0/centos-6.6-x86_64.box
sudo yum install python-setuptools
sudo easy_install supervisor
supervisord --version
echo_supervisord_conf | sudo tee /etc/supervisord.conf
sudo mkdir -p /etc/supervisord/conf.d/
sudo vi /etc/init.d/supervisord
{
'invocation': {
'module_name': u 'ec2_vpc',
'module_args': ''
},
u 'vpc_id': u 'vpc-42b1d027',
u 'changed': False,
u 'vpc': {
u 'dhcp_options_id': u 'dopt-331f0551', u 'region': u 'us-east-1', u 'cidr_block': u '10.181.208.0/22', u 'state': u 'available', u 'id': u 'vpc-42b1d027'
},
@coldclimate
coldclimate / gist:740230020f9c8cc077b7
Created December 14, 2014 19:39
Getting @github pages to work on ubuntu 14.04 vagrant box
1 sudo apt-get update
2 sudo -i
3 gem install bundler
4 sudo gem install bundler
5 cd /vagrant/
6 vi Gemfile
7 bundler install
8 vi Gemfile
9 bundler install
10 vi Gemfile

AWS CLI Profiles

Use named profiles if you have to connect using more than one set of credencials. No more editing .aws_config http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#cli-multiple-profiles

(sub tip: don't set a default and thus never accidentally conenct to the wrong place) aws --profile=prod ec2

Monitoring S3

There is no CloudWatch integration with S3. Roll you own by bolting together readin S3 and pushing it into CloudWatch (or other monitoring tools). Use awk to slice out the columns you are interested in.

@coldclimate
coldclimate / gist:7eee74748750ab51c6e7
Created November 29, 2014 18:15
Hello World in Rails
vagrant@vagrant-ubuntu-trusty-64:/vagrant/helloworld$ history
1 sudo apt-get update
2 sudo apt-get install ruby
3 ruby -v
4 sudo apt-get install rubygems
5 gem install rails
6 sudo gem install rails (cancelled - wondered if I should use the version in the tutorial)
7 sudo gem install rails -v 4.2.0.rc1 (also failed)
8 sudo gem remove rails
9 sudo gem install rails (might as well just check)
### Keybase proof
I hereby claim:
* I am coldclimate on github.
* I am coldclimate (https://keybase.io/coldclimate) on keybase.
* I have a public key whose fingerprint is 8696 1302 2C89 6D7E 8E53 4256 DE45 8702 1053 08E4
To claim this, I am signing this object: