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