Parent Directory | Revision Log
first version of module for PostgreSQL performance monitoring
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 |