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:4666801
Created January 29, 2013 19:15
How to reset user password in Graphite
cd /opt/graphite/webapp/graphite
python ./manage.py shell
P
(InteractiveConsole)
>>> from django.contrib.auth.models import User
>>> users = User.objects.all()
>>> users
[<User: graphite>, <User: default>]
>>> users[0].set_password('password-here')
>>> users[0].save()
@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
@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: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: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 / gist:7170213
Created October 26, 2013 14:45
Convert a list into a set in redis
redis-cli lrange 2013_10_26 0 2000 | xargs redis-cli sadd s2013_10_26
@coldclimate
coldclimate / gist:6163245
Created August 6, 2013 09:53
Find all errors, log out the time the happened, then hillbilly histogram them
grep -n "Connection refused" error.log-20130806 | awk '{print $2}' > errortimes.log
sort errortimes.log | uniq -c
// Don't forget this line or signal handling won't work:
declare(ticks = 1);
// This global flag is used to trigger a configuration file reload.
$load_config = true;
// The SIGHUP handler doesn't do any actual work; it just sets the flag.
function handle_hup($signal) {
global $load_config;
$load_config = true;
@coldclimate
coldclimate / gist:5974697
Created July 11, 2013 11:35
When developing scripts which are going to be run by cloud-init
The scripts you pass through as a compiled user-script are split up and expanded into /var/lib/cloud/instance/scripts so you can go and run them again and debug