andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone
dc8c34
From 7cb52179b891061803869b21c1000aa35a51e27c Mon Sep 17 00:00:00 2001
dc8c34
From: Mark Reynolds <mreynolds@redhat.com>
dc8c34
Date: Mon, 14 Oct 2013 13:13:24 -0400
dc8c34
Subject: [PATCH 181/225] Ticket 47538 - RFE: repl-monitor.pl plain text
dc8c34
 output, cmdline config options
dc8c34
dc8c34
RFE Description:  Request option to print report in plain text(instead of HTML), and
dc8c34
                  be able to add the configfuration file directives as command line
dc8c34
                  options.
dc8c34
dc8c34
Fix Description:  Add a new option "-s" for displaying plain text report.
dc8c34
dc8c34
                  Added new options for the config file directives:
dc8c34
dc8c34
                      -c "connection value"
dc8c34
                      -a "alias value"
dc8c34
                      -k "color value"
dc8c34
dc8c34
                  Added a new option (-W, --prompt) to prompt for passwords.
dc8c34
dc8c34
                  Added "long names" to the commandline options.
dc8c34
                  Updated to use:  GetOpts::Long, strict, warnings
dc8c34
dc8c34
                  Cleaned up some HTML code/colors, and indentation.
dc8c34
dc8c34
                  Update man page.
dc8c34
dc8c34
https://fedorahosted.org/389/ticket/47538
dc8c34
dc8c34
Reviewed by: nhosoi, nkinder, and rmeggins(Thanks!!!)
dc8c34
(cherry picked from commit 76abd736d3bf763cc0e7bc1987fe76c27159db6f)
dc8c34
(cherry picked from commit dae03f042334ede551a6c1972e2163a2f923f352)
dc8c34
---
dc8c34
 ldap/admin/src/scripts/repl-monitor.pl.in | 576 ++++++++++++++++++++----------
dc8c34
 man/man1/repl-monitor.1                   |  35 +-
dc8c34
 2 files changed, 415 insertions(+), 196 deletions(-)
dc8c34
dc8c34
diff --git a/ldap/admin/src/scripts/repl-monitor.pl.in b/ldap/admin/src/scripts/repl-monitor.pl.in
dc8c34
index 8839ed2..45d58a1 100755
dc8c34
--- a/ldap/admin/src/scripts/repl-monitor.pl.in
dc8c34
+++ b/ldap/admin/src/scripts/repl-monitor.pl.in
dc8c34
@@ -41,8 +41,9 @@
dc8c34
 # FILE: repl-monitor.pl
dc8c34
 #
dc8c34
 # SYNOPSIS:
dc8c34
-#    repl-monitor.pl -f configuration-file [-h host] [-p port] [-r]
dc8c34
-#                    [-u refresh-url] [-t refresh-interval]
dc8c34
+#    repl-monitor.pl [-f configuration-file] [-h host] [-p port] [-r]
dc8c34
+#                    [-c connection] [-a alias] [-k color] [-u refresh-url] 
dc8c34
+#                    [-t refresh-interval] [-s] [-W]
dc8c34
 #
dc8c34
 #    repl-monitor.pl -v
dc8c34
 #
dc8c34
@@ -111,6 +112,22 @@
dc8c34
 #   If the color section or color entry is missing, the default color
dc8c34
 #   set is: green for [0-5) minutes lag, yellow [5-60), and red 60 and more.
dc8c34
 #
dc8c34
+#   The following three options (-c, -a, -k) are used if not providing a 
dc8c34
+#   configuration file:
dc8c34
+#
dc8c34
+#    -c connection
dc8c34
+#       The connection value is the same as the configuration file value(see above):
dc8c34
+#           -c "host:port:binddn:bindpwd:bindcert"
dc8c34
+#
dc8c34
+#    -a alias
dc8c34
+#       The alias value is the same as the configuration file value(see above):
dc8c34
+#           -a "alias=host:port"
dc8c34
+#
dc8c34
+#    -k color
dc8c34
+#       The color value is written as "lowmark:color".  Where the lowmark is in minutes.
dc8c34
+#       This option is ignored if printing a plain text report.
dc8c34
+#           -k "5=#ccffcc"
dc8c34
+#       
dc8c34
 #    -h host
dc8c34
 #       Initial replication supplier's host. Default to the current host.
dc8c34
 #
dc8c34
@@ -132,6 +149,10 @@
dc8c34
 #       the output HTML file would automatically refresh itself. This
dc8c34
 #       is useful for continuing monitoring. See also option -t.
dc8c34
 #
dc8c34
+#    -s Print output in plain text, instead of HTML.
dc8c34
+#
dc8c34
+#    -W Prompt for connection passwords.
dc8c34
+#
dc8c34
 #    -v Print out the version of this script
dc8c34
 # 
dc8c34
 # DIAGNOSTICS:
dc8c34
@@ -156,11 +177,17 @@
dc8c34
 # If using this script standalone, be sure to set the shared lib path and
dc8c34
 # the path to the perldap modules.
dc8c34
 
dc8c34
+use strict;
dc8c34
+use warnings;
dc8c34
 use lib qw(@perlpath@);
dc8c34
 
dc8c34
-$usage = "\nusage: $0 -f configuration-file [-h host] [-p port] [-r] [-u refresh-url] [-t refresh-interval]\n\nor   : $0 -v\n"; 
dc8c34
+my $usage = "\nusage: $0 [-f configuration-file | --configfile configuration-file] " .
dc8c34
+         "[-c connection, --conn connection] [-a alias, --alias alias] [-k color, --color color] " . 
dc8c34
+         "[-h host, --host host] [-p port, --port port] [-r, --skip-header] [-s, --text] " .
dc8c34
+         "[-u refresh-url, --url refresh-url] [-t refresh-interval, --interval refresh-interval ] " .
dc8c34
+         "[-W, --prompt]\n\nor   : $0 -v | --version\n"; 
dc8c34
 
dc8c34
-use Getopt::Std;		# parse command line arguments
dc8c34
+use Getopt::Long;		# parse command line arguments
dc8c34
 use Mozilla::LDAP::Conn;	# LDAP module for Perl
dc8c34
 use Mozilla::LDAP::Utils qw(normalizeDN);	# LULU, utilities.
dc8c34
 use Mozilla::LDAP::API qw(:api :ssl :apiv3 :constant); # Direct access to C API
dc8c34
@@ -169,29 +196,43 @@ use Time::Local; # to convert GMT Z strings to localtime
dc8c34
 #
dc8c34
 # Global variables
dc8c34
 #
dc8c34
-$product = "Directory Server Replication Monitor";
dc8c34
-$version = "Version 1.0";
dc8c34
+my $product = "Directory Server Replication Monitor";
dc8c34
+my $version = "Version 1.1";
dc8c34
 #
dc8c34
 # ldap servers given or discovered from the replication agreements:
dc8c34
-# @servers		= (host:port=shadowport:binddn:password:cert_db)
dc8c34
+my @servers; # = (host:port=shadowport:binddn:password:cert_db)
dc8c34
+my $serveridx;
dc8c34
 #
dc8c34
 # entries read from the connection section of the configuration file:
dc8c34
-# @allconnections	= (host:port=shadowport:binddn:password:cert_db)
dc8c34
+my @allconnections; # = (host:port=shadowport:binddn:password:cert_db)
dc8c34
 #
dc8c34
 # aliases of ldap servers read from the configuration file:
dc8c34
-# %allaliases{$host:$port}= (alias)
dc8c34
+my %allaliases; # = {$host:$port} = (alias)
dc8c34
+# colors
dc8c34
+my %allcolors;
dc8c34
+my @colorkeys;
dc8c34
+
dc8c34
 #
dc8c34
 # replicas discovered on all ldap servers
dc8c34
-# @allreplicas		= (server#:replicaroot:replicatype:serverid:replicadn)
dc8c34
+my @allreplicas; # = (server#:replicaroot:replicatype:serverid:replicadn)
dc8c34
 #
dc8c34
 # ruvs retrieved from all replicas
dc8c34
-# @allruvs{replica#:masterid} = (rawcsn:decimalcsn;mon/day/year hh:mi:ss)
dc8c34
+my %allruvs; # = {replica#:masterid} = (rawcsn:decimalcsn;mon/day/year hh:mi:ss)
dc8c34
 #
dc8c34
 # agreements discovered on all ldap supplier servers:
dc8c34
-# @allagreements	= (supplier_replica#:consumer#:conntype:schedule:status)
dc8c34
+my @allagreements; # = (supplier_replica#:consumer#:conntype:schedule:status)
dc8c34
 # the array may take another format after the consumer replicas are located:
dc8c34
-# @allagreements	= (supplier_replica#:consumer_replica#:conntype:schedule:status)
dc8c34
+# @allagreements; # = (supplier_replica#:consumer_replica#:conntype:schedule:status)
dc8c34
+#
dc8c34
+my %ld; # ldap connection hash
dc8c34
 #
dc8c34
+my ($opt_f, $opt_h, $opt_p, $opt_u, $opt_t, $opt_r, $opt_s);
dc8c34
+my (@conns, @alias, @color);
dc8c34
+my ($section, $interval, $nowraw, $now, $mm, $dd, $tt, $yy, $wday);
dc8c34
+my ($fn, $rc, $prompt, $last_sidx);
dc8c34
+my %passwords = ();
dc8c34
+my $passwd = "";
dc8c34
+$prompt = "";
dc8c34
 
dc8c34
 #main
dc8c34
 {
dc8c34
@@ -199,15 +240,23 @@ $version = "Version 1.0";
dc8c34
 	$| = 1;
dc8c34
 
dc8c34
 	# Check for legal options
dc8c34
-	if (!getopts('h:p:f:ru:t:v')) {
dc8c34
-		print $usage;
dc8c34
-		exit -1;
dc8c34
-  	}
dc8c34
-
dc8c34
-	if ($opt_v) {
dc8c34
-		print "$product - $version\n";
dc8c34
-		exit;
dc8c34
-	}
dc8c34
+  	GetOptions(
dc8c34
+		'h|host=s' => \$opt_h,
dc8c34
+		'p|port=s' => \$opt_p,
dc8c34
+		'f|configfile=s' => \$opt_f,
dc8c34
+		'c|conn=s' => \@conns,
dc8c34
+		'a|alias=s' => \@alias,
dc8c34
+		'k|color=s' => \@color,
dc8c34
+		'u|url=s' => \$opt_u,
dc8c34
+		't|interval=s' => \$opt_t,
dc8c34
+		'W|prompt' => sub { $prompt = "yes"; },
dc8c34
+		'r|skip-header' => sub { $opt_r = "1"; },
dc8c34
+		's|text' => sub {$opt_s = "1"; },
dc8c34
+		'v|version' => sub { print "$product - $version\n"; exit ;}
dc8c34
+	) or die "Usage error: $usage\n";
dc8c34
+
dc8c34
+	exit -1 if &validateArgs < 0;
dc8c34
+	exit if &read_cfg_file ($opt_f) < 0;
dc8c34
 
dc8c34
 	$interval = $opt_t;
dc8c34
 	$interval = 300 if ( !$interval || $interval <= 0 );
dc8c34
@@ -221,22 +270,23 @@ $version = "Version 1.0";
dc8c34
 	if (!$opt_r) {
dc8c34
 		# print the HTML header
dc8c34
 		&print_html_header;
dc8c34
-	} else {
dc8c34
-		# print separator for new replication set
dc8c34
-		print "

\n";
dc8c34
+	} else  {
dc8c34
+		if($opt_s){
dc8c34
+			print"\n";
dc8c34
+		} else {
dc8c34
+			# print separator for new replication set
dc8c34
+			print "

\n";
dc8c34
+		}
dc8c34
 	}
dc8c34
 
dc8c34
-	exit -1 if &validateArgs < 0;
dc8c34
-	exit if &read_cfg_file ($opt_f) < 0;
dc8c34
-
dc8c34
 	# Start with the given host and port
dc8c34
 	# The index names in %ld are defined in Mozilla::LDAP::Utils::ldapArgs()
dc8c34
 	&add_server ("$ld{host}:$ld{port}:$ld{bind}:$ld{pswd}:$ld{cert}");
dc8c34
 
dc8c34
 	$serveridx = 0;
dc8c34
-	while ($serveridx <= $#servers) {
dc8c34
+	while ($serveridx <= $#servers) { 
dc8c34
 		if (&get_replicas ($serveridx) != 0 && $serveridx == 0) {
dc8c34
-			my ($host, $port, $binddn) = split (/:/, $servers[0]);
dc8c34
+			my ($host, $port, $binddn) = split (/:/, $servers[$serveridx]);
dc8c34
 			print("Login to $host:$port as \"$binddn\" failed\n");
dc8c34
 			exit;
dc8c34
 		}
dc8c34
@@ -253,14 +303,19 @@ $version = "Version 1.0";
dc8c34
 
dc8c34
 sub validateArgs
dc8c34
 {
dc8c34
-	my ($rc) = 0;
dc8c34
+	$rc = 0;
dc8c34
 
dc8c34
 	%ld = Mozilla::LDAP::Utils::ldapArgs();
dc8c34
-
dc8c34
-	if (!$opt_v && !$opt_f) {
dc8c34
-		print "

Error: Missing configuration file.\n";

dc8c34
-		print "

If you need help on the configuration file, Please go back and click the Help button.\n";

dc8c34
-		#print $usage;	# Don't show usage in CGI
dc8c34
+	if (!$opt_f && $#conns < 0) {
dc8c34
+		if($opt_s){
dc8c34
+			print "Error: Missing configuration file or connection parameter.\n";
dc8c34
+			print $usage;  
dc8c34
+		} else {
dc8c34
+			print "

Error: Missing configuration file or connection paramater.\n";

dc8c34
+			print "

If you need help on the configuration file, or script usage, " .

dc8c34
+			"Please go back and click the Help button.\n";
dc8c34
+			#print $usage; # Don't show usage in CGI
dc8c34
+		}
dc8c34
 		$rc = -1;
dc8c34
 	}
dc8c34
 	elsif (!$opt_h) {
dc8c34
@@ -272,63 +327,90 @@ sub validateArgs
dc8c34
 
dc8c34
 sub read_cfg_file
dc8c34
 {
dc8c34
-	my ($fn) = @_;
dc8c34
-	unless (open(CFGFILEHANDLE, $fn)) {
dc8c34
-		print "

Error: Can't open \"$fn\": $!.\n";

dc8c34
-		print "

If you need help on the configuration file, Please go back and click the Help button.\n";

dc8c34
-		return -1;
dc8c34
+	($fn) = @_;
dc8c34
+	my $tmp;
dc8c34
+	
dc8c34
+	# process the command line config params
dc8c34
+	@allconnections = @conns;
dc8c34
+	if($#alias >= 0){
dc8c34
+		foreach $tmp (@alias){
dc8c34
+			$tmp =~ m/^\s*(\S.*)\s*=\s*(\S+)/;
dc8c34
+			$allaliases{$2} = $1;
dc8c34
+		}
dc8c34
 	}
dc8c34
-	$section = 0;
dc8c34
-	while (<CFGFILEHANDLE>) {
dc8c34
-		next if (/^\s*\#/ || /^\s*$/);
dc8c34
-		chop ($_);
dc8c34
-		if (m/^\[(.*)\]/) {
dc8c34
-			$section = $1;
dc8c34
+	if($#color >= 0){
dc8c34
+		foreach $tmp (@color){
dc8c34
+			$tmp =~ m/^\s*(-?\d+)\s*=\s*(\S+)/;
dc8c34
+			$allcolors{$1} = $2;
dc8c34
 		}
dc8c34
-		else {
dc8c34
-			if ( $section =~ /conn/i ) {
dc8c34
-				push (@allconnections, $_);
dc8c34
-			}
dc8c34
-			elsif ( $section =~ /alias/i ) {
dc8c34
-				m/^\s*(\S.*)\s*=\s*(\S+)/;
dc8c34
-				$allaliases {$2} = $1;
dc8c34
-			}
dc8c34
-			elsif ( $section =~ /color/i ) {
dc8c34
-				m/^\s*(-?\d+)\s*=\s*(\S+)/;
dc8c34
-				$allcolors {$1} = $2;
dc8c34
+	}
dc8c34
+	
dc8c34
+	if($opt_f){
dc8c34
+		unless (open(CFGFILEHANDLE, $fn)) {
dc8c34
+			if($opt_s){
dc8c34
+				print "Error: Can't open configuration file\"$fn\": $!.\n";
dc8c34
+			} else {
dc8c34
+				print "

Error: Can't open configuration file\"$fn\": $!.\n";

dc8c34
+				print "

If you need help on the configuration file, Please go back and click the Help button.\n";

dc8c34
 			}
dc8c34
-		}
dc8c34
+    			return -1;
dc8c34
+    		}
dc8c34
+    		$section = 0;
dc8c34
+    		while (<CFGFILEHANDLE>) {
dc8c34
+    			next if (/^\s*\#/ || /^\s*$/);
dc8c34
+			chop ($_);
dc8c34
+    		if (m/^\[(.*)\]/) {
dc8c34
+    			$section = $1;
dc8c34
+    		}
dc8c34
+    		else {
dc8c34
+    			if ( $section =~ /conn/i ) {
dc8c34
+    				push (@allconnections, $_);
dc8c34
+    			}
dc8c34
+    			elsif ( $section =~ /alias/i ) {
dc8c34
+    				m/^\s*(\S.*)\s*=\s*(\S+)/;
dc8c34
+    				$allaliases {$2} = $1;
dc8c34
+    			}
dc8c34
+    			elsif ( $section =~ /color/i ) {
dc8c34
+    				m/^\s*(-?\d+)\s*=\s*(\S+)/;
dc8c34
+    				$allcolors {$1} = $2;
dc8c34
+    			}
dc8c34
+    		}
dc8c34
+    	}
dc8c34
+    	close (CFGFILEHANDLE);
dc8c34
 	}
dc8c34
 	if ( ! keys (%allcolors) ) {
dc8c34
-		$allcolors {0} = "#ccffcc";	#apple green
dc8c34
-		$allcolors {5} = "#ffffcc";	#cream yellow
dc8c34
-		$allcolors {60} = "#ffcccc";	#pale pink
dc8c34
+		$allcolors {0} = "#ccffcc"; #apple green
dc8c34
+		$allcolors {5} = "#ffffcc"; #cream yellow
dc8c34
+		$allcolors {60} = "#ffcccc"; #pale pink
dc8c34
 	}
dc8c34
 	@colorkeys = sort (keys (%allcolors));
dc8c34
-	close (CFGFILEHANDLE);
dc8c34
+    
dc8c34
 	return 0;
dc8c34
 }
dc8c34
 
dc8c34
 sub get_replicas
dc8c34
 {
dc8c34
-	my ($serveridx) = @_;
dc8c34
+	$serveridx = $_[0];
dc8c34
 	my ($conn, $host, $port, $shadowport, $binddn, $bindpwd, $bindcert);
dc8c34
 	my ($others);
dc8c34
 	my ($replica, $replicadn);
dc8c34
 	my ($ruv, $replicaroot, $replicatype, $serverid, $masterid, $maxcsn);
dc8c34
 	my ($type, $flag, $i);
dc8c34
 	my ($myridx, $ridx, $cidx);
dc8c34
+	my ($lastmodifiedat, $agreement);
dc8c34
 
dc8c34
 	#
dc8c34
 	# Bind to the server
dc8c34
 	#
dc8c34
-	($host, $port, $binddn, $bindpwd, $bindcert) = split (/:/, "$servers[$serveridx]", 5);
dc8c34
+	if($#servers < 0 || $serveridx > $#servers + 1){
dc8c34
+		return -1;
dc8c34
+	}
dc8c34
 
dc8c34
+	($host, $port, $binddn, $bindpwd, $bindcert) = split (/:/, "$servers[$serveridx]", 5);
dc8c34
 	($port, $shadowport) = split (/=/, $port);
dc8c34
 	$shadowport = $port if !$shadowport;
dc8c34
 
dc8c34
 	$conn = new Mozilla::LDAP::Conn ($host, $shadowport, "$binddn", $bindpwd, $bindcert);
dc8c34
-
dc8c34
 	return -1 if (!$conn);
dc8c34
 
dc8c34
 	#
dc8c34
@@ -508,24 +590,21 @@ sub find_consumer_replicas
dc8c34
 
dc8c34
 sub process_suppliers
dc8c34
 {
dc8c34
-	my ($ridx, $mid, $maxcsn);
dc8c34
-
dc8c34
-	$mid = "";
dc8c34
+	my ($ridx, $mid, $maxcsn, $ismaster);
dc8c34
 	$ismaster = 0;
dc8c34
+	$mid = "";
dc8c34
 
dc8c34
 	$last_sidx = -1;	# global variable for print html page
dc8c34
 
dc8c34
 	for ($ridx = 0; $ridx <= $#allreplicas; $ridx++) {
dc8c34
-
dc8c34
 		# Handle masters and hubs
dc8c34
 		if ($allreplicas[$ridx] =~ /:master:(\d+):/i) {
dc8c34
 			$mid = $1;
dc8c34
 
dc8c34
 			# Skip replicas without agreements defined yet
dc8c34
 			next if (! grep {$_->{ridx} == $ridx} @allagreements);
dc8c34
-
dc8c34
 			$maxcsn = &print_master_header ($ridx, $mid);
dc8c34
-			if ( "$maxcsn" != "none" ) {
dc8c34
+			if ( "$maxcsn" ne "none" ) {
dc8c34
 				&print_consumer_header ();
dc8c34
 				&print_consumers ($ridx, $mid);
dc8c34
 			}
dc8c34
@@ -536,7 +615,7 @@ sub process_suppliers
dc8c34
 			# Skip replicas without agreements defined yet
dc8c34
 			next if (! grep {$_->{ridx} == $ridx} @allagreements);
dc8c34
 
dc8c34
-		    foreach $key (keys %allruvs) {
dc8c34
+		    foreach my $key (keys %allruvs) {
dc8c34
 				if ( $key =~ /$ridx:/) {
dc8c34
 					my ($myridx, $mymid) = split ( /:/, "$key" );
dc8c34
 					$maxcsn = &print_hub_header($myridx, $mymid);
dc8c34
@@ -549,7 +628,11 @@ sub process_suppliers
dc8c34
 	}
dc8c34
 
dc8c34
 	if ($mid eq "") {
dc8c34
-		print "

The server is not a master or a hub or it has no replication agreement\n";

dc8c34
+		if($opt_s){
dc8c34
+			print "The server is not a master or a hub or it has no replication agreement\n";
dc8c34
+		} else {
dc8c34
+			print "

The server is not a master or a hub or it has no replication agreement\n";

dc8c34
+		}
dc8c34
 	}
dc8c34
 }
dc8c34
 
dc8c34
@@ -560,34 +643,40 @@ sub print_master_header
dc8c34
 	my ($maxcsnval) = split ( /;/, "$myruv" );
dc8c34
 	my ($maxcsn) = &to_string_csn ($maxcsnval);
dc8c34
 	my ($sidx, $replicaroot, $replicatype, $serverid) = split (/:/, $allreplicas[$ridx]);
dc8c34
-
dc8c34
-	if ( $maxcsn == "" ) {
dc8c34
+    
dc8c34
+	if ( $maxcsn eq "" ) {
dc8c34
 		return $maxcsn;
dc8c34
 	}
dc8c34
 
dc8c34
 	# Print the master name
dc8c34
-	if ( $last_sidx != $sidx ) {
dc8c34
+	if ( $last_sidx ne $sidx ) {
dc8c34
 		my ($ldapurl) = &get_ldap_url ($sidx, $sidx);
dc8c34
 		&print_legend if ( $last_sidx < 0);
dc8c34
-		print "


\n";

dc8c34
-		print "\n

<center class=page-subtitle><font color=#0099cc>\n";

dc8c34
-		print "Master:&nbsp $ldapurl</center>\n";
dc8c34
+		if($opt_s){
dc8c34
+			print "Master: $ldapurl\n"
dc8c34
+		} else {
dc8c34
+			print "


\n";

dc8c34
+			print "\n

<center class=page-subtitle><font color=#0099cc>\n";

dc8c34
+			print "Master:&nbsp $ldapurl</center>\n";
dc8c34
+		}
dc8c34
 		$last_sidx = $sidx;
dc8c34
 	}
dc8c34
 
dc8c34
 	# Print the current replica info onthe master
dc8c34
-	print "\n

\n";
dc8c34
-
dc8c34
-	print "\n<center>\n";
dc8c34
-	print "<font class=areatitle>Replica ID: </font>";
dc8c34
-	print "<font class=text28>$serverid</font>\n";
dc8c34
-
dc8c34
-	print "<font class=areatitle>Replica Root: </font>";
dc8c34
-	print "<font class=text28>$replicaroot</font>\n";
dc8c34
-
dc8c34
-	print "<font class=areatitle>Max CSN: </font>";
dc8c34
-	print "<font class=text28>$maxcsn</font>\n";
dc8c34
-
dc8c34
+	if($opt_s){
dc8c34
+		print "Replica ID: $serverid\n";
dc8c34
+		print "Replica Root: $replicaroot\n";
dc8c34
+		print "Max CSN: $maxcsn\n";
dc8c34
+	} else {
dc8c34
+		print "\n

\n";
dc8c34
+		print "\n<center>\n";
dc8c34
+		print "<font class=areatitle>Replica ID: </font>";
dc8c34
+		print "<font class=text28>$serverid</font>\n";
dc8c34
+		print "<font class=areatitle>Replica Root: </font>";
dc8c34
+		print "<font class=text28>$replicaroot</font>\n";
dc8c34
+		print "<font class=areatitle>Max CSN: </font>";
dc8c34
+		print "<font class=text28>$maxcsn</font>\n";
dc8c34
+	}
dc8c34
 	return $maxcsn;
dc8c34
 }
dc8c34
 
dc8c34
@@ -597,36 +686,44 @@ sub print_hub_header
dc8c34
 	my ($myruv) = $allruvs {"$ridx:$mid"};
dc8c34
 	my ($maxcsnval) = split ( /;/, "$myruv" );
dc8c34
 	my ($maxcsn) = &to_string_csn ($maxcsnval);
dc8c34
-	my ($sidx, $replicaroot, $replicatype, $serverid) = split (/:/, $allreplicas[$ridx]);
dc8c34
+	my ($sidx, $last_sidx, $replicaroot, $replicatype, $serverid) = split (/:/, $allreplicas[$ridx]);
dc8c34
 
dc8c34
 	# Print the master name
dc8c34
 	if ( $last_sidx != $sidx ) {
dc8c34
 		my ($ldapurl) = &get_ldap_url ($sidx, $sidx);
dc8c34
 		&print_legend if ( $last_sidx < 0);
dc8c34
-		print "


\n";

dc8c34
-		print "\n

<center class=page-subtitle><font color=#0099cc>\n";

dc8c34
-		print "Hub:&nbsp $ldapurl</center>\n";
dc8c34
+		if($opt_s){
dc8c34
+			print "Hub: $ldapurl\n";
dc8c34
+		} else {
dc8c34
+			print "


\n";

dc8c34
+			print "\n

<center class=page-subtitle><font color=#0099cc>\n";

dc8c34
+			print "Hub:&nbsp $ldapurl</center>\n";
dc8c34
+		}
dc8c34
 		$last_sidx = $sidx;
dc8c34
 	}
dc8c34
 
dc8c34
 	# Print the current replica info onthe master
dc8c34
-	print "\n

\n";
dc8c34
-
dc8c34
-	print "\n<center>\n";
dc8c34
-	print "<font class=areatitle>Replica ID: </font>";
dc8c34
-	print "<font class=text28>$serverid</font>\n";
dc8c34
-
dc8c34
-	print "<font class=areatitle>Replica Root: </font>";
dc8c34
-	print "<font class=text28>$replicaroot</font>\n";
dc8c34
-
dc8c34
-	print "<font class=areatitle>Max CSN: </font>";
dc8c34
-	print "<font class=text28>$maxcsn</font>\n";
dc8c34
-
dc8c34
+	if($opt_s){
dc8c34
+		print "Replica ID: $serverid\n";
dc8c34
+		print "Replica Root: $replicaroot\n";
dc8c34
+		print "Max CSN: $maxcsn\n";
dc8c34
+	} else {
dc8c34
+		print "\n

\n";
dc8c34
+		print "\n<center>\n";
dc8c34
+		print "<font class=areatitle>Replica ID: </font>";
dc8c34
+		print "<font class=text28>$serverid</font>\n";
dc8c34
+		print "<font class=areatitle>Replica Root: </font>";
dc8c34
+		print "<font class=text28>$replicaroot</font>\n";
dc8c34
+		print "<font class=areatitle>Max CSN: </font>";
dc8c34
+		print "<font class=text28>$maxcsn</font>\n";
dc8c34
+	}
dc8c34
 	return $maxcsn;
dc8c34
 }
dc8c34
 
dc8c34
 sub print_consumer_header
dc8c34
 {
dc8c34
+	if($opt_s) { return; } # we'll do the text printing in "print_consumers"
dc8c34
+	
dc8c34
 	#Print the header of consumer
dc8c34
 	print "\n\n";
dc8c34
 	print "Receiver\n";
dc8c34
@@ -648,15 +745,16 @@ sub print_consumers
dc8c34
 	my ($m_ridx, $mid) = @_;
dc8c34
 	my ($ignore, $m_replicaroot) = split (/:/, $allreplicas[$m_ridx]);
dc8c34
 	my (@consumers, @ouragreements, @myagreements);
dc8c34
-	my ($s_ridx, $c_ridx, $conntype, $schedule, $status);
dc8c34
-	my ($c_maxcsn_str, $lag, $markcolor);
dc8c34
+	my ($s_ridx, $c_ridx, $s_sidx, $conntype, $schedule, $status);
dc8c34
+	my ($c_maxcsn, $c_maxcsn_str, $c_lastmodified, $c_sidx, $lag, $markcolor);
dc8c34
 	my ($c_replicaroot, $c_replicatype);
dc8c34
-	my ($first_entry);
dc8c34
+	my ($first_entry, $s_ldapurl, $c_ldapurl);
dc8c34
 	my ($nrows);
dc8c34
 	my ($found);
dc8c34
 
dc8c34
 	undef @ouragreements;
dc8c34
-
dc8c34
+	$c_lastmodified = "";
dc8c34
+    
dc8c34
 	# Collect all the consumer replicas for the current master replica
dc8c34
 	push (@consumers, $m_ridx);
dc8c34
 	foreach (@consumers) {
dc8c34
@@ -688,7 +786,7 @@ sub print_consumers
dc8c34
 			$myruv = $allruvs {"$c_ridx:$mid"};
dc8c34
 			($c_maxcsn, $c_lastmodified) = split ( /;/, "$myruv" );
dc8c34
 			($c_maxcsn_str, $lag, $markcolor) = &cacl_time_lag ($m_maxcsn, $c_maxcsn);
dc8c34
-			$c_maxcsn_str =~ s/ /\<br\>/;
dc8c34
+			if(!$opt_s){ $c_maxcsn_str =~ s/ /\<br\>/; }
dc8c34
 			($c_sidx, $c_replicaroot, $c_replicatype) = split (/:/, $allreplicas[$c_ridx]);
dc8c34
 			$c_replicaroot = "same as master" if $m_replicaroot eq $c_replicaroot;
dc8c34
 		}
dc8c34
@@ -697,7 +795,7 @@ sub print_consumers
dc8c34
 			$c_sidx = -$c_ridx;
dc8c34
 			$c_maxcsn_str = "_";
dc8c34
 			$lag = "n/a";
dc8c34
-			$markcolor = red;
dc8c34
+			$markcolor = "red";
dc8c34
 			$c_replicaroot = "_";
dc8c34
 			$c_replicatype = "_";
dc8c34
 		}
dc8c34
@@ -719,16 +817,27 @@ sub print_consumers
dc8c34
 			$s_ldapurl = &get_ldap_url ($s_sidx, "n/a");
dc8c34
 
dc8c34
 			# Print out the consumer's replica and ruvs
dc8c34
-			print "\n\n";
dc8c34
+			if(!$opt_s){ print "\n\n"; }
dc8c34
 			if ($first_entry) {
dc8c34
 				$first_entry = 0;
dc8c34
 				$c_ldapurl = &get_ldap_url ($c_sidx, $conntype);
dc8c34
-				print "$c_ldapurl
Type: $c_replicatype\n";
dc8c34
-				print "<center>$lag</center>\n";
dc8c34
-				print "$c_maxcsn_str\n";
dc8c34
-				print "$c_lastmodified\n";
dc8c34
+				if($opt_s){
dc8c34
+					print "Receiver: $c_ldapurl\nType: $c_replicatype\n";
dc8c34
+					print "Time Lag: $lag\n";
dc8c34
+					print "Max CSN: $c_maxcsn_str\n";
dc8c34
+					print "Last Modify Time: $c_lastmodified\n";
dc8c34
+				} else {
dc8c34
+					print "$c_ldapurl
Type: $c_replicatype\n";
dc8c34
+					print "<center>$lag</center>\n";
dc8c34
+					print "$c_maxcsn_str\n";
dc8c34
+					print "$c_lastmodified\n";
dc8c34
+				}
dc8c34
+			}
dc8c34
+			if($opt_s){ 
dc8c34
+				print "Supplier: $s_ldapurl\n";
dc8c34
+			} else {
dc8c34
+				print "<center>$s_ldapurl</center>\n";
dc8c34
 			}
dc8c34
-			print "<center>$s_ldapurl</center>\n";
dc8c34
 			my $changecount = $_->{nsds5replicaChangesSentSinceStartup};
dc8c34
 			if ( $changecount =~ /^$mid:(\d+)\/(\d+) / || $changecount =~ / $mid:(\d+)\/(\d+) / ) {
dc8c34
 				$changecount = "$1 / $2";
dc8c34
@@ -739,7 +848,11 @@ sub print_consumers
dc8c34
 			else {
dc8c34
 				$changecount = "0 / 0";
dc8c34
 			}
dc8c34
-			print "$changecount\n";       
dc8c34
+			if($opt_s){
dc8c34
+				print "Sent/Skipped: $changecount\n";
dc8c34
+			} else {
dc8c34
+				print "$changecount\n";
dc8c34
+			}   
dc8c34
 			my $redfontstart = "";
dc8c34
 			my $redfontend = "";
dc8c34
 			if ($status =~ /error/i) {
dc8c34
@@ -753,22 +866,44 @@ sub print_consumers
dc8c34
 					$redfontend = "</font>";
dc8c34
 				}
dc8c34
 			}
dc8c34
-			print "$redfontstart$status$redfontend\n";
dc8c34
-			print "", &format_z_time($_->{nsds5replicaLastUpdateStart}), "\n";
dc8c34
-			print "", &format_z_time($_->{nsds5replicaLastUpdateEnd}), "\n";
dc8c34
+			if($opt_s){
dc8c34
+				print "Update Status: $status\n";
dc8c34
+				print "Update Started: ", &format_z_time($_->{nsds5replicaLastUpdateStart}), "\n";
dc8c34
+				print "Update Ended: ", &format_z_time($_->{nsds5replicaLastUpdateEnd}), "\n";			
dc8c34
+			} else {
dc8c34
+				print "$redfontstart$status$redfontend\n";
dc8c34
+				print "", &format_z_time($_->{nsds5replicaLastUpdateStart}), "\n";
dc8c34
+				print "", &format_z_time($_->{nsds5replicaLastUpdateEnd}), "\n";
dc8c34
+			}
dc8c34
 			if ( $schedule =~ /always/i ) {
dc8c34
-				print "$schedule\n";
dc8c34
+				if($opt_s){
dc8c34
+					print "Schedule: $schedule\n";
dc8c34
+				} else {
dc8c34
+					print "$schedule\n";
dc8c34
+				}
dc8c34
 			}
dc8c34
 			else {
dc8c34
 				my ($ndays, @days);
dc8c34
 				$schedule =~ /(\d\d)(\d\d)-(\d\d)(\d\d) (\d+)/;
dc8c34
-				print "$1:$2-$3:$4\n";
dc8c34
+				if($opt_s){
dc8c34
+				    print "Schedule: $1:$2-$3:$4 ";
dc8c34
+				} else {
dc8c34
+				    print "$1:$2-$3:$4\n";
dc8c34
+				}
dc8c34
 				$ndays = $5;
dc8c34
 				$ndays =~ s/(\d)/$1,/g;
dc8c34
-				@days = (Sun,Mon,Tue,Wed,Thu,Fri,Sat)[eval $ndays];
dc8c34
-				print "@days\n";
dc8c34
+				@days = ("Sun","Mon","Tue","Wed","Thu","Fri","Sat")[eval $ndays];
dc8c34
+				if($opt_s){
dc8c34
+				    print "@days\n";
dc8c34
+				} else {
dc8c34
+				    print "@days\n";
dc8c34
+				}
dc8c34
+			}
dc8c34
+			if($opt_s){
dc8c34
+				print "SSL: $conntype\n";
dc8c34
+			} else {
dc8c34
+				print "$conntype\n";
dc8c34
 			}
dc8c34
-			print "$conntype\n";
dc8c34
 		}
dc8c34
 	}
dc8c34
 }
dc8c34
@@ -778,7 +913,7 @@ sub cacl_time_lag
dc8c34
 	my ($s_maxcsn, $c_maxcsn) = @_;
dc8c34
 	my ($markcolor);
dc8c34
 	my ($csn_str);
dc8c34
-	my ($s_tm, $c_tm, $lag_tm, $lag_str, $hours, $minute);
dc8c34
+	my ($s_tm, $c_tm, $lag_tm, $lag_str, $hours, $minutes);
dc8c34
 
dc8c34
 	$csn_str = &to_string_csn ($c_maxcsn);
dc8c34
 
dc8c34
@@ -831,7 +966,7 @@ sub cacl_time_lag
dc8c34
 #
dc8c34
 sub add_server
dc8c34
 {
dc8c34
-	my ($host, $port, $binddn, $bindpwd, $bindcert) = split (/:/, "@_");
dc8c34
+	my ($host, $port, $binddn, $bindpwd, $bindcert) = split (/:/, "$_[0]");
dc8c34
 	my ($shadowport) = $port;
dc8c34
 	my ($domainpattern) = '\.[^:]+';
dc8c34
 	my ($i);
dc8c34
@@ -846,7 +981,7 @@ sub add_server
dc8c34
 	$hostnode = $1 if $host =~ /^(.+?)\./;
dc8c34
 
dc8c34
 	# new host:port
dc8c34
-	if ($binddn eq "" || $bindpwd eq "" && $bindcert eq "") {
dc8c34
+	if (!$binddn || $binddn eq "" || !$bindpwd || $bindpwd eq "" || !$bindcert || $bindcert eq "") {
dc8c34
 		#
dc8c34
 		# Look up connection parameter in the order of
dc8c34
 		#	host:port
dc8c34
@@ -855,17 +990,25 @@ sub add_server
dc8c34
 		#	*:*
dc8c34
 		#
dc8c34
 		my (@myconfig, $h, $p, $d, $w, $c);
dc8c34
-		(@myconfig = grep (/^$hostnode($domainpattern)*:$port\D/i, @allconnections)) ||
dc8c34
+		$h = ""; $p = ""; $d = ""; $w = ""; $c = "";
dc8c34
+		(@myconfig = grep (/^$hostnode($domainpattern)*:[0-9]+\D/i, @allconnections)) ||
dc8c34
 		(@myconfig = grep (/^$hostnode($domainpattern)*:\*:/i, @allconnections)) ||
dc8c34
 		(@myconfig = grep (/^\*:$port\D/, @allconnections)) ||
dc8c34
 		(@myconfig = grep (/^\*:\*\D/, @allconnections));
dc8c34
 		if ($#myconfig >= 0) {
dc8c34
 			($h, $p, $d, $w, $c) = split (/:/, $myconfig[0]);
dc8c34
 			($p, $shadowport) = split (/=/, $p);
dc8c34
-			$p = "" if $p eq "*";
dc8c34
-			$c = "" if $c eq "*";
dc8c34
+			if(!$p || $p eq "*"){
dc8c34
+				$p = "";
dc8c34
+			}
dc8c34
+			if(!$c || $c eq "*"){
dc8c34
+				$c = "";
dc8c34
+			}
dc8c34
+			if(!$w || $w eq "*"){
dc8c34
+                $w = "";
dc8c34
+            }
dc8c34
 		}
dc8c34
-		if ($binddn eq "" || $binddn eq "*") {
dc8c34
+		if (!$binddn || $binddn eq "" || $binddn eq "*") {
dc8c34
 			if ($d eq "" || $d eq "*") {
dc8c34
 				$binddn = "cn=Directory Manager";
dc8c34
 			}
dc8c34
@@ -873,8 +1016,14 @@ sub add_server
dc8c34
 				$binddn = $d;
dc8c34
 			}
dc8c34
 		}
dc8c34
-		$bindpwd = $w if ($bindpwd eq "" || $bindpwd eq "*");
dc8c34
-		$bindcert = $c if ($bindcert eq "" || $bindcert eq "*");
dc8c34
+		if($prompt eq "yes" && ($w eq "" || (!$bindpwd || $bindpwd eq ""))){
dc8c34
+            $bindpwd = passwdPrompt($h, $p);
dc8c34
+		} elsif ($passwd ne ""){
dc8c34
+            $bindpwd = $passwd;
dc8c34
+		} else {
dc8c34
+            $bindpwd = $w if (!$bindpwd || $bindpwd eq "" || $bindpwd eq "*");
dc8c34
+        }
dc8c34
+		$bindcert = $c if (!$bindcert || $bindcert eq "" || $bindcert eq "*");
dc8c34
 	}
dc8c34
 
dc8c34
 	if ($shadowport) {
dc8c34
@@ -885,6 +1034,43 @@ sub add_server
dc8c34
 	return $i;
dc8c34
 }
dc8c34
 
dc8c34
+sub
dc8c34
+passwdPrompt
dc8c34
+{
dc8c34
+    my ($h, $p) = @_;
dc8c34
+    my $key = "$h:$p";
dc8c34
+    my $pw = "";
dc8c34
+    
dc8c34
+    if ($passwords{$key}){
dc8c34
+        # we already have a password for this replica     
dc8c34
+        return $passwords{$key};
dc8c34
+    }
dc8c34
+    # Disable console echo
dc8c34
+    system("@sttyexec@ -echo") if -t STDIN;
dc8c34
+
dc8c34
+    while ($pw eq ""){
dc8c34
+        if($passwd ne ""){
dc8c34
+            print "Enter password for ($h:$p) <hit Enter to use previous password>: ";
dc8c34
+            chomp($pw = <>);
dc8c34
+            if ($pw eq ""){
dc8c34
+                $pw = $passwd;
dc8c34
+            } else {
dc8c34
+                $passwords{$key} = $pw;
dc8c34
+                $passwd = $pw;         
dc8c34
+            }
dc8c34
+        } else {
dc8c34
+            print "Enter password for ($h:$p): ";
dc8c34
+            chomp($pw = <>);
dc8c34
+            $passwords{$key} = $pw;
dc8c34
+            $passwd = $pw;
dc8c34
+        }
dc8c34
+    }
dc8c34
+    # Enable console echo
dc8c34
+    system("@sttyexec@ echo") if -t STDIN;
dc8c34
+
dc8c34
+    return $pw;
dc8c34
+}
dc8c34
+
dc8c34
 sub get_ldap_url
dc8c34
 {
dc8c34
 	my ($sidx, $conntype) = @_;
dc8c34
@@ -893,19 +1079,22 @@ sub get_ldap_url
dc8c34
 	($port, $shadowport) = split (/=/, $port);
dc8c34
 	my ($protocol, $ldapurl);
dc8c34
 
dc8c34
-	if ($port eq 636 && $conntype eq "0" || $conntype =~ /SSL/i) {
dc8c34
-		$protocol = ldaps;
dc8c34
+	if ($port == 636 && $conntype eq "0" || $conntype =~ /SSL/i) {
dc8c34
+		$protocol = "ldaps";
dc8c34
 	}
dc8c34
 	else {
dc8c34
-		$protocol = ldap;
dc8c34
+		$protocol = "ldap";
dc8c34
 	}
dc8c34
 	my ($instance) = $allaliases { "$host:$port" };
dc8c34
 	$instance = "$host:$port" if !$instance;
dc8c34
 	if ($conntype eq "n/a") {
dc8c34
 		$ldapurl = $instance;
dc8c34
-	}
dc8c34
-	else {
dc8c34
-		$ldapurl = "$instance";
dc8c34
+	} else {
dc8c34
+		if($opt_s){
dc8c34
+			$ldapurl = "$instance $protocol://$host:$port/";
dc8c34
+		} else {
dc8c34
+			$ldapurl = "$instance";
dc8c34
+		}
dc8c34
 	}
dc8c34
 	return $ldapurl;
dc8c34
 }
dc8c34
@@ -950,7 +1139,8 @@ sub get_color
dc8c34
 	my ($lag_minute) = @_;
dc8c34
 	$lag_minute /= 60;
dc8c34
 	my ($color) = $allcolors { $colorkeys[0] };
dc8c34
-	foreach (@colorkeys) {
dc8c34
+	
dc8c34
+	foreach ( keys %allcolors) {
dc8c34
 		last if ($lag_minute < $_);
dc8c34
 		$color = $allcolors {$_};
dc8c34
 	}
dc8c34
@@ -969,53 +1159,63 @@ sub unescape
dc8c34
 
dc8c34
 sub print_html_header
dc8c34
 {
dc8c34
-	# print the HTML header
dc8c34
-
dc8c34
-	print "Content-type: text/html\n\n";
dc8c34
-	print "<html>\n";
dc8c34
-	print "<head><title>Replication Status</title>\n";
dc8c34
-	# print "<link type=text/css rel=stylesheet href=\"master-style.css\">\n";
dc8c34
-	print "<style text/css>\n";
dc8c34
-	print "Body, p, table, td, ul, li {color: #000000; font-family: Arial, Helvetica, sans-serif; font-size: 12px;}\n";
dc8c34
-	print "A {color:blue; text-decoration: none;}\n";
dc8c34
-	print "BODY {font-family: arial, helvetica, sans-serif}\n";
dc8c34
-	print "P {font-family: arial, helvetica, sans-serif}\n";
dc8c34
-	print "TH {font-weight: bold; font-family: arial, helvetica, sans-serif}\n";
dc8c34
-	print "TD {font-family: arial, helvetica, sans-serif}\n";
dc8c34
-	print ".bgColor1  {background-color: #003366;}\n";
dc8c34
-	print ".bgColor4  {background-color: #cccccc;}\n";
dc8c34
-	print ".bgColor5  {background-color: #999999;}\n";
dc8c34
-	print ".bgColor9  {background-color: #336699;}\n";
dc8c34
-	print ".bgColor13 {background-color: #ffffff;}\n";
dc8c34
-	print ".bgColor16 {background-color: #6699cc;}\n";
dc8c34
-	print ".text8  {color: #0099cc; font-size: 11px; font-weight: bold;}\n";
dc8c34
-	print ".text28 {color: #ffcc33; font-size: 12px; font-weight: bold;}\n";
dc8c34
-	print ".areatitle {font-weight: bold; color: #ffffff; font-family: arial, helvetica, sans-serif}\n";
dc8c34
-	print ".page-title {font-weight: bold; font-size: larger; font-family: arial, helvetica, sans-serif}\n";
dc8c34
-	print ".page-subtitle {font-weight: bold; font-family: arial, helvetica, sans-serif}\n";
dc8c34
-
dc8c34
-	print "</style></head>\n<body class=bgColor4>\n";
dc8c34
-
dc8c34
-	if ($opt_u) {
dc8c34
-		print "<meta http-equiv=refresh content=$interval; URL=$opt_u>\n";
dc8c34
-	}
dc8c34
-
dc8c34
-	print "\n";
dc8c34
-	print "<font class=text8>$now</font>\n";
dc8c34
-	print "<font color=#0099CC>";
dc8c34
-	print "Directory Server Replication Status</font>\n";
dc8c34
-
dc8c34
-	if ($opt_u) {
dc8c34
-		print "
<font class=text8>(This page updates every $interval seconds)</font>\n";
dc8c34
-	}
dc8c34
-
dc8c34
-	print "<font class=text8>$version";
dc8c34
-	print "</font>\n";
dc8c34
+    if(!$opt_s){
dc8c34
+    	# print the HTML header
dc8c34
+    
dc8c34
+    	print "<html>\n";
dc8c34
+    	print "<meta http-equiv=\"Content-Type\" content=\"text/html;charset=UTF-8\">\n";
dc8c34
+    	print "<head><title>Replication Status</title>\n";
dc8c34
+    	# print "<link type=text/css rel=stylesheet href=\"master-style.css\">\n";
dc8c34
+    	print "<style text/css>\n";
dc8c34
+    	print "Body, p, table, td, ul, li {color: #000000; font-family: Arial, Helvetica, sans-serif; font-size: 12px;}\n";
dc8c34
+    	print "A {color:blue; text-decoration: none;}\n";
dc8c34
+    	print "BODY {font-family: arial, helvetica, sans-serif}\n";
dc8c34
+    	print "P {font-family: arial, helvetica, sans-serif}\n";
dc8c34
+    	print "TH {font-weight: bold; font-family: arial, helvetica, sans-serif}\n";
dc8c34
+    	print "TD {font-family: arial, helvetica, sans-serif}\n";
dc8c34
+    	print ".bgColor1  {background-color: #003366;}\n";
dc8c34
+    	print ".bgColor4  {background-color: #cccccc;}\n";
dc8c34
+    	print ".bgColor5  {background-color: #999999;}\n";
dc8c34
+    	print ".bgColor9  {background-color: #336699;}\n";
dc8c34
+    	print ".bgColor13 {background-color: #ffffff;}\n";
dc8c34
+    	print ".bgColor16 {background-color: #6699cc;}\n";
dc8c34
+    	print ".text8  {color: #0099cc; font-size: 11px; font-weight: bold;}\n";
dc8c34
+    	print ".text28 {color: #ffcc33; font-size: 12px; font-weight: bold;}\n";
dc8c34
+    	print ".areatitle {font-weight: bold; color: #ffffff; font-family: arial, helvetica, sans-serif}\n";
dc8c34
+    	print ".page-title {font-weight: bold; font-size: larger; font-family: arial, helvetica, sans-serif}\n";
dc8c34
+    	print ".page-subtitle {font-weight: bold; font-family: arial, helvetica, sans-serif}\n";
dc8c34
+    	print "</style></head>\n<body class=bgColor4>\n";
dc8c34
+    
dc8c34
+    	if ($opt_u) {
dc8c34
+    		print "<meta http-equiv=refresh content=$interval; URL=$opt_u>\n";
dc8c34
+    	}
dc8c34
+    
dc8c34
+    	print "\n";
dc8c34
+    	print "<font class=text8>$now</font>\n";
dc8c34
+    	print "<font color=#0099CC>";
dc8c34
+    	print "Directory Server Replication Status</font>\n";
dc8c34
+    
dc8c34
+    	if ($opt_u) {
dc8c34
+    		print "
<font class=text8>(This page updates every $interval seconds)</font>\n";
dc8c34
+    	}
dc8c34
+    
dc8c34
+    	print "<font class=text8>$version";
dc8c34
+    	print "</font>\n";
dc8c34
+    } else {
dc8c34
+        print "Directory Server Replication Status ($version)\n\n";
dc8c34
+        print "Time: $now";
dc8c34
+        if ($opt_u) {
dc8c34
+		print " - This report updates every $interval seconds\n\n";
dc8c34
+        } else {
dc8c34
+		print "\n\n";
dc8c34
+        }
dc8c34
+    }
dc8c34
 }
dc8c34
 
dc8c34
 sub print_legend
dc8c34
 {
dc8c34
 	my ($nlegends) = $#colorkeys + 1;
dc8c34
+	if($opt_s){ return; }
dc8c34
 	print "\n<center>

<font class=page-subtitle color=#0099cc>Time Lag Legend:</font>

\n";

dc8c34
 	print "\n\n";
dc8c34
 	my ($i, $j);
dc8c34
@@ -1031,7 +1231,7 @@ sub print_legend
dc8c34
 
dc8c34
 sub print_supplier_end
dc8c34
 {
dc8c34
-	print "\n";
dc8c34
+	if(!$opt_s){ print "\n"; }
dc8c34
 }
dc8c34
 
dc8c34
 # given a string in generalized time format, convert to ascii time
dc8c34
diff --git a/man/man1/repl-monitor.1 b/man/man1/repl-monitor.1
dc8c34
index 424550e..bd0ede1 100644
dc8c34
--- a/man/man1/repl-monitor.1
dc8c34
+++ b/man/man1/repl-monitor.1
dc8c34
@@ -19,8 +19,9 @@
dc8c34
 repl-monitor \- Directory Server replication monitor
dc8c34
 .SH SYNOPSIS
dc8c34
 .B repl\(hymonitor
dc8c34
-\-f configuration\(hyfile [\fI\(hyh host\fR] [\fI\-p port\fR] [\fI\-r\fR] 
dc8c34
-[\fI\-u refresh\(hyurl\fR] [\fI\-t refresh\(hyinterval\fR] [\fI\-v\fR]
dc8c34
+\ [-f configuration\(hyfile] [\fI\(hyh host\fR] [\fI\-p port\fR] [\fI\-r\fR]
dc8c34
+[\fI\-c connection\fR] [\fI\-a alias\fR] [\fI\-k color\fR] [\fI\-u refresh\(hyurl\fR]
dc8c34
+[\fI\-s\fR] [\fI\-t refresh\(hyinterval\fR] [\fI\-v\fR]
dc8c34
 
dc8c34
 .SH DESCRIPTION
dc8c34
 Outputs the status of all of the configured Directory Servers
dc8c34
@@ -33,23 +34,39 @@ are specified in the configuration file.
dc8c34
 .SH OPTIONS
dc8c34
 A summary of options is included below:
dc8c34
 .TP
dc8c34
-.B \-h host
dc8c34
+.B \-h, \-\-host\fR host
dc8c34
 Hostname of DS server
dc8c34
 .TP
dc8c34
-.B \-p port
dc8c34
+.B \-p, \-\-port\fR port
dc8c34
 TCP port
dc8c34
 .TP
dc8c34
-.B \-f configuration\(hyfile
dc8c34
+.B \-f, \-\-configfile\fR configuration-file
dc8c34
 Configuration file 
dc8c34
 .TP
dc8c34
-.B \-r
dc8c34
+.B \-c, \-\-conn\fR connection
dc8c34
+Uses the same format as the configfile directive
dc8c34
+.TP
dc8c34
+.B \-a, \-\-alias\fR alias
dc8c34
+Uses the same format as the configfile directive
dc8c34
+.TP
dc8c34
+.B \-k, --color\fR color
dc8c34
+Uses the same format as the configfile directive
dc8c34
+.TP
dc8c34
+.B \-r, --skip-header\fR
dc8c34
 Removes extra HTML tags
dc8c34
 .TP
dc8c34
-.B \-u refresh\(hyurl
dc8c34
+.B \-u, \-\-refreshurl\fR refresh url
dc8c34
 Refresh url
dc8c34
 .TP
dc8c34
-.B \-t refresh\(hyinterval
dc8c34
+.B \-t, \-\-interval\fR refresh interval
dc8c34
 Refresh interval
dc8c34
+.TP
dc8c34
+.B \-W, \-\-prompt
dc8c34
+Prompt for passwords
dc8c34
+.TP
dc8c34
+.B \-s, \-\-text
dc8c34
+Print plain text report
dc8c34
+
dc8c34
 .br
dc8c34
 .SH AUTHOR
dc8c34
 repl-monitor was written by the 389 Project.
dc8c34
@@ -63,6 +80,8 @@ Copyright \(co 2008 Red Hat, Inc.
dc8c34
 This manual page was written by Michele Baldessari <michele@pupazzo.org>,
dc8c34
 for the Debian project (but may be used by others).
dc8c34
 .br
dc8c34
+Manual page updated by Mark Reynolds <mreynolds@redhat.com> 10/11/13
dc8c34
+.br
dc8c34
 This is free software.  You may redistribute copies of it under the terms of
dc8c34
 the Directory Server license found in the LICENSE file of this
dc8c34
 software distribution.  This license is essentially the GNU General Public
dc8c34
-- 
dc8c34
1.8.1.4
dc8c34