Giter Club home page Giter Club logo

monitoring-plugin-check_domain's Introduction

Nagios/Icinga Plugin: check_domain

Build Status

Nagios/Icinga plugin for checking a domain name expiration date

Usage

$ ./check_domain.sh -d github.io
OK - Domain github.io will expire in 43 days (2014-03-08).

Caching

This tool excels at monitoring a small number of domains, but because of whois rate limiting, it becomes infeasible to use for a large number of domains. For this to work around, there's support for caching positive lookups for defined time period. A failed lookup will cause the domain cache file to be removed so it should be as responsive as a normal check when the critical/warning threshold is reached.

An example to configure to cache positive lookups for one day:

  • --cache-dir /var/cache/check_domain --cache-age 1

The cache dir must exist and must be writable for user running the checks.

Pull requests

  1. Fork it.
  2. Create your feature branch (git checkout -b fixing-blah).
  3. Commit your changes (git commit -am 'Fixed blah').
  4. Run ./test.sh domain.tld to test the domain
  5. Add the example domain name to domains for CI to test them, commit it
  6. Push to the branch (git push origin fixing-blah).
  7. Create a new pull request.

Do not update changelog or attempt to change version.

Installing whois

This plugin uses the "whois" command. It is usually installed by default, but if not, you can get it via your favourite package manager.

Debian/Ubuntu:

# apt-get install whois

RHEL/CentOS:

# yum install whois

Directory Listings

monitoring-plugin-check_domain's People

Contributors

abchk1234 avatar adlabgithub avatar bsv9 avatar d0gd3v avatar elyrith avatar felixsqr avatar fnevgeny avatar glensc avatar herbie34 avatar ivmaks avatar jeanpaulgalea avatar kso512 avatar mxroo avatar nothinux avatar oasys avatar oikarinen avatar rastkov avatar ravisorg avatar tarmot avatar tomas-edwardsson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

monitoring-plugin-check_domain's Issues

Does not work with the server whois.name.com

Date format for this server:
Registrar Registration Expiration Date: 2015-01-11T23:00:00-07:00Z

Out for script:

date: invalid date `2015-01-11T23:00:00-07:00Z'
date: invalid date `2015-01-11T23:00:00-07:00Z'
CRITICAL - Domain example.li expired on 2015-01-11T23:00:00-07:00Z

bsd's version of 'date' does not like supplied parameters

BSD's 'date' command wants different parameters to convert expiration to seconds.

intead of: date +%s --date="$expiration"

we need: date -j -f %F $expiration +%s

I'm using FreeBSD 10.1-RELEASE; but I assume the problem is common amongst freebsd, netbsd, openbsd and OSX (haven't tested).

Sorry not to have written an elegant test to submit. I just hard coded the changes.

whois return Error code = 1 with .com

It seems whois returns error code = 1 with .com domain.

I just change this line (233)

[ $error -eq 0 ] || die "$STATE_UNKNOWN" "UNKNOWN - WHOIS exited with error $error."

By this line

[ $error -eq 0 ] || [ $error -eq 1] || die "$STATE_UNKNOWN" "UNKNOWN - WHOIS exited with error $error."

Then your parsing is ok.

I don't know if whois generates error 1 for other reasons. But for now on, I had no specific problem.

[EDIT] I'm on CentOS7 (with Centreon) and can't use latest whois version :/

Invalid date

The script just stopped working today and spit out invalid date format.

./check_domain -d google.com

date: invalid date ` 14-sep-2020\n 2020-09-13T21:00:00-0700'
date: invalid date ` 14-sep-2020\n 2020-09-13T21:00:00-0700'
CRITICAL - Domain google.com expired on  14-sep-2020
 2020-09-13T21:00:00-0700

The script is getting the wrong time on this exit

Hello:
I'm getting this exit

CRITICAL - Domain domain expired 662751 days ago (0201-12-10). | domain_days_until_expiry=-662751;30;7

with this whois exit:

created:     20141210 #13644956
expires:     20161210
changed:     20141210

thanks in advance
Nomar

Date not reliably parsed (perhaps only on BSD) - need to remove whitespaces.

We're having an issue running this on BSD (not withstanding the issue reported in #44

Not sure whether it's a BSD vs Linux awk, but some whois servers (whois.nic.uk) are returning carriage returns which are not being removed (and maybe the BSD date formatting is more sensitive to.

I can give examples, but it should be obvious that the following fix would be a useful addition to make parsing a bit more robust:

@@ -452,12 +452,12 @@ else
 	outfile=$(tempfile)
 	run_whois
 fi
-expiration=$(get_expiration $outfile)
+expiration=$(get_expiration $outfile | sed -E 's/[[:space:]]+//g')
 
 [ -   z "$expiration" ] && die "$STATE_UNKNOWN" "UNKNOWN - Unable to figure out expiration date for $domain Domain."

Problem with --cache-dir

Nagios Core 4.4.2
Works correct:
/usr/local/nagios/libexec/check_domain.sh -d xxx.com --cache-dir /var/cache/check_domain --cache-age 1

No work:
define command{
command_name check_domain_expire
command_line $USER1$/check_domain.sh -d $ARG1$ -w $ARG2$ -c $ARG3$ -C /var/cache/check_domain/ -a 1
}

define service {
use xxx-service-mail-sms
host_name xxx
service_description xxx.com/expire
check_command check_domain_expire!xxx.com!30!7
max_check_attempts 3
notifications_enabled 1
normal_check_interval 720
notification_interval 1440
}

OUTPUT:
UNKNOWN - Domain xxx.com doesn't exist or no WHOIS server available.

Does not successfully check 1and1 domains

Attempting to run check_domain.sh -d example.com (where example.com is a 1and1 domain) results in:

UNKNOWN - WHOIS exited with error 1.

The output for the whois is:

Domain Name: EXAMPLE.COM
Registry Domain ID: 1234567890_DOMAIN_COM-VRSN
Registrar WHOIS Server: whois.1and1.com
Registrar URL: http://registrar.1and1.info
Updated Date: 2017-10-01T13:08:01Z
Creation Date: 2017-05-01T13:08:37Z
Registry Expiry Date: 2018-05-01T13:00:00Z
Registrar: 1&1 Internet SE
Registrar IANA ID: 83
Registrar Abuse Contact Email: [email protected]
Registrar Abuse Contact Phone: +1.6105601459
Domain Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited
Name Server: NS-1234.AWSDNS-00.ORG
Name Server: NS-123.AWSDNS-00.COM
Name Server: NS-1234.AWSDNS-00.CO.UK
Name Server: NS-123.AWSDNS-00.NET
DNSSEC: unsigned
URL of the ICANN Whois Inaccuracy Complaint Form: https://www.icann.org/wicf/

Last update of whois database: 2017-10-01T14:00:00Z <<<

For more information on Whois status codes, please visit https://icann.org/epp

NOTICE: The expiration date displayed in this record is the date the
registrar's sponsorship of the domain name registration in the registry is
currently set to expire. This date does not necessarily reflect the expiration
date of the domain name registrant's agreement with the sponsoring
registrar. Users may consult the sponsoring registrar's Whois database to
view the registrar's reported date of expiration for this registration.

TERMS OF USE: You are not authorized to access or query our Whois
database through the use of electronic processes that are high-volume and
automated except as reasonably necessary to register domain names or
modify existing registrations; the Data in VeriSign Global Registry
Services' ("VeriSign") Whois database is provided by VeriSign for
information purposes only, and to assist persons in obtaining information
about or related to a domain name registration record. VeriSign does not
guarantee its accuracy. By submitting a Whois query, you agree to abide
by the following terms of use: You agree that you may use this Data only
for lawful purposes and that under no circumstances will you use this Data
to: (1) allow, enable, or otherwise support the transmission of mass
unsolicited, commercial advertising or solicitations via e-mail, telephone,
or facsimile; or (2) enable high volume, automated, electronic processes
that apply to VeriSign (or its computer systems). The compilation,
repackaging, dissemination or other use of this Data is expressly
prohibited without the prior written consent of VeriSign. You agree not to
use electronic processes that are automated and high-volume to access or
query the Whois database except as reasonably necessary to register
domain names or modify existing registrations. VeriSign reserves the right
to restrict your access to the Whois database in its sole discretion to ensure
operational stability. VeriSign may restrict or terminate your access to the
Whois database for failure to abide by these terms of use. VeriSign
reserves the right to modify these terms at any time.

The Registry database contains ONLY .COM, .NET, .EDU domains and
Registrars.

I hope that's helpful. It'd be great to get the script working for this as well.

domain interval

When I add domains to nagios for first interval check time its working correctly and second check internal it goes to unknown state like unable to figure out . I attached screen shot please look it
t
t1

Error "fgets: Connection reset by peer" breaks the parsing

Occasionally when running a whois the command gets the output we need (with the expiration date, etc.), but a separate part of the request the whois server queried gets denied with the error "fgets: Connection reset by peer"

This means we get our info, but because an error is thrown this line in check_domain.sh means we exit with error 2 instead of continuing to parse the data:

[ $error -eq 0 ] || die "$STATE_UNKNOWN" "UNKNOWN - WHOIS exited with error $error."

Uknown format of expiration date

Hello,

The script do not recongnize the format "DD/MM/YYYY"

[root@s18252688 nagios-plugin-check_domain]# whois vbrpleugueneuc.fr | grep Expiry
Expiry Date: 04/03/2016

[root@s18252688 nagios-plugin-check_domain]# ./check_domain.sh -d vbrpleugueneuc.fr
UNKNOWN - Unable to figure out expiration date for vbrpleugueneuc.fr Domain.

I edited check_domain.sh adding:

Expiry Date: 19/11/2015

/Expiry Date:/ && $NF ~ DATE_DD_MM_YYYY_SLASH {split($3, a, "/"); printf("%s-%s-%s", a[3], a[2], a[1]); exit}

and now it works.

[root@s18252688 nagios-plugin-check_domain]# ./check_domain.sh -d vbrpleugueneuc.fr
OK - Domain vbrpleugueneuc.fr will expire in 331 days (2016-03-04).

Thanks to update check_domain.sh

Regards
supergyver

Instructions to getting 'whois' command in readme

TL:DR - Is it worth putting whois package install instructions in when it's quick and easy to Google?

Early in 2014 I rented a fresh CentOS 6 machine and it did not come with the 'whois' installed. It was easy to look up how to do this, but is it worthwhile to put this type of info into README.md?

Normally I just put something like this in my plugins, but it's just an example:

This plugin uses the "whois" command. It is usually installed by default, but if not, you can get it via your favourite package manager:
Debian/Ubuntu: apt-get install whois
RHEL/CentOS: yum install jwhois

If this makes sense, I can create a PR, but I wanted to ask first.

bad variable name

check_domain -d panel.li -w 60 -c 30 -s whois.name.com
check_domain: 29: local: panel.li: bad variable name

check_domain -d panel.li -s whois.name.com
Ok

Expiration date for .bg domains is not parsed

Hello,
The expiration date for .bg domains does not get extracted by awk script. Whois returns something like:

DOMAIN NAME: alabala.bg

requested on: 03/11/2012 14:12:30.469901 EET

processed from: 21/05/2012 14:31:30.070302 EEST

activated on: 26/05/2012 12:47:39.913045 EEST

expires at: 21/05/2017 00:00:00 EEST

registration status: Registered

Here's what needs to be done:

 check_domain.sh | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/check_domain.sh b/check_domain.sh
index 201e98c..70bd912 100755
--- a/check_domain.sh
+++ b/check_domain.sh
@@ -146,6 +146,8 @@ expiration=$(
        DATE_DD_MON_YYYY_HHMMSS_TZ = "[0-9][0-9]-" MON "-" YYYY " " HH_MM_DD " UTC"
        #2016.01.14 18:47:31
        DATE_YYYYMMDD_HHMMSS = DATE_YYYY_MM_DD_DOT " " HH_MM_DD
+       # 21/05/2017 00:00:00 EEST
+       DATE_DD_MM_YYYY_SLASH_HHMMSS_TZ = DATE_DD_MM_YYYY_SLASH " " HH_MM_DD " [A-Z]+"

        split("january february march april may june july august september october november december", months, " ");
        for (i in months) {
@@ -247,6 +249,9 @@ expiration=$(

    # [State] Connected (2014/12/01)
    /\[State\]/ && $NF ~ DATE_YYYY_MM_DD_SLASH {gsub("[()]", "", $3); split($3, a, "/"); printf("%s-%s-%s", a[1], a[2], a[3]); exit}
+
+   # expires at: 21/05/2017 00:00:00 EEST
+   $0 ~ "expires at: *" DATE_DD_MM_YYYY_SLASH_HHMMSS_TZ {split($3, a, "/"); printf("%s-%s-%s", a[3], a[2], a[1]); exit}
 ' $outfile)

 [ -z "$expiration" ] && die "$STATE_UNKNOWN" "UNKNOWN - Unable to figure out expiration date for $domain Domain."

Please consider this for the next release.

Thanks,
Borislav Ivanov

unable to get expiration date for co.nz and GoDaddy's domains

/usr/local/nagios/libexec/check_domain.sh -w 30 -c 10 -d stuff.co.nz

UNKNOWN - Unable to figure out expiration date for stuff.co.nz Domain.

/usr/local/nagios/libexec/check_domain.sh -w 30 -c 10 -d trademe.co.nz

UNKNOWN - Unable to figure out expiration date for trademe.co.nz Domain.

/usr/local/nagios/libexec/check_domain.sh -w 30 -c 10 -d pricespy.co.nz

UNKNOWN - Unable to figure out expiration date for pricespy.co.nz Domain.

Add support for .hk

 -------------------------------------------------------------------------------
 Whois server by HKIRC
 -------------------------------------------------------------------------------
 .hk top level Domain names can be registered via HKIRC-Accredited Registrars.
 Go to https://www.hkirc.hk/content.jsp?id=280 for details.
 -------------------------------------------------------------------------------



Domain Name:  GOOGLE.HK

Domain Status: Active

Contract Version:   Refer to registrar

Registrar Name: MARKMONITOR INC.

Registrar Contact Information: Email: [email protected]

Reseller:




Registrant Contact Information:

Company English Name (It should be the same as the registered/corporation name on your Business Register Certificate or relevant documents): GOOGLE INC.
Company Chinese name:  -
Address: 1600 AMPHITHEATRE PARKWAY   94043
Country: US
Email: [email protected]
Domain Name Commencement Date: 06-04-2004
Expiry Date: 31-03-2016
Re-registration Status:  Complete



Administrative Contact Information:

Given name: DNS
Family name: ADMIN
Company name: GOOGLE INC.
Address: 1600 AMPHITHEATRE PARKWAY   94043
Country: US
Phone: +1-6502530000
Fax: +1-6502530001
Email: [email protected]
Account Name: HK3602487T




Technical Contact Information:

Family name: ADMIN
Company name: GOOGLE INC.
Address: 1600 AMPHITHEATRE PARKWAY   94043
Country: US
Phone: +1-6502530000
Fax: +1-6502530001
Email: [email protected]




Name Servers Information:

NS1.GOOGLE.COM
NS2.GOOGLE.COM
NS3.GOOGLE.COM
NS4.GOOGLE.COM



Status Information:

Domain Prohibit Status:



 -------------------------------------------------------------------------------
 The Registry contains ONLY .com.hk, .net.hk, .edu.hk, .org.hk,
 .gov.hk, idv.hk. and .hk $domains.
 -------------------------------------------------------------------------------

WHOIS Terms of Use
By using this WHOIS search enquiry service you agree to these terms of use.
The data in HKDNR's WHOIS search engine is for information purposes only and HKDNR does not guarantee the accuracy of the data. The data is provided to assist people to obtain information about the registration record of domain names registered by HKDNR. You agree to use the data for lawful purposes only.

You are not authorised to use high-volume, electronic or automated processes to access, query or harvest data from this WHOIS search enquiry service.

You agree that you will not and will not allow anyone else to:

a.    use the data for mass unsolicited commercial advertising of any sort via any medium including telephone, email or fax; or

b.    enable high volume, automated or electronic processes that apply to HKDNR or its computer systems including the WHOIS search enquiry service; or

c.    without the prior written consent of HKDNR compile, repackage, disseminate, disclose to any third party or use the data for a purpose other than obtaining information about a domain name registration record; or

d.    use such data to derive an economic benefit for yourself.

HKDNR in its sole discretion may terminate your access to the WHOIS search enquiry service (including, without limitation, blocking your IP address) at any time including, without limitation, for excessive use of the WHOIS search enquiry service.

HKDNR may modify these terms of use at any time by publishing the modified terms of use on its website.

No Response return in LibreNMS

no problem when run on check_domain.sh
[librenms@localhost plugins]$ ./check_domain.sh -d google.com
OK - Domain google.com will expire in 425 days (2020-09-13). | domain_days_until_expiry=425;30;7

however ./check-services.php not work
Nagios Service - 4
Request: '/usr/lib64/nagios/plugins/check_domain.sh' '-H' 'GOOGLE.COM' '-d'
check_domain.sh: invalid option -- 'H'
check_domain.sh: option requires an argument -- 'd'
Perf Data - None.
Response:
./check-services.php 2019-07-15 17:45:32 - 2 services polled in 0.385 secs

thanks for help

Can not get info domain .vn

Hi experts,
I'm using script check_domain.sh to check expiry domain .vn, but always return error UNKNOWN - WHOIS exited with error 1.

Add support for .ly

Registrant:
   Google Inc.
   DNS Admin
   1600 Amphitheatre Parkway
   Mountain View
   CA
   United States of America
   Zip/Postal code: 94043
   Phone: +16503300100
   [email protected]

Domain Name:   google.ly

Administrative Contact:
   Google Inc.
   DNS Admin
   1600 Amphitheatre Parkway
   Mountain View
   CA
   US
   Zip/Postal code: 94043
   Phone: +16503300100
   [email protected]

Technical Contact:
   MarkMonitor
   Domain Admin
   10400 Overland Rd\\\\r\\\\nPMB 155
   Boise
   ID
   US
   Zip/Postal code: 83709
   Phone: +1.2083895740
   Fax: +1.2083895799
   [email protected]

Billing Contact:
   MarkMonitor
   Domain Administrator
   10400 Overland Rd\\\\r\\\\nPMB 155
   Boise
   ID
   US
   Zip/Postal code: 83709
   Phone: +1.2083895740
   Fax: +1.2083895799
   [email protected]

Created: 2007-10-03 13:36:48
Updated: 2014-09-05 18:17:29
Expired: 2015-10-03 13:36:48

Domain servers in listed order:
   ns4.google.com
   ns3.google.com
   ns2.google.com
   ns1.google.com

Domain Status: ACTIVE
--
Whois information provided by:
LY Registry
whois.nic.ly
-For Whois usage policy please check:
 http://whois.nic.ly/policy.php

Update for check_domain.sh to add for .pt tld

Would you be able to add for autoproff.pt domain

whois autoproff.pt
[Querying whois.dns.pt]
[whois.dns.pt]
Nome de domínio / Domain Name: autoproff.pt
Data de registo / Creation Date (dd/mm/yyyy): 19/01/2015
Data de expiração / Expiration Date (dd/mm/yyyy): 18/01/2016
Estado / Status: ACTIVE

Titular / Registrant
XXXXXXX
XXXXXXX
XXXXXXX
Email: XXXXXXX

Entidade Gestora / Billing Contact
EPAG Domainservices GmbH
Email: XXXXXXX

Responsável Técnico / Tech Contact
EPAG Domainservices GmbH
Email: XXXXXXX

Nameserver Information
Nameserver: autoproff.pt NS ns4.gratisdns.dk.
Nameserver: autoproff.pt NS ns1.gratisdns.dk.
Nameserver: autoproff.pt NS ns2.gratisdns.dk.
Nameserver: autoproff.pt NS ns5.gratisdns.dk.
Nameserver: autoproff.pt NS ns3.gratisdns.dk.

This one also include expiry date information (Data de expiração / Expiration Date (dd/mm/yyyy): 18/01/2016). Thanks

Add support for .nz

% NZRS Limited
% Users confirm on submission their agreement to all published Terms
%
version: 5.00
query_datetime: 2015-05-30T09:32:33+12:00
domain_name: google.co.nz
query_status: 200 Active
domain_dateregistered: 1999-02-17T00:00:00+13:00
domain_datebilleduntil: 2016-02-17T00:00:00+13:00
domain_datelastmodified: 2015-03-20T09:03:01+13:00
domain_delegaterequested: yes
domain_signed: no
%
registrar_name: MarkMonitor
registrar_address1: 391 N. Ancestor Place
registrar_city: Boise
registrar_province: ID
registrar_postalcode: 83704
registrar_country: US (UNITED STATES)
registrar_phone: +1 208 3895740
registrar_fax: +1 208 3895771
registrar_email: [email protected]
%
registrant_contact_name: Google Inc.
registrant_contact_address1: 1600 Amphitheatre Parkway
registrant_contact_city: Mountain View
registrant_contact_province: CA
registrant_contact_postalcode: 94043
registrant_contact_country: US (UNITED STATES)
registrant_contact_phone: +1 650 6502530000
registrant_contact_fax: +1 650 6502530001
registrant_contact_email: [email protected]
%
admin_contact_name: Google Inc.
admin_contact_address1: 1600 Amphitheatre Parkway
admin_contact_city: Mountain View
admin_contact_province: CA
admin_contact_postalcode: 94043
admin_contact_country: US (UNITED STATES)
admin_contact_phone: +1 650 6502530000
admin_contact_fax: +1 650 6502530001
admin_contact_email: [email protected]
%
technical_contact_name: Google Inc.
technical_contact_address1: 1600 Amphitheatre Parkway
technical_contact_city: Mountain View
technical_contact_province: CA
technical_contact_postalcode: 94043
technical_contact_country: US (UNITED STATES)
technical_contact_phone: +1 650 6502530000
technical_contact_fax: +1  6502530001
technical_contact_email: [email protected]
%
ns_name_01: ns2.google.com
ns_name_02: ns4.google.com
ns_name_03: ns1.google.com
ns_name_04: ns3.google.com
%
% Users are advised that the following activities are strictly forbidden.
%
% Using multiple WHOIS queries, or using the output of multiple WHOIS
% queries in conjunction with any other facility or service, to enable
% or effect a download of part or all of the .nz Register.
%
% Using any information contained in the WHOIS query output to attempt a
% targeted contact campaign with any person, or any organisation, using any
% medium.
%
% A breach of these conditions will be treated as a breach of the .nz Policies
% and Procedures.  Sanctions in line with those specified in the policies and
% procedures at www.dnc.org.nz may result from any breach.
%
% Copyright InternetNZ

Add compatible with OVH syntax

example: whosi ovh.com

Domains registered there are using another syntax:
Registry Expiry Date: 2025-02-08T05:00:00Z

Can You add it to the script?

Thanks a lot!

Add support for LibreNMS

Would it be possible to add support for LibreNMS?

In LibreNMS a script called check_services.php calls the required "check" script. It always passes -H hostname.example.com. But when it calls the check_domain script it fails and returns an error check_domain.sh: invalid option -- 'H'.

The check_domain.sh script works correctly if I call it manually from the command line
./check_domain.sh -d google.ca -C /tmp -a 1
OK - Domain google.ca will expire in 63 days (2019-04-28). | domain_days_until_expiry=63;30;7

Would it be possible to have the check_domain.sh script updated to ignore the -H hostname.example.com so that it won't return an error?

Adding performance data?

Hello Elan and fellow users,

I would like to discuss appending performance data, changing the output from this:

$ ./check_domain.sh -d github.com -w 30 -c 10
OK - Domain github.com will expire in 2056 days (2020-10-09).

to something like this:

$ ./check_domain.sh -d github.com -w 30 -c 10
OK - Domain github.com will expire in 2056 days (2020-10-09).|days=2056;30;10;0;

This would move the plugin from Case 1 to Case 2 as defined by the Nagios Plugin API and uses the format:

|varname=value;warning;critical;min;max

Some options for implementation could be:

  • Adding a new command line option set (for example: "-p|--perfdata")
    • Might be confused with -P, so -f or something else might be better?
  • Making it the default for the current script
    • If this doesn't break any current usage, it would enhance the plugin by adding graphs to systems like Check_MK that utilize performance data automatically.
  • Adding a new script that appends the performance data as the default
    • Avoids issues above, but wastes space & effort.

As none of the above seem non-trivial, I figured it would be best to discuss this with you and the community before I went too far down any of these roads, since I would hope to eventually have the code mainlined.

Thanks for making this great plugin!

no .de Domains

[root@lenovo ~]# ./test.sh wolliz.de
-> wolliz.de
UNKNOWN - Unable to figure out expiration date for wolliz.de Domain.
<- wolliz.de
[root@lenovo ~]#

UNKNOWN - Unable to figure out expiration date for " ****.eu" Domain

Hi @glensc & @PasiJarnstedt
I want to know the expiry date of .au and .eu domains , unable to get them from this script (error:UNKNOWN - Unable to figure out expiration date for *****.eu domain) need to add different servers for those requests i think , as i have zero knowledge in scripting so could you please provide me the updated script , so that it will be very helpful to me. And for .ie domains it is not working all the time some time it is giving error like unable to figure out expiry and some time it is providing expiry date.
Thanks in advance

Update for check_domain.sh

Hi,

it does not work for the below domains.
autoproff.ir expire-date: 2016-02-05 (expiry date format from the "whois somedomain.ir" command)
autoproff.pl renewal date: 2016.01.14 18:47:31
autoproff.pt Data de expiração / Expiration Date (dd/mm/yyyy): 18/01/2016
autoproff.si expire: 2016-01-19
autoproff.at
autoproff.be
autoproff.ch
autoproff.de
autoproff.es
autoproff.eu
autoproff.fr
autoproff.gl
autoproff.gr
autoproff.li
autoproff.lt
autoproff.lu
autoproff.lv
autoproff.nl

Most of these domains are purchased by us but not used for hosting yet.

The response I get for all is below.
UNKNOWN 02-16-2015 01:25:02 0d 0h 21m 43s 3/3 UNKNOWN - Unable to figure out expiration date for somedomain.eu Domain.

If possible please make the changes to accommodate above root domains.

Support for .com.cn and .cn tlds

Hi,

Kindly add support for .com.cn and .cn tlds. Expiration date format is given below for the 2 domains.

[root@monitor ~]#whois gogovcard.com.cn
[Querying whois.cnnic.cn]
[whois.cnnic.cn]
Domain Name: gogovcard.com.cn
ROID: 20150218s10011s84514959-cn
Domain Status: clientTransferProhibited
Registrant ID: p44023925
Registrant: MARCARIA NETWORK LTD
Registrant Contact Email: [email protected]
Sponsoring Registrar: 广ä¸æ¶ä»£äºèç§ææéå
¬å¸
Name Server: ns01.trademarkarea.com
Name Server: ns02.trademarkarea.com
Registration Time: 2015-02-18 05:14:08
Expiration Time: 2016-02-18 05:14:08
DNSSEC: unsigned

[root@monitor ~]# whois gogovcard.cn
[Querying whois.cnnic.cn]
[whois.cnnic.cn]
Domain Name: gogovcard.cn
ROID: 20150218s10001s73956434-cn
Domain Status: clientTransferProhibited
Registrant ID: p44023925
Registrant: MARCARIA NETWORK LTD
Registrant Contact Email: [email protected]
Sponsoring Registrar: 广ä¸æ¶ä»£äºèç§ææéå
¬å¸
Name Server: ns01.trademarkarea.com
Name Server: ns02.trademarkarea.com
Registration Time: 2015-02-18 05:14:09
Expiration Time: 2016-02-18 05:14:09
DNSSEC: unsigned

Debian throws error 1 for .com domains that aren't found

(Tested on DigitalOcean droplets with Ubuntu 14.04 x64, Debian 7.2 x64, CentOS 7.2 x64, and CentOS 6.7 x64.)

When I run the following command on Debian-based distributions...
./check_domain.sh -d fakedomainaaa.com
...the output is...
UNKNOWN - WHOIS exited with error 1.

This doesn't happen on either of the CentOS servers I tried it on.

Domains that do exist have no issues.

Add support for .za

   Domain: google.co.za
    Registrant:
        Name: Google Inc.
        Organisation:
        Email: [email protected]
        Tel: +1.6502530000
        Fax: +1.6506188571

    Registrant's Address:
        Street: 1600 Amphitheatre Parkway
        Street:
        Street:
        City: Mountain View
        Province: CA
        Country: US
        Code: 94043

    Registrar:
        Name: MarkMonitor
        Organisation:
        Email: [email protected]
        Tel: +1.8003377520
        Fax:

    Relevant Dates:
        Registration Date: 2001-06-25
        Renewal Date:      2016-06-25

    Domain Status:
        ok

    Pending Timer Events:
        None

    Name Servers:
        ns1.google.com
        ns2.google.com
        ns3.google.com
        ns4.google.com

WHOIS lookup made at 2015-05-29 21:29 UTC

Run check_domain.sh through shellcheck.net

Hey Elan, as you know I'm not that strong of a coder, but I get by (barely). For a few years I've occasionally used the shellcheck.net website to verify that my code is good for shell scripts.

I ran check_domain.sh through it and there were a few issues it found. Nothing major, of course.

Would you find it valuable if I went through the results and submitted a PR with an updated version with help from that site?

Rate limiting options or workarounds?

Thank you @oasys for updating the script to make rate limited responses unknown again as opposed to critical in #28, that helped a lot!

My issue is that I'm checking over 100 domains for my clients and most of my clients have .org addresses so I've been coming up against the domain limiting for years.

Has anyone figured out a way to completely avoid it either in the plugin code or in nagios/icinga settings?

I use Icinga 1.11.6, and I've tried telling Icinga to allow more failures, check only twice per 24 hours, max_service_check_spread set to 180 minutes to spread out initial checks, and still pir.org's rate limiting logic stymies me.

Thanks in advance.

io domains are not getting results

I was able to do the following to get expiration date on .io domains, but since it's a popular one, can you have the lookup host build into the script?

./check_domain.sh -s whois.nic.io -d zeeto.io

Feature request: Ability to monitor expired domains using negative $warning and $critical values

One of my friends had their domain registered by somebody else long ago and now it's expired and they can't get control of it to renew. The domain has status "redemptionPeriod http://www.icann.org/epp#redemptionPeriod". They want me to wait until it's deleted and snatch it up so they continue using it. I looked up the registrar and I know the values for approximately when it's going to be released/deleted.

I have two options:

  1. I can create a little plugin to monitor the "status" of the domain and notify me when it enters or exits a specific status, or...
  2. I could use this plugin but use negative values for $warning and $critical

I've created a branch with the modified logic. I'll create a pull request so you can take a look.

Also, let me know if you think that this functionality doesn't really fit with what this plugin is meant to do. I'm not entirely sure myself. 😸

The Script does not work properly with .com Domains

Hi!.

The Script does not work properly with .com Domains

bash /usr/local/nagios/libexec/check_domain.sh -d  githubusercontent.com
UNKNOWN - WHOIS exited with error 1.

bash /usr/local/nagios/libexec/check_domain.sh -d  freetsa.org          
OK - Domain freetsa.org will expire in 119 days (2017-12-18). | domain_days_until_expiry=119;30;7

whois Version: RIPE Database Query Service version 1.89.2

Regards

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.