Skip to content
Snippets Groups Projects
Commit adcca66a authored by Bryan Horstmann-Allen's avatar Bryan Horstmann-Allen
Browse files

Return replication thread metrics with MysqlStatus

parent d663d262
No related branches found
No related tags found
No related merge requests found
......@@ -54,6 +54,13 @@ documentation at http://dev.mysql.com/doc/.
=cut
=head1 NOTES
If you want to retrieve slave metrics, you will need to give the user you are
connecting as REPLICATION CLIENT privileges.
=cut
sub handler {
my $self = shift;
my $config = $self->{'config'};
......@@ -72,6 +79,15 @@ sub handler {
$metrics{$result->{'Variable_name'}} = $result->{'Value'};
}
my $slave_query = "SHOW SLAVE STATUS";
my $s_sth = $dbh->prepare($slave_query);
$s_sth->execute();
while (my $s_result = $s_sth->fetchrow_hashref) {
foreach my $field ( keys %{ $s_result } ) {
$metrics{$field} = $s_result->{$field};
}
}
return \%metrics;
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment