| Domain Expiry: {HOST.HOST} - {ITEM.LASTVALUE2} | `last(/Domain Expiry/check_domain.state)="UNKNOWN" and last(/Domain Expiry/check_domain.message)<>0` | Not Classified | Alerts if the script cannot determine the domain's expiration status. |
| Domain Expiry: {HOST.HOST} has expired | `last(/Domain Expiry/check_domain.state)="CRITICAL" and last(/Domain Expiry/check_domain.days_since_expired)>0 and last(/Domain Expiry/check_domain.expire_date)<>0` | Disaster | Alerts if the domain has expired. |
| Domain Expiry: {HOST.HOST} will expire soon (Critical) | `last(/Domain Expiry/check_domain.state)="CRITICAL" and last(/Domain Expiry/check_domain.days_left)<={$EXP_CRIT} and last(/Domain Expiry/check_domain.expire_date)<>0` | High | Alerts if days remaining are below the critical threshold (`{$EXP_CRIT}`). |
| Domain Expiry: {HOST.HOST} will expire soon (Warning) | `last(/Domain Expiry/check_domain.state)="WARNING" and last(/Domain Expiry/check_domain.days_left)<={$EXP_WARN} and last(/Domain Expiry/check_domain.expire_date)<>0` | Warning | Alerts if days remaining are below the warning threshold (`{$EXP_WARN}`). |
### Script Usage
The `check_domain.sh` script can be run manually for testing:
-`-w, --warning`: Warning threshold in days (default: 30).
-`-c, --critical`: Critical threshold in days (default: 7).
-`-r, --rdap-server`: RDAP server URL (use `""` for IANA lookup).
-`-s, --whois-server`: WHOIS server hostname (use `""` for default lookup).
-`-P, --path`: Path to `whois` executable.
-`-z, --debug`: Enable debug output to stderr.
-`-h, --help`: Display help.
-`-V, --version`: Display version in JSON format.
**Example Output**:
```json
{"state":"OK","days_left":365,"days_since_expired":0,"expire_date":"2026-06-24","message":"State: OK ; Days left: 365 ; Expire date: 2026-06-24"}
```
## Debugging
- Enable debug mode in the script with `-z`:
```bash
./check_domain.sh -d example.com -z
```
- Check Zabbix logs for issues with script execution.
- Verify RDAP/WHOIS server availability and response format outside of script
## Notes
- The script prioritizes RDAP for faster, structured queries but falls back to WHOIS if RDAP fails.
- WHOIS awk parsing supports various date formats but may fail if whois query returns non-standard responses (no awk pattern match).
- Rate limits on WHOIS servers may trigger UNKNOWN states; increase or use custom check interval to mitigate (the default 1d is very reasonable).
- For some specific TLDs (e.g: `.uk`, `.br`) RDAP URL paths may have to be adjusted due to non-standard URL format. See `adjust_rdap_url()` function, which already handles /uk/ path adjustment.
## License
This project is licensed under the Apache License 2.0