3 require 'commandLine.inc';
7 if( $lb->getServerCount() == 1 ) {
8 echo "This script dumps replication lag times, but you don't seem to have\n";
9 echo "a multi-host db server configuration.\n";
11 $lags = $lb->getLagTimes();
12 foreach( $lags as $n => $lag ) {
13 $host = $lb->getServerName( $n );
14 if( IP
::isValid( $host ) ) {
16 $host = gethostbyaddr( $host );
18 $ip = gethostbyname( $host );
20 $starLen = min( intval( $lag ), 40 );
21 $stars = str_repeat( '*', $starLen );
22 printf( "%10s %20s %3d %s\n", $ip, $host, $lag, $stars );