Add error message to extinfo
This commit is contained in:
parent
a535a5df53
commit
4547f33dda
|
@ -24,6 +24,19 @@ use strict;
|
|||
my $MYSQL = $ENV{mysql} || "mysql";
|
||||
my $MYSQLOPTS = $ENV{mysqlopts} || "";
|
||||
|
||||
my $status = `$MYSQL $MYSQLOPTS -e 'SHOW SLAVE STATUS\\G'`;
|
||||
|
||||
my $sqlerror = "";
|
||||
my $ioerror = "";
|
||||
|
||||
if ($status =~ /Last_SQL_Error: (.+)/) {
|
||||
$sqlerror = $1;
|
||||
}
|
||||
if ($status =~ /Last_IO_Error: (.+)/) {
|
||||
$ioerror = $1;
|
||||
}
|
||||
|
||||
|
||||
if(defined $ARGV[0] && $ARGV[0] eq 'config') {
|
||||
print <<EOC
|
||||
graph_title MySQL Slave Threads
|
||||
|
@ -32,18 +45,18 @@ graph_category db
|
|||
graph_args -l 0
|
||||
io.label I/O Thread
|
||||
io.critical 1:1
|
||||
io.extinfo $ioerror
|
||||
sql.label SQL Thread
|
||||
sql.critical 1:1
|
||||
sql.extinfo $sqlerror
|
||||
EOC
|
||||
;
|
||||
exit 0;
|
||||
}
|
||||
|
||||
my $status = `$MYSQL $MYSQLOPTS -e 'SHOW SLAVE STATUS\\G'`;
|
||||
|
||||
$status =~ /Slave_IO_Running: (\w+)/;
|
||||
print 'io.value '.($1 eq 'Yes' ? 1 : 0)."\n";
|
||||
$status =~ /Slave_SQL_Running: (\w+)/;
|
||||
print 'sql.value '.($1 eq 'Yes' ? 1 : 0)."\n";
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue