Check your domain expiration with Icinga2

It’s good to know what is going on inside your infrastructure. Monitoring is one of the most important systems (including backup – verified backup of course!) used by all companies. There are tons of tools which help sysadmins with monitoring their infrastructure. I have started my monitoring adventure with Icinga2, and for now, I don’t plan to change it. 🙂 Icinga2 has not only great community, but also distributed monitoring possibility and such obvious thing like High Availability. Icinga2 has also many plugins and everyone can do one by their own. I have taken this opportunity and I have created simple but very useful plugin. Useful for me, but I hope one can find this helpful too.

Domain expiration with Icinga2 – how does it work?

My plugin can be used with Icinga2 and with Nagios too. It’s a shell script, which uses a whois binary. You can specify warning and critical threshold, based on the number of days that are left until your domain expires. Its principle is simple – the script calculates amount of days between the current date and the domain expiration date.

Every Top-level domain has another format of date which is returned by Whois server, so I couldn’t use one universal code for every TLD. It’s the reason why the plugin supports only few domains. Now you can use the plugin with the following domains:

  • com
  • org
  • info
  • net
  • ru
  • pl

As it’s a shell script, your checker node must be a linux server. Moreover, you need only two binaries on your system:

  • whois
  • awk

I’ve tested the plugin only with a bash shell, so if you want to check domain expiration with Icinga2 using another shell, you need to test it first. Feedback is of course very welcome. 🙂

How to install check_domain_expiration plugin?

There are two places where you can find this plugin. The first one is my GitHub repository and the second one is a Icinga Exchange – the central repository for Icinga addons, plugins, modules and more.

Check domain expiration Icinga Exchange

Check domain expiration GitHub

Install using git repository
  1. Clone git repository into the temporary directory (or download the zip file)

  2. Copy into your CUSTOM_PLUGIN_DIR
  3. Create a new command reference (you can base on the example from repository)
  4. Create and apply services for your hosts with your procedures.
Install using Icinga Exchange
  1. Go to the plugin page on the Icinga Exchange repository. Find “Files” section at the bottom of the page.Check domain expiration with Icinga2 - files
  2. Download into your checker node
  3. Copy into your CUSTOM_PLUGIN_DIR
  4. Create a new command reference (you can base on the example from repository)
  5. Create and apply services for your hosts with your procedures.


Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.