/[cricket]/parse_pg_stat.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /parse_pg_stat.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations)
Fri Sep 13 16:26:53 2002 UTC (17 years, 1 month ago) by dpavlin
Branch: MAIN
File MIME type: text/plain
first version of module for PostgreSQL performance monitoring

1 dpavlin 1.1 #!/usr/bin/perl -w
2    
3     use strict;
4     use DBI;
5    
6     my $user = "dpavlin";
7     my $host = shift @ARGV || '';
8     $host = ";host=$host" if ($host);
9    
10     my $sql = "select sum(numbackends),sum(xact_commit),sum(xact_rollback),sum(blks_read),sum(blks_hit) from pg_stat_database";
11    
12     my $dbh = DBI->connect("DBI:Pg:dbname=template1$host",$user,"") || die $DBI::errstr;
13     my $sth=$dbh->prepare($sql);
14    
15     if ($sth->execute()) {
16     print join("\n",$sth->fetchrow_array()),"\n";
17     }
18    
19     undef $sth;
20     $dbh->disconnect();

  ViewVC Help
Powered by ViewVC 1.1.26