All this code is EXACTLY what I was looking for. I took this code and built it to work with nagios. It works great.
#!/usr/bin/perl use strict; # Edward Capriolo 2007 # Based on code by # Ivan Ferreira - Enero 2007 #usage perl check_ldap_replication ldapsomething.something.com "cn=Directory Manager" "mypassword" "cn=replica,cn=o=something.com,cn=mapping tree,cn=config"
#define command { # command_name check_ldap_replication # command_line $USER1$/check_ldap_replication $HOSTADDRESS$ "$ARG1$" "$ARG2$" "$ARG3$" #}
my $host=$ARGV[0]; #ldapsomething.something.com my $cn=$ARGV[1]; #cn=Directory Manager my $pass=$ARGV[2]; #mypassword my $base=$ARGV[3]; "cn=replica,cn=o=something.com,cn=mapping tree,cn=config"
my $r_cmd="/usr/bin/ldapsearch -h $host -x -D "$cn" -b "$base" -w $pass objectClass=nsDS5ReplicationAgreement nsds5replicaLastUpdateStatus nsds5replicaLastUpdateStart"; #print "$r_cmd\n"; my @list = split ( /\n/, `$r_cmd` );
my $res=-1; my $line="";
for (my $j=0;$j<@list;$j++){ # print "$list[$j]\n"; if ($list[$j] =~ /^nsds5replicaLastUpdateStatus/){ # print $list[$j]; $line=$list[$j]; my @tok = split ( /\s/, $list[$j] ); $res=$tok[1]; } }
if ($res == 0 ){ print ("Replication OK: $line\n"); exit 0; }
if ($res != 0 ) { print ("Replication FAILED: $line\n"); exit 2; }
On 9/27/07, Ian Meyer ianmmeyer@gmail.com wrote:
Thank you Richard and Ivan.. your replies are very helpful. :)
- Ian
On 9/27/07, Richard Megginson rmeggins@redhat.com wrote:
Ian Meyer wrote:
Hello,
We have a decent sized env. (1 master, 16 slaves in different datacenters across the world) and we're trying to find a way to effectively monitor the status of replication. When was the last update? How many changes were made? How long did it take from start to finish? I know you can get most of this information from the gui, but we need to tie it in to our monitoring application. Is this information stored in a db anywhere? In ldap itself? Any insight would be appreciated.
http://www.redhat.com/docs/manuals/dir-server/ag/7.1/replicat.html#1106144
Thanks in advance!
- Ian
-- Fedora-directory-users mailing list Fedora-directory-users@redhat.com https://www.redhat.com/mailman/listinfo/fedora-directory-users
-- Fedora-directory-users mailing list Fedora-directory-users@redhat.com https://www.redhat.com/mailman/listinfo/fedora-directory-users
-- Fedora-directory-users mailing list Fedora-directory-users@redhat.com https://www.redhat.com/mailman/listinfo/fedora-directory-users