Menu

Tree [02d76e] default tip /
 History

Read Only access


File Date Author Commit
 inc 2022-01-30 ggb ggb [02d76e] Fix issue with ping for non-default port
 .hgignore 2022-01-14 ggb ggb [ec6894] Added max-time-allowed
 README.md 2022-01-14 ggb ggb [afce10] Updated README
 domex.rb 2022-01-29 ggb ggb [dc4dfc] Convert Log to singleton
 edit 2022-01-29 ggb ggb [dc4dfc] Convert Log to singleton
 edit-md 2022-01-29 ggb ggb [dc4dfc] Convert Log to singleton
 sample-config.yaml 2021-07-19 ggb ggb [15fa5b] Update sample config

Read Me

domex

Domian Expiry Check

Overview

The purpose of this program is to check for when a domain name is about to expire (or has already expired).

It uses a configuration file to list the names it should check, and will check the expiry dates of all the domains listed in the configuration file. It will then send an email to a specified address showing when the next domain is about to expire.

When the program is running in background (detached from any terminal) then the progress messages are sent to the syslog.

Execution

The command formats are:

domex.rb config-file-name action

Where config-file-name is the name of the configuration file to use, and action is either mail or show. If no action is specified, the mail will be assumed, and this will cause an email to be sent to the specified recipient containing the results. If show is specified then no email is sent, but the results are displayed on the screen.

Output

The output is a YAML file that will be sent in an email (or displayed on the screen).

The following is an example of a possible output:

    ---
config-file: test/domex.yaml
domains:
- domain: domain-1.com
  expiry: '2023-06-10'
  exists: true
  expired: false
  ping: true
  ip: 
  - 50.123.99.20
- domain: domain-2.org
  expiry: '2022-03-21'
  exists: true
  expired: false
  ping: true
  ip: 
  - 50.123.99.22
- domain: domain-3.net
  expiry: '2021-06-09'
  exists: true
  expired: true
  ping: true
  ip: 
  - 50.123.99.20
earliest: '2021-06-09'
status: Expired
start_time: '2022-01-14 00:47:44'
elapsed-time: '00:00:01.177'
---
config-file: test/domex.yaml
count: 1
max-speed: 2.43MB/s
avg-speed: 2.43MB/s
min-speed: 2.43MB/s
targets:
- uri: http://ipv4.download.thinkbroadband.com/100MB.zip
  size: 104.86MB
  elapsed: 43.691
  speed: 2.43MB/s
  time-allowed:
  ok: true
- uri: https://fastest.fish/lib/downloads/100MiB.bin
  error:
  - '404'
  - Not Found
  ok: false
start-time: '2022-01-14 00:47:45'
elapsed-time: '00:00:44.123'
total-time: 44

For each domain the following values will be listed:

  • exists is true if a whois entry can be found for the domain.

  • expiry is the date when the domain will expire (or has when it has expired).

  • expired is true if the expiry date precedes the current date.

  • ping is true if the domain is able to be pinged (i.e. the domain is up and running - but it does not prove that the services on the domain are active).

  • ip is the current IP address the DNS record points to. This will be an empty array if no DNS record exists for the site,

The speed-tests section (which is optional) will attempt to download a number of files (specified in the configuration files) and display the download speed obtained.

Global values are:

  • config-file is the name of the configuration file used for the run.

  • earliest is the earliest date on which any of the domains are due to expire (it may be a past date is one or more domains have already expired).

  • status is one of the following:

  • OK all of the domains exist, none of the domains have expired, and all of the domains can be pinged.
  • Down at least one domain cannot be pinged.
  • Missing at least one domain does not exist.
  • Expired at least one domain has expired.

When sent as an email, the subject line of the email will include the status and earliest values of the output for quick reference.

Configuration file

Example configuration file

mail: ggb@levi.ggb
domains:
  - domain-1.com
  - domain-2.com
  - domain-3.com
dns:
  - 8.8.8.8
max-allowed-time: 900
speed-tests:
  - http://ipv4.download.thinkbroadband.com/100MB.zip
  - https://fastest.fish/lib/downloads/100MiB.bin

The configuration file is a YAML file. The file contains will look something like:

mail: recipient's email address

domains: array of domain names to be checked.

speed-tests: is an optional section that is an array of files to download to test for download speed bottlenecks.

dns: is an optional section which is an array of DNS servers. If this section is omitted then the default DNS server will be used to find the IP address(es) of the domains. If this section is included in the configuration fil then the DNS servers listed in the section will be used instead of the default DNS server.

max-allowed-time: is an optional limit on the number of seconds the speed tests should be allowed to run before timing out. This time is the cumulative time for all of the speed tests, not merely the time of a single test.

Ruby gems

The program is written in ruby, so requires a ruby interpreter to be able to run, and expects the following ruby gems to be available on the system:

  • whois-parser
  • net/smtp
  • net/ping
  • yaml
  • syslog
  • etc
  • pathname
  • resolv
  • date
  • open-uri
  • timeout

Notes

This program was created and tested on a Linux system, although it ought be be be able to run on other operating systems.