def run_pg_fouine(): | |
info = host_info[env.host_string] | |
db_name = info.tags.get('Name') | |
sudo('perl -pi -e "s/log_min_duration_statement = .*/log_min_duration_statement = 0/" /etc/postgresql/9.*/main/postgresql.conf') | |
sudo('/etc/init.d/postgresql reload') | |
time.sleep(30) | |
sudo('perl -pi -e "s/log_min_duration_statement = .*/log_min_duration_statement = 500/" /etc/postgresql/9.*/main/postgresql.conf') | |
sudo('/etc/init.d/postgresql reload') | |
run('tail -n 100000 /var/log/postgresql/postgresql-9.*-main.log > /tmp/pgfouine.txt') | |
run('gzip -f /tmp/pgfouine.txt') | |
get('/tmp/pgfouine.txt.gz', local_path = '/tmp/latest-pgfouine.txt.gz') | |
local('gunzip -f /tmp/latest-pgfouine.txt.gz') | |
now = int(time.time()) | |
local('~/src/pgfouine/pgfouine.php -logtype stderr -file /tmp/latest-pgfouine.txt -quiet > /tmp/pgfouine-%s-%d.html 2>1' % (db_name, now)) | |
local('open /tmp/pgfouine-%s-%d.html' % (db_name, now) ) |
This comment has been minimized.
This comment has been minimized.
it's from Fabric, a python tool for running commands across hosts. |
This comment has been minimized.
This comment has been minimized.
pg_fouine makes me super :( but hey, what's this? it's pg_stat_statements that doesn't suck! yaaaay |
This comment has been minimized.
This comment has been minimized.
This looks great - will try it out soon!
…On Apr 18, 2012 4:38 PM, "Peter van Hardenberg" < ***@***.***> wrote:
pg_fouine makes me super :(
but hey, what's this? it's pg_stat_statements that doesn't suck!
http://postgresql.1045698.n5.nabble.com/pg-stat-statements-with-query-tree-based-normalization-td4989745.html
yaaaay
---
Reply to this email directly or view it on GitHub:
https://gist.github.com/2307647
|
This comment has been minimized.
This comment has been minimized.
will instagram also open source this kind of management script as well? |
This comment has been minimized.
This comment has been minimized.
And if you want a much much faster version of pgfouine, try pg_query_analyser :) The needed fabfile is included in the examples directory. It's very much a work in progress though |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
just curious, what's the library that sudo() comes from? #lazyweb