Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

check_ad_replication.py

Current Version
v1.0
Last Release Date
2015-11-24
Owner
License
GPL
Hits
6031
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
This is a Nagios plugin for checking the normal operation of a Samba-based Active Directory server (Domain Controller).

As of Samba 4.x, Samba is capable of running as an Active Directory server (ie. Domain Controller).

This plugin runs the command 'samba-tool drs showrepl' and summarises the results, to indicate which other servers in the cluster are currently unable to replicate with this server.
check_ad_replication.py
=======================

This is a Nagios plugin for checking the normal operation of a Samba-based Active Directory server (Domain Controller).

As of Samba 4.x, Samba is capable of running as an Active Directory server (ie. Domain Controller).

AD Domain Controllers are normally 'clustered' for redundancy (high availability).
When clustered, they 'replicate' their date between each other.
AD clusters do not have a 'master'. Replication is peer-to-peer.

This plugin runs the command `samba-tool drs showrepl` and summarises the results, to indicate which other servers in the cluster are currently unable to replicate with this server.

### Prerequisites

* If you using Linux or Unix to run Samba as an Active Directory Domain Controller (either as the primary or secondary Domain Controller)

Then this plugin is for you

This plugin is written in Python and requires the package `python-dateutil` in addition to the standard python packages.

### What it does

The plugin check_ad_replication.py runs the commands:

* net ads info
* samba-tool drs showrepl

It analyses the output of these commands, and provides a one-line summary of:

* which of this server's peers are currently failing
* the length of time each of the peers has been having problems

If everything is OK, it shows the elapsed time of the most recent replication for each of the peers.

#### Sample Output - OK

**`/usr/lib/nagios/plugins/check_ad_replication.py`**

`OK: Realm: cas.example.net.au OK: my-dc1 as of 3 mins, my-dc3 as of 3 mins, my-dc4 as of 3 mins, my-win-ad1 as of 3 mins|ok=4 fail=0`

#### Sample Output - Errors

**`/usr/lib/nagios/plugins/check_ad_replication.py`**

`CRITICAL: Realm: cas.example.net.au Failing: my-dc1 since 5 mins(!!), Still OK: my-dc3 as of 5 mins, my-dc4 as of 5 mins, my-win-ad1 as of 5 mins|ok=3, fail=1`

`CRITICAL: Realm: cas.example.net.au Failing: my-dc2 since 11 mins, my-dc3 since 11 mins, my-dc4 since 11 mins(!!), Still OK: my-win-ad1 as of 11 mins|ok=1, fail=3`

### Performance Data

This plugin generates some summary information as Nagios performance data. This can be graphed using PNP4Nagios.

Graphs are generated for:

* the number of AD peers which are failing to replicate to this server
-- and --
* the number of AD peers which are working (OK).

A PNP4Nagios template is provided. This template requires the stack_outline.php file to be present in the same directory as the template file check_ad_replication.php
stack_outline.php is available from:

* https://github.com/infoxchange/opstools/blob/master/nagios/pnp4nagios-templates/stack_outline.php
Reviews (2)
byantisa, October 27, 2019
Thanks for your effort!
This plugin uses check_output, so it requires Python 2.7 to work as is. This is a problem if you have older OS versions running. I can't comment on the script itself because it won't run on our environment right now.