[CLUE-Tech] PostgreSQL statistics question
Jeremiah Stanley
lists at miah.org
Fri Mar 28 11:21:18 MST 2003
Ok, I am setting up server to host web sites, whee. I need to monitor
the load and other statistics on the machine so I am using cacti
(http://www.raxnet.net/products/cacti/). This works great, I have a
graph for apache, load, memory, ip traffic, mysql, etc. But, this
webserver will be running PostgreSQL as a major component (3/4 websites
hosted will use it) and I need to collect stats from it.
MySQL comes with this handy little program mysqladmin that has a status
command that will return the total number of questions that have been
processed. This is great for gathering statistics on. The output looks
like this:
Uptime: 161927 Threads: 1 Questions: 277373 Slow queries: 0 Opens:
97 Flush tables: 1 Open tables: 48 Queries per second avg: 1.713
But, here's the hard part, I cannot find a way to have either: an
external program get this info from postgres much like mysqladmin or, a
sql query that I can run against the server to get this information out
in a similar fashion.
I have this query working to get the _current_ number of connections:
select count(*) from pg_stat_activity;
But, that doesn't do me a lot of good as I need to know what the change
has been for the last 5 minutes (so I can make pretty graphs).
Is there anybody on this list that is a postgres wizard and can help me
with this? I did some searching on google and all I got was the manual
telling me what I already know (b/c I RTFM). I'll buy a beer for an
answer to this one.
Pertinent details: Postgres = 7.2.1 (stat collection is turned on
Linux = RH 7.3
PHP
Perl
Thanks.
--
Jeremiah Stanley <lists at miah.org>
More information about the clue-tech
mailing list