Tuesday, June 28, 2016

[389-commits] Branch '389-ds-base-1.3.3' - ldap/admin man/man1

ldap/admin/src/scripts/repl-monitor.pl.in | 52 ++++++++++++++++----------
man/man1/repl-monitor.1 | 58 +++++++++++++++++++++++++++---
2 files changed, 86 insertions(+), 24 deletions(-)

New commits:
commit ad8ba5186bd9892917734c99fe8b793dd96548b5
Author: Mark Reynolds <mreynolds@redhat.com>
Date: Tue Jun 28 15:41:42 2016 -0400

Ticket 47538 - Fix repl-monitor color and lag times

Bug Description: Colors do not match the legend, and when the supplier or
consumer max csns are not available, the lag time is displayed
incorrectly.

Fix Description: The color hash table needed to be sorted before processing,
and we were not properly detecting the "Unavailable" state of
a replica which lead to the odd lag times. Also added the
string "Unavailable" for uninitialized values which allowed
for a cleaner report when replicas are offline.

Updated the man page as well.

https://fedorahosted.org/389/ticket/47538

Reviewed by: nhosoi(Thanks!)

(cherry picked from commit 34c929353280b93eebe214f1c21f5b788aff1c39)

diff --git a/ldap/admin/src/scripts/repl-monitor.pl.in b/ldap/admin/src/scripts/repl-monitor.pl.in
index 5354a8b..f30967d 100755
--- a/ldap/admin/src/scripts/repl-monitor.pl.in
+++ b/ldap/admin/src/scripts/repl-monitor.pl.in
@@ -626,7 +626,7 @@ sub process_suppliers
# Skip replicas without agreements defined yet
next if (! grep {$_->{ridx} == $ridx} @allagreements);
$maxcsn = &print_master_header ($ridx, $mid);
- if ( "$maxcsn" ne "none" ) {
+ if ( "$maxcsn" ne "Unavailable" ) {
&print_consumer_header ();
&print_consumers ($ridx, $mid);
}
@@ -784,12 +784,12 @@ sub print_consumers
my ($c_maxcsn, $c_maxcsn_str, $c_lastmodified, $c_sidx, $lag, $markcolor);
my ($c_replicaroot, $c_replicatype);
my ($first_entry, $s_ldapurl, $c_ldapurl);
- my $supplier_maxcsn = "_";
+ my $supplier_maxcsn = "Unavailable";
my ($nrows);
my ($found);

undef @ouragreements;
- $c_lastmodified = "";
+ $c_lastmodified = "Unavailable";

# Collect all the consumer replicas for the current master replica
push (@consumers, $m_ridx);
@@ -820,18 +820,20 @@ sub print_consumers

if ($c_ridx >= 0) {
$myruv = $allruvs {"$c_ridx:$mid"};
- ($c_maxcsn, $c_lastmodified) = split ( /;/, $myruv );
- ($c_sidx, $c_replicaroot, $c_replicatype) = split (/:/, $allreplicas[$c_ridx]);
- $c_replicaroot = "same as master" if $m_replicaroot eq $c_replicaroot;
+ if ($myruv) {
+ ($c_maxcsn, $c_lastmodified) = split ( /;/, $myruv );
+ ($c_sidx, $c_replicaroot, $c_replicatype) = split (/:/, $allreplicas[$c_ridx]);
+ $c_replicaroot = "same as master" if $m_replicaroot eq $c_replicaroot;
+ }
}
else {
# $c_ridx is actually -$c_sidx when c is not available
$c_sidx = -$c_ridx;
- $c_maxcsn_str = "_";
+ $c_maxcsn_str = "Unavailable";
$lag = "n/a";
$markcolor = "red";
- $c_replicaroot = "_";
- $c_replicatype = "_";
+ $c_replicaroot = "Unavailable";
+ $c_replicatype = "Unavailable";
}

$nrows = 0;
@@ -962,7 +964,7 @@ sub get_supplier_maxcsn
{
my ($ridx, $s, $cn, $h, $p) = @_;
my $decimalcsn;
- my $csn = "";
+ my $csn = "Unavailable";
# normalize suffix
$s =~ s/ //;
$s =~ lc $s;
@@ -974,7 +976,7 @@ sub get_supplier_maxcsn
last;
}
}
- if($csn ne ""){
+ if($csn && $csn ne "Unavailable"){
$decimalcsn = &to_decimal_csn ($csn);
return "$csn:$decimalcsn";
}
@@ -996,11 +998,16 @@ sub cacl_time_lag
$supplier_csn_str = &to_string_csn ($s_maxcsn);
$csn_str = &to_string_csn ($c_maxcsn);

- if ($s_maxcsn && !$c_maxcsn) {
+ if ((!$s_maxcsn || $s_maxcsn eq "Unavailable") &&
+ (!$c_maxcsn || $c_maxcsn eq "Unavailable")) {
+ $lag_str = "?:??:??";
+ $markcolor = "white"; # Both unknown
+ }
+ elsif ($s_maxcsn && (!$c_maxcsn || $c_maxcsn eq "Unavailable")) {
$lag_str = "- ?:??:??";
$markcolor = &get_color (36000); # assume consumer has big latency
}
- elsif (!$s_maxcsn && $c_maxcsn) {
+ elsif ((!$s_maxcsn || $s_maxcsn eq "Unavailable") && $c_maxcsn) {
$lag_str = "+ ?:??:??";
$markcolor = &get_color (1); # consumer is ahead of supplier
}
@@ -1210,7 +1217,7 @@ sub to_decimal_csn
{
my ($maxcsn) = @_;
if (!$maxcsn || $maxcsn eq "" || $maxcsn eq "Unavailable") {
- return "none";
+ return "Unavailable";
}

my ($tm, $seq, $masterid, $subseq) = unpack("a8 a4 a4 a4", $maxcsn);
@@ -1225,9 +1232,13 @@ sub to_decimal_csn

sub to_string_csn
{
- my ($rawcsn, $decimalcsn) = split(/:/, "@_");
+ my $str = shift;
+ if (!defined($str)){
+ return "Unavailable";
+ }
+ my ($rawcsn, $decimalcsn) = split(/:/, "$str");
if (!$rawcsn || $rawcsn eq "") {
- return "none";
+ return "Unavailable";
}
if ($rawcsn eq "Unavailable"){
return $rawcsn;
@@ -1251,7 +1262,7 @@ sub get_color
$lag_minute /= 60;
my ($color) = $allcolors { $colorkeys[0] };

- foreach ( keys %allcolors) {
+ foreach ( sort keys %allcolors) {
if ($lag_minute >= $_){
$color = $allcolors {$_};
}
@@ -1330,14 +1341,15 @@ sub print_legend
if($opt_s){ return; }
print "\n<center><p><font class=page-subtitle color=#0099cc>Time Lag Legend:</font><p>\n";
print "<table cellpadding=6 cols=$nlegends width=40%>\n<tr>\n";
+ print "\n<td bgcolor=white><center>Unknown</center></td>\n";
my ($i, $j);
for ($i = 0; $i < $nlegends - 1; $i++) {
$j = $colorkeys[$i];
- print "\n<td bgcolor=$allcolors{$j}><center>within $colorkeys[$i+1] min</center></td>\n";
+ print "\n<td bgcolor=$allcolors{$j}><center>Within $colorkeys[$i+1] minutes</center></td>\n";
}
$j = $colorkeys[$i];
- print "\n<td bgcolor=$allcolors{$j}><center>over $colorkeys[$i] min</center></td>\n";
- print "\n<td bgcolor=red><center>server n/a</center></td>\n";
+ print "\n<td bgcolor=$allcolors{$j}><center>Over $colorkeys[$i] minutes</center></td>\n";
+ print "\n<td bgcolor=red><center>Server n/a</center></td>\n";
print "</table></center>\n";
}

diff --git a/man/man1/repl-monitor.1 b/man/man1/repl-monitor.1
index 37a5fa4..17b9c4b 100644
--- a/man/man1/repl-monitor.1
+++ b/man/man1/repl-monitor.1
@@ -2,7 +2,7 @@
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
-.TH REPL-MONITOR 1 "May 18, 2008"
+.TH REPL-MONITOR 1 "Jun 28, 2016"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
@@ -68,6 +68,56 @@ Prompt for passwords
Print plain text report

.br
+.SH CONFIGURATION FILE
+This section describes the various directives that can be used in the configuration file.
+.TP
+.B [connection]
+The connection details about a replica
+.br
+
+host:port:binddn:bindpwd:cert_file
+.br
+
+or,
+.br
+
+host:port=shadowport:binddn:bindpwd:cert_file
+.TP
+.B [alias]
+Define an alias for a server, this alias is used in the report in place of the
+hostname/port
+
+.br
+alias = host:port
+.TP
+.B [color]
+Set a color based on the replicaton lag time lowmark (in minutes)
+.br
+
+.R lowmark = color
+.SH EXAMPLE
+Example of a configuration file:
+
+[connection]
+.br
+localhost.localdomain:3891:cn=directory manager:password:*
+.br
+localhost2.localdomain:3892:cn=directory manager:password:*
+
+[alias]
+.br
+MY_SYSTEM1 = localhost.localdomain:3891
+.br
+MY_SYSTEM2 = localhost2.localdomain:3892
+
+[color]
+.br
+0 = #CCFFCC
+.br
+5 = #FFFFCC
+.br
+60 = #FFCCCC
+
.SH AUTHOR
repl-monitor was written by the 389 Project.
.SH "REPORTING BUGS"
@@ -75,14 +125,14 @@ Report bugs to https://fedorahosted.org/389/newticket.
.SH COPYRIGHT
Copyright \(co 2001 Sun Microsystems, Inc. Used by permission.
.br
-Copyright \(co 2008 Red Hat, Inc.
+Copyright \(co 2016 Red Hat, Inc.
.br
This manual page was written by Michele Baldessari <michele@pupazzo.org>,
for the Debian project (but may be used by others).
.br
-Manual page updated by Mark Reynolds <mreynolds@redhat.com> 10/11/13
+Manual page updated by Mark Reynolds <mreynolds@redhat.com> 6/28/2016
.br
This is free software. You may redistribute copies of it under the terms of
the Directory Server license found in the LICENSE file of this
software distribution. This license is essentially the GNU General Public
-License version 2 with an exception for plug\(hyin distribution.
+License version 3 with an exception for plug\(hyin distribution.

--
389-commits mailing list
389-commits@lists.fedoraproject.org
https://lists.fedoraproject.org/admin/lists/389-commits@lists.fedoraproject.org

No comments:

Post a Comment