Skip to content

Instantly share code, notes, and snippets.

@jayjanssen
Created June 11, 2012 17:16
Show Gist options
  • Save jayjanssen/2911398 to your computer and use it in GitHub Desktop.
Save jayjanssen/2911398 to your computer and use it in GitHub Desktop.
Monitor checkpoint age on any Innodb server
#!/usr/bin/perl
#LOG
#---
#Log sequence number 248 2222568315
#Log flushed up to 248 2222533410
#Last checkpoint at 248 1843690869
#
use strict;
my $lsn;
my $checkpoint;
while( my $line = <STDIN> ) {
if( $line =~ m/^Log sequence number (\d+) (\d+)$/ ) {
$lsn = $2;
} elsif( $line =~ m/^Last checkpoint at \s*(\d+) (\d+)/ ) {
$checkpoint = $2;
}
}
#print "LSN: $lsn\n";
#print "chkpt: $checkpoint\n";
my $age = $lsn - $checkpoint;
my $age_mb = ($age / 1024) / 1024;
printf "Checkpoint Age: %.2dMB\n", $age_mb;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment