Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
check_ad_replication.py
v1.0
2015-11-24
GPL
10099
Meet The New Nagios Core Services Platform
Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.
Monitoring Made Magically Better
- Nagios Core on Overdrive
- Powerful Monitoring Dashboards
- Time-Saving Configuration Wizards
- Open Source Powered Monitoring On Steroids
- And So Much More!
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
=======================
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!
bythomasmaerz, June 10, 2016
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.