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

Directory Tree

check_domain.php

Current Version
1.1.0
Last Release Date
2014-07-01
Compatible With
  • Nagios 1.x
  • Nagios 2.x
  • Nagios 3.x
  • Nagios 4.x
  • Nagios XI
  • Nagios Fusion
License
GPL
Hits
28944
Files:
FileDescription
check_domain.phpv1.1.0
README.mdREADME
Nagios CSP

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!
A Nagios plugin for checking a domain expiration date by registry name.

The major changes made from the shell version is that registry expiration dates have different date formats and keys. This version accepts a wide variety of Registry formats and is intended to support all TLDs that are supported by whois.

(UPDATE: now can use the -s option to set a whois server)
Nagios Plugin: check_domain
============================

A Nagios plugin for checking a domain expiration date by registry name.


> This plugin relies on [jwhois](https://github.com/jodrell/jwhois) to find the registration
> dates so any TLD that is not supported by whois will not return correctly and will output
> something similar to the following:
>
> Error running whois:
>
> Thanks to [glensc](https://github.com/glensc) for his work on [nagios-plugin-check_domain](https://github.com/glensc/nagios-plugin-check_domain)
> which inspired this php version of his shell plugin.

Usage:

$./check_domain.php -d nagios.org
OK - Domain nagios.org will expire in 248 days (2015-10-04)

Full Usage:

check_domain.php - v1.1.0
Copyright (c) 2014 Luke Groschen, Nagios Enterprises ,
2009-2014 Elan Ruusamäe
Under GPL v2 License

This plugin checks the expiration date of a domain name.

Usage: check_domain.php -h | -d [-c ] [-w ] [-s ]
NOTE: -d must be specified

Options:
-h
Print this help and usage message
-d
Domain name to query against
-w
Response time to result in warning status (days)
-c
Response time to result in critical status (days)
-s
Specify a whois server (whois.internic.net by default)

This plugin will use the whois service to get the expiration date for the domain name.
Example:
$./check_domain.php -d nagios.com -w 30 -c 10 nn"
Reviews (2)
Installed it on Opsview Core. So far, most domains I have tried to monitor work great. Then I ran into a bunch that do not. I discovered they are all domains registered through GoDaddy. Any thoughts on how to fix that? I tried changing the whois server to who.godaddy.com to no avail. Even godaddy.com itself doesn't work.

$ /usr/local/nagios/libexec/check_domain.php -d godaddy.com -w 60 -c 15
RETURN CODE: 2 (CRITICAL)
OUTPUT:
CRITICAL - Domain godaddy.com will expire in -16448 days (clientRenewProhibited).


Thanks for all of the great your work you have put into this so far!
Owner's reply

Hello vertices,

Not sure why you're having an issue, but I tried this recently on my CentOS machine from the command line (which has the plugin in Nagios XI):

[root@XIdevr21 libexec]# ./check_domain.php -d godaddy.com -w 60 -c 15
OK - Domain godaddy.com will expire in 2484 days (2021-11-01T11:59:59Z).

Are you using v1.1.0? When I do the same command above, but use '-s whois.godaddy.com' it errors out saying:

Error running whois:

So I guess the default whois server works for godaddy.

bydkan, November 9, 2014
Dear programmer
can you also add support for .gr Greek and .eu European domain.
Regards,