sub repl { print "********REPLICATION STATUS********\n\n"; my $rs = $dbh->prepare("show status like 'slave_running'"); my $rrdbs = $dbh->prepare("show variables like 'read_rnd_buffer_size'"); $rs->execute(); $rrdbs->execute(); while(my @vall = $rs->fetchrow_array()) { print "Replication Slave Status: $vall[1]\n"; if($vall[1] eq 'ON') { print "The system is configured as Mysql Replication SLAVE\n"; print " The following is the Slave Status\n"; my $mas_hos = $dbh->prepare("show slave status"); $mas_hos->execute(); while (my @val = $mas_hos->fetchrow_array()) { print "Slave_IO_State: $val[0]\n"; print "Master_host: $val[1]\n"; print "Slave_IO_Running: $val[10]\n"; print "Slave_SQL_Running: $val[11]\n\n"; #print "Seconds_Behind_master: $val[33]\n"; } $mas_hos->finish(); } } }