Projet

Général

Profil

Révision 647632f7

ID647632f7af05b5d82ceecaca2ee19befc8c72483
Parent a2c35ad7
Enfant a02eb363, 6facd3c3

Ajouté par Clemens Schwaighofer il y a plus de 13 ans

pgbouncer_

added strict for perl

Voir les différences:

plugins/postgresql/pgbouncer_
3 3
# re-write of python version of pgbouncer stats
4 4
# data from stats, pools (cleint, server)
5 5

  
6
use strict;
6 7
use Munin::Plugin;
7 8
use DBD::Pg;
8 9

  
......
16 17
my $db_host = $ENV{'pgbouncer_host'}  || 'localhost';
17 18
my $db_pass = $ENV{'pgbouncer_pass'}  || '';
18 19
my $db_name = 'pgbouncer';
19

  
20
my @data = ();
20 21
# get the DB (pool) name we want to fetch
21 22
$plugin_name =~ /pgbouncer_(.*)$/;
22
$pool_name = $1;
23
my $pool_name = $1;
23 24
# bail if no name
24 25
if (!$pool_name)
25 26
{
......
33 34
	# autoconf, nothing to do
34 35
	if ($ARGV[0] eq 'autoconf')
35 36
	{
36
		$dbh = DBI->connect("DBI:Pg:dbname=$db_name;host=$db_host;port=$db_port", $db_user, $db_pass);
37
		my $dbh = DBI->connect("DBI:Pg:dbname=$db_name;host=$db_host;port=$db_port", $db_user, $db_pass);
37 38
		if (!$dbh)
38 39
		{
39 40
			print "no\n";
......
156 157
}
157 158

  
158 159
# connect to data
159
$dbh = DBI->connect("DBI:Pg:dbname=$db_name;host=$db_host;port=$db_port", $db_user, $db_pass);
160
my $dbh = DBI->connect("DBI:Pg:dbname=$db_name;host=$db_host;port=$db_port", $db_user, $db_pass);
160 161
# go trough each set and get the data
161
foreach $get ('pools', 'stats')
162
foreach my $get ('pools', 'stats')
162 163
{
163 164
	# prep and execute the show query
164
	$pre = $dbh->prepare("SHOW $get");
165
	my $pre = $dbh->prepare("SHOW $get");
165 166
	$pre->execute();
166 167
	while (@data = $pre->fetchrow)
167 168
	{

Formats disponibles : Unified diff