Monitor license expiration¶
When the license expires the IAD Server stops functioning. You can monitor the license's expiration date with Prometheus and set up alerting, so you can request the additional license in advance.
With the Prometheus you can setup Alertmanager, which can send notifications to email, Slack, Telegram and other destinations.
Configure Prometheus¶
IAD Server provides the /metrics
endpoint for the Prometheus to scrape. One of the metrics is iad_license_remaining_days
, it's a number of days left in the active license:
# HELP iad_license_remaining_days Days before the license expiration date
# TYPE iad_license_remaining_days gauge
iad_license_remaining_days{application="iad-server",} 340.0
When this value becomes zero, the license expires.
To scrape the metrics from the Server put these lines into your prometheus.yml
file:
scrape_configs:
- job_name: iadserver
scrape_interval: 1h
static_configs:
- targets: ["localhost:8080"]
This will instruct Prometheus to collect metrics every hour. You can check the current value via the Prometheus's expression browser. Navigate to http://localhost:9090 and query for the iad_license_remaining_days
metric in the "Graphs" page:
To configure alerts create this prometheus.rules.yml
file:
groups:
- name: iadserver
rules:
- alert: IADServerLicenseIsAboutToExpire
expr: iad_license_remaining_days < 30
annotations:
summary: "License for IAD Server will expire in {{ $value }} days"
It instructs Prometheus to start an alert where there is only one month left before the license expiration. Put it next to prometheus.yml
, which should also be updated to pick up the rules' file:
rule_files:
- prometheus.rules.yml
Now you can see the alert in the "Alerts" page:
It will be in the "Firing" state when the license is about to expire.