Parent Directory | Revision Log
new monitor for number of tupels in PostgreSQL database
1 | #!/usr/bin/perl -w |
2 | |
3 | use strict; |
4 | use DBI; |
5 | |
6 | my $host = shift @ARGV || ''; |
7 | $host = ";host=$host" if ($host); |
8 | my $user = shift @ARGV || "dpavlin"; |
9 | my $pass = shift @ARGV || ""; |
10 | |
11 | my $sql = "SELECT sum(relpages) FROM pg_class"; |
12 | |
13 | my $dbh = DBI->connect("DBI:Pg:dbname=template1$host",$user,$pass) || die $DBI::errstr; |
14 | my $sth=$dbh->prepare($sql); |
15 | |
16 | if ($sth->execute()) { |
17 | print join("\n",$sth->fetchrow_array()),"\n"; |
18 | } |
19 | |
20 | undef $sth; |
21 | $dbh->disconnect(); |
ViewVC Help | |
Powered by ViewVC 1.1.26 |