my $sql="select no_id,no_comment,pa_conninfo from $cluster.sl_node join $cluster.sl_path on (pa_server=no_id) where pa_client= $cluster.getlocalnodeid('$cluster'::name);";
my $sth = $dbh->prepare ($sql);
$sth->execute ();
my $locks = 0;
my $exlocks = 0;
while (my ($no_id,$comment, $conninfo) = $sth->fetchrow ()) {
$conninfo =~ s/.*host=([\w\d\._\-]*)\s.*/$1/;
$no_id = sprintf("slave_%u",$no_id);
print<<EOF
$no_id.label $conninfo
$no_id.info $comment
$no_id.type GAUGE
$no_id.warning 60
$no_id.critical 1800
$no_id.min 0
EOF
}
} else {
my $sql="select st_received,st_lag_num_events,EXTRACT(EPOCH FROM st_lag_time)::integer from $cluster.sl_status;";
my $sth = $dbh->prepare ($sql);
$sth->execute ();
my $locks = 0;
my $exlocks = 0;
while (my ($no_id,$nb_event, $lag) = $sth->fetchrow ()) {