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
# www.fduran.com | |
# exclude a process from being killed by oom killer | |
echo -17 > /proc/$PID/oom_adj | |
# The possible values of oom_adj range from -17 to +15. The higher the score, more likely the associated process is to be killed by OOM-killer: https://lwn.net/Articles/317814/ |
# Linux. Act upon an event in a log file | |
# www.fduran.com | |
apt-get upgrade; apt-get install inotify-tools | |
# create file myalert.sh: | |
# example finding Exception in tomcat log and sending email | |
#!/bin/bash | |
while inotifywait -e modify /path/to/file.log; do |
# www.fduran.com | |
# mysql status summary | |
mysqladmin -u root -pthepasswd process status | |
# check database mydb | |
/etc/init.d/mysqld stop; cd /var/lib/mysql; myisamchk --silent --force mydb/*.MYI | |
# repair mydb | |
/etc/init.d/mysqld start; mysqlcheck -u root -pthepassed --auto-repair --check --optimize --databases mydb |
# www.fduran.com | |
MySQL Master-Slave Replication Notes | |
Master | |
/etc/mysql/my.cnf | |
server-id = 100 | |
log_bin = /var/log/mysql/mysql-bin.log | |
binlog-do-db = wpdb | |
binlog-ignore-db = mysql |
# www.fduran.com | |
# Linux check DNS cache snooping | |
# check if somedomain (try popular ones like google.com etc) is cached in a dns_server | |
# with nslookup | |
nslookup -norecurse somedomain dns_server | |
# with dig | |
dig @dns_server somedomain A +norecurse |
# www.fduran.com | |
# python script to test/monitor if a Django site using authentication is up | |
# with logging output to a file including response times | |
# use in cronjob and output to log file, for ex: python /path/to/script.py >> /var/log/webmonitor.log | |
# bash: install pip if not already in system | |
apt-get install python-setuptools python-dev build-essential | |
easy_install -U pip | |
# bash: install requests |
# www.fduran.com | |
# Number of top 10 current TCP connections per IP | |
netstat -tan| grep -v 'LISTEN'| awk '{print $5}'| grep -v 'and' |grep -v 'Address' |cut -d':' -f1 |sort -n | uniq -c | sort -rn | head -n10 | |
# Top 10 IPs in Apache log files | |
cd /var/log/apache2; for i in ./access.log*; do echo $i; cat $i | awk '{print $1}'| sort -n | uniq -c | sort -rn | head -n10; done |
# monit monitoring http://mmonit.com/monit/ | |
# www.fduran.com | |
apt-get update; apt-get install monit | |
cp /etc/monit/monitrc /etc/monit/monitrc.orig | |
# edit /etc/monit/monitrc see examples at http://mmonit.com/wiki/Monit/ConfigurationExamples | |
# Respawn: |
I hereby claim:
To claim this, I am signing this object: