Changeset 1579


Ignore:
Timestamp:
Jun 24, 2010, 1:21:33 AM (14 years ago)
Author:
mitchb
Message:
Augment LDAP-MMR NRPE plugin to check for replication conflicts

Trac: #147
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/server/fedora/config/etc/nagios/check_ldap_mmr.real

    r1342 r1579  
    1313my $user = 'cn=Directory Manager';
    1414my $passwdfile = '/etc/signup-ldap-pw';
    15 my $base = "cn=config";
     15my $configBase = "cn=config";
     16my $replicatedBase = "dc=scripts,dc=mit,dc=edu";
    1617my $server="nsDS5ReplicaHost";
    1718my $status="nsds5replicaLastUpdateStatus";
     
    2021 
    2122my $ldap=ConnectLdap();
    22 my $result=LDAPSearch($ldap,"objectClass=nsDS5ReplicationAgreement","",$base);
     23my $result=LDAPSearch($ldap,"objectClass=nsDS5ReplicationAgreement","",$configBase);
    2324my @entries = $result->entries;
    24 my $errors = 0;
     25my $replicaErrors = 0;
     26my $conflictErrors = 0;
    2527my $errorstring = "Replication error(s): ";
    2628foreach my $entr ( @entries ) {
     
    3638    print "Status: $serverstatus.     ";
    3739    if ($statuscode) {
    38         $errors++;
     40        $replicaErrors++;
    3941        $errorstring = $errorstring . $serverstatus . ", ";
    4042    }
    4143}
    42 if ($errors > 0) {
     44
     45$result=LDAPSearch($ldap,"nsds5ReplConflict=*",["nsds5ReplConflict"],$replicatedBase);
     46@entries = $result->entries;
     47foreach my $entr ( @entries ) {
     48    my $conflictingDN=$entr->dn();
     49    my $conflictDesc=$entr->get_value("nsds5ReplConflict");
     50    print "Conflict found for DN $conflictingDN ";
     51    print "Reason: $conflictDesc.     ";
     52    $conflictErrors++;
     53    $errorstring = $errorstring . $conflictDesc . ", ";
     54}
     55
     56if ($conflictErrors > 0) {
     57    &nagios_return("CRITICAL", $errorstring);
     58} elsif ($replicaErrors > 0) {
    4359    &nagios_return("WARNING", $errorstring);
    4460} else {
    45     &nagios_return("OK", "All replicas are OK");
     61    &nagios_return("OK", "All replicas are OK and no conflicts are present");
    4662}
    4763
Note: See TracChangeset for help on using the changeset viewer.