check_expire/README.md

83 lines
2.0 KiB
Markdown
Raw Normal View History

2021-07-05 19:56:43 +02:00
# check_expire
2021-07-05 20:49:49 +02:00
A Nagios (and compatible) plugin to check the impending expiration of a domain name. It relies on RDAP exclusively (no whois) and works with every top-level domain with RDAP (which includes all the ICANN ones).
## Usage
check_expire follows the usual Nagios rules. The options are:
* -H: domain name to monitor
* -c: critical threshold in days
* -w: warning threshold in days
* -v: verbose details in output
* -u: unixtime output
2021-07-05 20:49:49 +02:00
## Installation
You need Python 3 and [Requests](http://python-requests.org/). You can install Requests, for instance, with pip `pip3 install requests`.
Then, copy the script `check_expire` and the file `ianardap.py`to the directory of local plugins.
2021-07-05 21:04:34 +02:00
## Icinga configuration
If you use Icinga, here is a possible definition of the command:
```
object CheckCommand "expiration" {
command = [ PluginContribDir + "/check_expire" ]
arguments = {
"-H" = "$address$",
"-c" = "$expiration_critical$",
"-w" = "$expiration_warning$",
"-v" = { set_if = "$expiration_verbose$" }
}
}
apply Service "expiration" {
import "generic-service"
check_command = "expiration"
2021-07-05 21:04:34 +02:00
assign where host.address && host.vars.monitor_expiration
}
```
And a possible use:
```
object Host "bortzmeyer-org" {
...
2021-07-05 21:04:34 +02:00
address = "bortzmeyer.org"
vars.monitor_expiration = true
vars.expiration_verbose = true
2021-07-05 21:04:34 +02:00
}
```
## Zabbix configuration
For monitoring systems that do not rely on exit codes but on calculation mechanism based on the metric they receive you can use the `-u` option that will only return the expiration date in unixtime format.
For instance, you can use the following in zabbix 5.4:
* item: `check_expire["-H","{HOST.CONN}","-u"]`
* trigger (30 days before expiration): `last(/check_expire["-H","{HOST.CONN}","-u"])-now()<2592000`
Where `2592000` is the number of seconds in 30 days.
2021-07-05 20:49:49 +02:00
## License
GPL. See LICENSE.
## Authors
Stéphane Bortzmeyer <stephane+chapril@bortzmeyer.org>.
## Reference site
https://forge.chapril.org/bortzmeyer/check_expire Use the Gitea issue tracker to report bugs or wishes.