Ryan Loudfoot 5f79f0f9f3 Updated as per Vidar from shellcheck.net.
Email received from Vidar:
Hi,

On line 53 in the script, getopt is used with -u:

 -u, --unquoted
     Do not quote  the  output.  Note  that  whitespace  and  special
     (shell-dependent)  characters can cause havoc in this mode (like
     they do with other getopt(1) implementations).

This havoc is basically what Shellcheck is warning about.

Unfortunately it's not simply a matter of quoting the variable, since the
underlying problem is the way getopt is used.

Instead of -u, you can use -s bash, and then eval instead of word split:

args=$(getopt -o hd:w:c:P: --long help,domain:,warning:,critical:,path: -s
bash -n "$PROGRAM" -- "$@")
...
eval "set -- $args"

This way, no havoc is caused, and no shellcheck errors are reported.

Regards,
Vidar
2013-11-03 18:11:48 -05:00

This is a Nagios plugin to check the expiration date of a domain name.
It uses the "whois" command, which usually comes as a "whois" package.
Debian/Ubuntu: apt-get install whois

Original version had this copyright notice in it:
Copyright (c) 2005 Tomàs Núñez Lirola <tnunez@criptos.com>,
     2009-2012 Elan Ruusamäe <glen@delfi.ee>, under GPL License

Ryan found it hosted at:
http://git.pld-linux.org/gitweb.cgi/?p=packages/nagios-plugin-check_domain.git

This is a modified version, hosted at https://github.com/Elyrith/check_domain
Currently supports .com, .ca, .tv, .ee, .ru
Support for .ca and .se by Ryan Loudfoot (elyrith@gmail.com)
Support for Performance Data by Ryan Loudfoot

If you would like to add a TLD, send me the code or a pull request. If you want me to add one, let me know and I'll see what I can do.

Change log:
2013-09-06 - Version 0.92
-Modified the .com result to work for more domains since not all registrars have everything the same way
-Change readme to be lower-case for the file name
-Created changelog
Description
Nagios script to check website domain expiration. Supports .com, .ru, .ee, .tv, .ca, and .se.
Readme 53 KiB
Languages
Shell 100%