Ignore:
Timestamp:
Oct 24, 2009, 12:45:00 PM (13 years ago)
Author:
mitchb
Message:
Improvements to check_ldap_mmr plugin
  o Don't put a newline after each replica's output; the Nagios status
    page only captures the first line, so run them all together on one
    line.
  o Don't return immediately upon finding an error; continue to check
    the other replicas and print status info about them.
  o If any replicas have issues, upgrade the return from "ERROR" (which
    is "UNKNOWN" and doesn't cause an alert) to "WARNING" (a replication
    failure is usually not a problem on the server running the plugin, so
    it's probably not a CRITICAL issue for that machine).
File:
1 edited

Legend:

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

    r1272 r1342  
    2222my $result=LDAPSearch($ldap,"objectClass=nsDS5ReplicationAgreement","",$base);
    2323my @entries = $result->entries;
     24my $errors = 0;
     25my $errorstring = "Replication error(s): ";
    2426foreach my $entr ( @entries ) {
    2527    my $servername=$entr->get_value($server);
     
    3234    $serverlastend =~ s/(....)(..)(..)(..)(..)(..)./$1-$2-$3\ $4:$5:$6/;
    3335    print "Replication to $servername last operation $serverlaststart ";
    34     print "Status: $serverstatus.\n";
     36    print "Status: $serverstatus.     ";
    3537    if ($statuscode) {
    36         &nagios_return("ERROR", "Replication error: " . $serverstatus);
     38        $errors++;
     39        $errorstring = $errorstring . $serverstatus . ", ";
    3740    }
    3841}
    39 &nagios_return("OK", "All replicas are OK");
     42if ($errors > 0) {
     43    &nagios_return("WARNING", $errorstring);
     44} else {
     45    &nagios_return("OK", "All replicas are OK");
     46}
    4047
    4148sub ConnectLdap {
Note: See TracChangeset for help on using the changeset viewer.