Skip to content

Latest commit

 

History

History
106 lines (69 loc) · 4.37 KB

File metadata and controls

106 lines (69 loc) · 4.37 KB

License: GPL v3 GitHub all releases GitHub issues GitHub commit activity Go Report Card GitHub release GitHub stars GitHub forks

nagios-check-domain-ai

check_domain_ai is a Nagios plugin written in Go that checks the expiration date of a given domain and notifies you if it is about to expire.

This plugin queries public WHOIS servers. It strives to query the appropriate server for the public suffix or TLD. Then, it parses the WHOIS output using the Microsoft Azure AI gateway to OpenAI API.

Command line options

  • --domain -D string, the domain name to check.
  • --warn -w integer, the number of days after which a warning will be considered a warning condition. Default: 30.
  • --crit -c integer, the number of days after which a warning will be considered a critical condition. Default: 15.
  • --servers -s string, the path to the file containing the list of WHOIS servers.

Parser

This program uses the whoisparserai module to parse the WHOIS output using Azure OpenAI

You must get this values from the Azure AI Foundry console and set the corresponding enviroment variables:

  • AZURE_OPENAI_KEY your key .
  • AZURE_OPENAI_ENDPOINT the "Target URL" of endpoint to be used.
  • AZURE_OPENAI_MODEL the name of the model you deployed. gpt-4o-mini works fine and it is not too expensive.

Build and installation

Build

  • Get the source code:
$ git clone https://github.com/rgglez/nagios-check-domain-ai.git
  • Compile the code:
$ cd nagios-check-domain-ai
$ make build

Installation

To install the binary to the default path (/usr/local/nagios/libexec), execute:

$ sudo make install

Or just copy the executable to your regular Nagios plugins directory.

Execution

First, export the required enviroment variables.

Basic example using default server (whois.iana.org):

check_domain_ai -D example.com
OK: Domain will expire in 159 days|expires=2026-08-13

Using the servers.json file:

check_domain_ai -D example.com --servers=/path/to/servers.json

Server list

A list of WHOIS servers is included in the data/servers.json file. This is a JSON file which has the TLD as the key and the corresponding WHOIS server as the value.

You can provide your own file. See the command line options above.

Dependencies

This program has the following external dependencies:

Notes

  • Of course, I am not affiliated with Microsoft in any way. Use their services at your own account and risk. Alternatively, you may modify the program to use the API of your preferred service. You can also use OpenAI's API directly, without Azure, by making only minor changes.

  • Be aware that you should be polite and run the checker once a week or so, because some WHOIS servers don't like to be queried too often and may block your IP address permanently.

License

Copyright 2026 Rodolfo González González.

This program is licensed under the terms of the GPL v3.0. Please read the LICENSE file.