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.
--domain-Dstring, the domain name to check.--warn-winteger, the number of days after which a warning will be considered a warning condition. Default: 30.--crit-cinteger, the number of days after which a warning will be considered a critical condition. Default: 15.--servers-sstring, the path to the file containing the list of WHOIS servers.
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_KEYyour key .AZURE_OPENAI_ENDPOINTthe "Target URL" of endpoint to be used.AZURE_OPENAI_MODELthe name of the model you deployed.gpt-4o-miniworks fine and it is not too expensive.
- Get the source code:
$ git clone https://github.com/rgglez/nagios-check-domain-ai.git- Compile the code:
$ cd nagios-check-domain-ai
$ make buildTo install the binary to the default path (/usr/local/nagios/libexec), execute:
$ sudo make installOr just copy the executable to your regular Nagios plugins directory.
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-13Using the servers.json file:
check_domain_ai -D example.com --servers=/path/to/servers.jsonA 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.
This program has the following external dependencies:
- github.com/likexian/whois
- github.com/spf13/pflag
- github.com/xorpaul/go-nagios
- github.com/ztrue/tracerr
- golang.org/x/net/publicsuffix
- github.com/rgglez/whois-parser-ai/whoisparserai
-
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.
Copyright 2026 Rodolfo González González.
This program is licensed under the terms of the GPL v3.0. Please read the LICENSE file.