Created
December 19, 2012 03:16
-
-
Save hanshasselberg/4334087 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# number postgres connections | |
sudo ps -ef | grep postgres | wc -l | |
# disk usage | |
iostat 5 | |
# memory | |
mpstat 5 | |
# slow req per second | |
tail -f /var/log/postgresql/postgresql-9.1-main.log | perl -e 'while (<>) {$l++;if (time > $e) {$e=time;print "$l\n";$l=0}}' | |
# slow query duration | |
tail -f /var/log/postgresql/postgresql-9.1-main.log | cut -d ' ' -f 7 | |
# req per second | |
def curr | |
`psql -c 'SELECT SUM(xact_commit) FROM pg_stat_database;' 2> /dev/null`.split("\n" | |
)[2].strip.to_i | |
end | |
while true | |
start = curr | |
sleep(1) | |
p curr - start | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment