-
Notifications
You must be signed in to change notification settings - Fork 10
Monitor management
Your monitors are your base entities when it comes to the management of Kuvasz. They encapsulate all of the necessary informations that are needed to run any kind of checks against a website.
You can:
- create,
- update, or
- delete
a monitor.
While it is possible to manipulate your monitors directly in the database (followed by restarting the service), this approach is discouraged, because it doesn't guarantee the consistency of your data. Instead, you should use the API of Kuvasz to do these things.
There are dedicated endpoints for:
- creation ->
POST /monitors
- update ->
PATCH /monitors/{id}
- deletion ->
DELETE /monitors/{id}
When you create a new monitor, you have to make sure that the name of it is unique, otherwise you'll get back a 400 - Bad Request
from the service.
The uptimeCheckInterval
property on the API represents the interval between two consecutive uptime check in seconds. The shortest interval you can set is 60 seconds.
If you want to permanently remove a monitor and all of its historical data, you should go with the DELETE
endpoint mentioned above. However, if you just want to temporarily disable a monitor, you can use the PATCH
endpoint with the following payload:
{
"enabled": false
}
Through the provided PATCH
endpoint you can make partial updates to a monitor, which means that you don't have to specify the value of a property if you don't want to touch it at all.
Example (Updating only the uptimeCheckInterval
property of a monitor):
curl --location --request PATCH 'https://your.host:8080/monitors/4' \
--header 'Authorization: Bearer YourAccesstoken' \
--header 'Content-Type: application/json' \
--data-raw '{
"uptimeCheckInterval": 120
}'
You can enable the SSL checking for a given monitor by providing a true
value for the sslCheckEnabled
property when you create or update the monitor.
SSL checks are happening one minute after you create or update a monitor, and periodically (once a day) after that. If you completely disable a monitor (by its enabled
property), SSL checks won't be scheduled for it (enabled
works as a "main" switch in this case).
Example (Updating only the sslCheckEnabled
property of a monitor):
curl --location --request PATCH 'https://your.host:8080/monitors/4' \
--header 'Authorization: Bearer YourAccesstoken' \
--header 'Content-Type: application/json' \
--data-raw '{
"sslCheckEnabled": true
}'
You can enable the PagerDuty integration for a given monitor by providing your PagerDuty service's integration key in one of the following ways:
Providing a key when you create your monitor:
curl --location --request POST 'https://your.host:8080/monitors/' \
--header 'Authorization: Bearer YourAccessToken' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "my_first_monitor",
"url": "https://website.to.check",
"uptimeCheckInterval": 60,
"pagerdutyIntegrationKey": "YourSecretIntegrationKeyFromPagerDuty"
}'
Adding/updating a key for an existing monitor:
curl --location --request PUT 'https://your.host:8080/monitors/4/pagerduty-integration-key' \
--header 'Authorization: Bearer YourAccesstoken' \
--header 'Content-Type: application/json' \
--data-raw '{
"pagerdutyIntegrationKey": "YourSecretIntegrationKeyFromPagerDuty"
}'
Don't forget, you also have to enable the handler through Kuvasz's configuration variables to make the integration work!
If you want to disable a monitor's integration with PagerDuty, you can just simply delete the integration key of it with an API call like that:
curl --location --request DELETE 'https://your.host:8080/monitors/4/pagerduty-integration-key' \
--header 'Authorization: Bearer YourAccesstoken'