| 1 | ### Understand the alert |
| 2 | |
| 3 | This alert checks the Consul Enterprise license expiration time. It triggers a warning if the license expiration time is less than 14 days, and critical if it's less than 7 days. |
| 4 | |
| 5 | _consul.license_expiration_time_: Monitors the remaining time in seconds until the Consul Enterprise license expires. |
| 6 | |
| 7 | ### What is Consul? |
| 8 | |
| 9 | Consul is a service mesh solution that enables organizations to discover services and safely process network traffic across dynamic, distributed environments. |
| 10 | |
| 11 | ### Troubleshoot the alert |
| 12 | |
| 13 | 1. Check the current license expiration time |
| 14 | |
| 15 | You can check the remaining license expiration time for your Consul Enterprise instance using the Consul API: |
| 16 | |
| 17 | ``` |
| 18 | curl http://localhost:8500/v1/operator/license |
| 19 | ``` |
| 20 | |
| 21 | Look for the `ExpirationTime` field in the returned JSON output. |
| 22 | |
| 23 | 2. Renew the license |
| 24 | |
| 25 | If your license is about to expire, you will need to acquire a new license. Contact [HashiCorp Support](https://support.hashicorp.com/) to obtain and renew the license key. |
| 26 | |
| 27 | 3. Apply the new license |
| 28 | |
| 29 | You can apply the new license key either by restarting Consul with the new key specified via the `CONSUL_LICENSE` environment variable or the `license_path` configuration option, or by updating the license through the Consul API: |
| 30 | |
| 31 | ``` |
| 32 | curl -X PUT -d @new_license.json http://localhost:8500/v1/operator/license |
| 33 | ``` |
| 34 | |
| 35 | Replace `new_license.json` with the path to a file containing the new license key in JSON format. |
| 36 | |
| 37 | 4. Verify the new license expiration time |
| 38 | |
| 39 | After applying the new license, you can check the new license expiration time using the Consul API again: |
| 40 | |
| 41 | ``` |
| 42 | curl http://localhost:8500/v1/operator/license |
| 43 | ``` |
| 44 | |
| 45 | Ensure that the `ExpirationTime` field shows the new expiration time. |
| 46 | |
| 47 | ### Useful resources |
| 48 | |
| 49 | 1. [Consul License Documentation](https://www.consul.io/docs/enterprise/license) |
| 50 | 2. [HashiCorp Support](https://support.hashicorp.com/) |