Skip to content

Instantly share code, notes, and snippets.

View fduran's full-sized avatar

Fernando Duran fduran

View GitHub Profile

Troubleshooting

Intro

The incident management steps I have in mind when being on-call and getting an alert are:

  • Verify the issue
  • Triage
  • Communicate and scalate if needed
  • Mitigate

Keybase proof

I hereby claim:

  • I am fduran on github.
  • I am fduran (https://keybase.io/fduran) on keybase.
  • I have a public key whose fingerprint is 07EC 2F80 E146 5882 ED6E A260 21CB C38A 8E89 7D06

To claim this, I am signing this object:

@fduran
fduran / django-install-nginx-uwsgi.md
Last active February 19, 2016 00:05
Django Install - Nginx uwsgi

Django Install - Nginx uwsgi

Once per server:

apt-get update && apt-get upgrade
apt-get install python-setuptools python-dev build-essential
easy_install -U pip
pip install virtualenv

@fduran
fduran / django_install_apache.md
Last active February 12, 2017 15:34
Django Install - Apache

Django Install - Apache

Once per server:

apt-get update && apt-get upgrade
apt-get install libapache2-mod-wsgi
apt-get install python-setuptools python-dev build-essential
easy_install -U pip

@fduran
fduran / Checking for Shellshock attempts in web server logs
Created October 1, 2014 17:19
Checking for Shellshock attempts in web server logs
# Checking for Shellshock attempts in web server logs
egrep "};|}\s*;" /var/log/apache2/access.log
@fduran
fduran / tail log file in browser
Created October 1, 2014 17:17
tail follow log file in browser
# tail log file in browser
# go to server.example.com:777
pip install tailon
tailon -f /var/log/example.log -b 0:0:0:0:777 &
@fduran
fduran / check and alert if mysql slave is not running
Created October 1, 2014 17:15
Check and alert if mysql slave is not running
#!/bin/bash
# check if mysql slave is running
log=/var/log/mysqlslave.log
email=user@example.com
date >> $log
res=`mysql -u root -pPassword -h db.example.com -N -B -e "show status like 'Slave_running'"|cut -f2`
if [ $res = 'ON' ]
@fduran
fduran / calculate mysql schema disk size
Created October 1, 2014 17:14
Calculate MySQL schema disk size
# calculate mysql schemas disk size
mysql -h dbhost.example.com -u theuser -pThePassword -e 'select table_schema as DB, round(sum((data_length+index_length)/1024/1024),1) as MB from information_schema.tables group by table_schema order by MB desc'
@fduran
fduran / WordPress Error establishing database connection
Last active August 29, 2015 14:07
WordPress Error establishing database connection
# WP "Error establishing database connection"
# substitute with site's index static page (when it's up, not with the error duh)
wget http://example.com -O [/path/to/wp]/wp-content/db-error.php
@fduran
fduran / mysql optimization
Created October 1, 2014 17:11
MySQL Optimization
# see http://mysqltuner.com/
wget https://raw.githubusercontent.com/major/MySQLTuner-perl/master/mysqltuner.pl
perl mysqltuner.pl