Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d24c66cf96 | ||
|
|
70d7d0c54c |
No files matched your search
@@ -366,7 +366,7 @@ or send an HTTP request:
|
|||||||
POST /api/v1/endpoints/{key}/external?success={success}&error={error}&duration={duration}
|
POST /api/v1/endpoints/{key}/external?success={success}&error={error}&duration={duration}
|
||||||
```
|
```
|
||||||
Where:
|
Where:
|
||||||
- `{key}` has the pattern `<GROUP_NAME>_<ENDPOINT_NAME>` in which both variables have ` `, `/`, `_`, `,`, `.`, `#`, `(`, `)`, `+` and `&` replaced by `-`.
|
- `{key}` has the pattern `<GROUP_NAME>_<ENDPOINT_NAME>` in which both variables have ` `, `/`, `_`, `,`, `.`, `#`, `+` and `&` replaced by `-`.
|
||||||
- Using the example configuration above, the key would be `core_ext-ep-test`.
|
- Using the example configuration above, the key would be `core_ext-ep-test`.
|
||||||
- `{success}` is a boolean (`true` or `false`) value indicating whether the health check was successful or not.
|
- `{success}` is a boolean (`true` or `false`) value indicating whether the health check was successful or not.
|
||||||
- `{error}` (optional): a string describing the reason for a failed health check. If {success} is false, this should contain the error message; if the check is successful.
|
- `{error}` (optional): a string describing the reason for a failed health check. If {success} is false, this should contain the error message; if the check is successful.
|
||||||
@@ -2298,14 +2298,14 @@ endpoints:
|
|||||||
|
|
||||||
> ⚠️ **WARNING**: This alerting provider has not been tested yet. If you've tested it and confirmed that it works, please remove this warning and create a pull request, or comment on [#1223](https://github.com/TwiN/gatus/discussions/1223) with whether the provider works as intended. Thank you for your cooperation.
|
> ⚠️ **WARNING**: This alerting provider has not been tested yet. If you've tested it and confirmed that it works, please remove this warning and create a pull request, or comment on [#1223](https://github.com/TwiN/gatus/discussions/1223) with whether the provider works as intended. Thank you for your cooperation.
|
||||||
|
|
||||||
| Parameter | Description | Default |
|
| Parameter | Description | Default |
|
||||||
|:-------------------------------|:-------------------------------------------------------------------------------------------|:--------------|
|
|:-----------------------------------|:-------------------------------------------------------------------------------------------|:--------------|
|
||||||
| `alerting.webex` | Configuration for alerts of type `webex` | `{}` |
|
| `alerting.webex` | Configuration for alerts of type `webex` | `{}` |
|
||||||
| `alerting.webex.webhook-url` | Webex Teams webhook URL | Required `""` |
|
| `alerting.webex.webhook-url` | Webex Teams webhook URL | Required `""` |
|
||||||
| `alerting.webex.default-alert` | Default alert configuration. <br />See [Setting a default alert](#setting-a-default-alert) | N/A |
|
| `alerting.webex.default-alert` | Default alert configuration. <br />See [Setting a default alert](#setting-a-default-alert) | N/A |
|
||||||
| `alerting.webex.overrides` | List of overrides that may be prioritized over the default configuration | `[]` |
|
| `alerting.webex.overrides` | List of overrides that may be prioritized over the default configuration | `[]` |
|
||||||
| `alerting.webex.overrides[].group` | Endpoint group for which the configuration will be overridden by this configuration | `""` |
|
| `alerting.webex.overrides[].group` | Endpoint group for which the configuration will be overridden by this configuration | `""` |
|
||||||
| `alerting.webex.overrides[].*` | See `alerting.webex.*` parameters | `{}` |
|
| `alerting.webex.overrides[].*` | See `alerting.webex.*` parameters | `{}` |
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
alerting:
|
alerting:
|
||||||
@@ -2357,7 +2357,7 @@ endpoints:
|
|||||||
#### Configuring Zulip alerts
|
#### Configuring Zulip alerts
|
||||||
| Parameter | Description | Default |
|
| Parameter | Description | Default |
|
||||||
|:-----------------------------------|:------------------------------------------------------------------------------------|:--------------|
|
|:-----------------------------------|:------------------------------------------------------------------------------------|:--------------|
|
||||||
| `alerting.zulip` | Configuration for alerts of type `zulip` | `{}` |
|
| `alerting.zulip` | Configuration for alerts of type `zulip` | `{}` |
|
||||||
| `alerting.zulip.bot-email` | Bot Email | Required `""` |
|
| `alerting.zulip.bot-email` | Bot Email | Required `""` |
|
||||||
| `alerting.zulip.bot-api-key` | Bot API key | Required `""` |
|
| `alerting.zulip.bot-api-key` | Bot API key | Required `""` |
|
||||||
| `alerting.zulip.domain` | Full organization domain (e.g.: yourZulipDomain.zulipchat.com) | Required `""` |
|
| `alerting.zulip.domain` | Full organization domain (e.g.: yourZulipDomain.zulipchat.com) | Required `""` |
|
||||||
@@ -3297,7 +3297,7 @@ The path to generate a badge is the following:
|
|||||||
```
|
```
|
||||||
Where:
|
Where:
|
||||||
- `{duration}` is `30d`, `7d`, `24h` or `1h`
|
- `{duration}` is `30d`, `7d`, `24h` or `1h`
|
||||||
- `{key}` has the pattern `<GROUP_NAME>_<ENDPOINT_NAME>` in which both variables have ` `, `/`, `_`, `,`, `.`, `#`, `(`, `)`, `+` and `&` replaced by `-`.
|
- `{key}` has the pattern `<GROUP_NAME>_<ENDPOINT_NAME>` in which both variables have ` `, `/`, `_`, `,`, `.`, `#`, `+` and `&` replaced by `-`.
|
||||||
|
|
||||||
For instance, if you want the uptime during the last 24 hours from the endpoint `frontend` in the group `core`,
|
For instance, if you want the uptime during the last 24 hours from the endpoint `frontend` in the group `core`,
|
||||||
the URL would look like this:
|
the URL would look like this:
|
||||||
@@ -3323,7 +3323,7 @@ The path to generate a badge is the following:
|
|||||||
/api/v1/endpoints/{key}/health/badge.svg
|
/api/v1/endpoints/{key}/health/badge.svg
|
||||||
```
|
```
|
||||||
Where:
|
Where:
|
||||||
- `{key}` has the pattern `<GROUP_NAME>_<ENDPOINT_NAME>` in which both variables have ` `, `/`, `_`, `,`, `.`, `#`, `(`, `)`, `+` and `&` replaced by `-`.
|
- `{key}` has the pattern `<GROUP_NAME>_<ENDPOINT_NAME>` in which both variables have ` `, `/`, `_`, `,`, `.`, `#`, `+` and `&` replaced by `-`.
|
||||||
|
|
||||||
For instance, if you want the current status of the endpoint `frontend` in the group `core`,
|
For instance, if you want the current status of the endpoint `frontend` in the group `core`,
|
||||||
the URL would look like this:
|
the URL would look like this:
|
||||||
@@ -3340,7 +3340,7 @@ The path to generate a badge is the following:
|
|||||||
/api/v1/endpoints/{key}/health/badge.shields
|
/api/v1/endpoints/{key}/health/badge.shields
|
||||||
```
|
```
|
||||||
Where:
|
Where:
|
||||||
- `{key}` has the pattern `<GROUP_NAME>_<ENDPOINT_NAME>` in which both variables have ` `, `/`, `_`, `,`, `.`, `#`, `(`, `)`, `+` and `&` replaced by `-`.
|
- `{key}` has the pattern `<GROUP_NAME>_<ENDPOINT_NAME>` in which both variables have ` `, `/`, `_`, `,`, `.`, `#`, `+` and `&` replaced by `-`.
|
||||||
|
|
||||||
For instance, if you want the current status of the endpoint `frontend` in the group `core`,
|
For instance, if you want the current status of the endpoint `frontend` in the group `core`,
|
||||||
the URL would look like this:
|
the URL would look like this:
|
||||||
@@ -3363,7 +3363,7 @@ The endpoint to generate a badge is the following:
|
|||||||
```
|
```
|
||||||
Where:
|
Where:
|
||||||
- `{duration}` is `30d`, `7d`, `24h` or `1h`
|
- `{duration}` is `30d`, `7d`, `24h` or `1h`
|
||||||
- `{key}` has the pattern `<GROUP_NAME>_<ENDPOINT_NAME>` in which both variables have ` `, `/`, `_`, `,`, `.`, `#`, `(`, `)`, `+` and `&` replaced by `-`.
|
- `{key}` has the pattern `<GROUP_NAME>_<ENDPOINT_NAME>` in which both variables have ` `, `/`, `_`, `,`, `.`, `#`, `+` and `&` replaced by `-`.
|
||||||
|
|
||||||
#### Response time (chart)
|
#### Response time (chart)
|
||||||

|

|
||||||
@@ -3376,7 +3376,7 @@ The endpoint to generate a response time chart is the following:
|
|||||||
```
|
```
|
||||||
Where:
|
Where:
|
||||||
- `{duration}` is `30d`, `7d`, or `24h`
|
- `{duration}` is `30d`, `7d`, or `24h`
|
||||||
- `{key}` has the pattern `<GROUP_NAME>_<ENDPOINT_NAME>` in which both variables have ` `, `/`, `_`, `,`, `.`, `#`, `(`, `)`, `+` and `&` replaced by `-`.
|
- `{key}` has the pattern `<GROUP_NAME>_<ENDPOINT_NAME>` in which both variables have ` `, `/`, `_`, `,`, `.`, `#`, `+` and `&` replaced by `-`.
|
||||||
|
|
||||||
##### How to change the color thresholds of the response time badge
|
##### How to change the color thresholds of the response time badge
|
||||||
To change the response time badges' threshold, a corresponding configuration can be added to an endpoint.
|
To change the response time badges' threshold, a corresponding configuration can be added to an endpoint.
|
||||||
@@ -3434,7 +3434,7 @@ The path to get raw uptime data for an endpoint is:
|
|||||||
```
|
```
|
||||||
Where:
|
Where:
|
||||||
- `{duration}` is `30d`, `7d`, `24h` or `1h`
|
- `{duration}` is `30d`, `7d`, `24h` or `1h`
|
||||||
- `{key}` has the pattern `<GROUP_NAME>_<ENDPOINT_NAME>` in which both variables have ` `, `/`, `_`, `,`, `.`, `#`, `(`, `)`, `+` and `&` replaced by `-`.
|
- `{key}` has the pattern `<GROUP_NAME>_<ENDPOINT_NAME>` in which both variables have ` `, `/`, `_`, `,`, `.`, `#`, `+` and `&` replaced by `-`.
|
||||||
|
|
||||||
For instance, if you want the raw uptime data for the last 24 hours from the endpoint `frontend` in the group `core`, the URL would look like this:
|
For instance, if you want the raw uptime data for the last 24 hours from the endpoint `frontend` in the group `core`, the URL would look like this:
|
||||||
```
|
```
|
||||||
@@ -3448,7 +3448,7 @@ The path to get raw response time data for an endpoint is:
|
|||||||
```
|
```
|
||||||
Where:
|
Where:
|
||||||
- `{duration}` is `30d`, `7d`, `24h` or `1h`
|
- `{duration}` is `30d`, `7d`, `24h` or `1h`
|
||||||
- `{key}` has the pattern `<GROUP_NAME>_<ENDPOINT_NAME>` in which both variables have ` `, `/`, `_`, `,`, `.`, `#`, `(`, `)`, `+` and `&` replaced by `-`.
|
- `{key}` has the pattern `<GROUP_NAME>_<ENDPOINT_NAME>` in which both variables have ` `, `/`, `_`, `,`, `.`, `#`, `+` and `&` replaced by `-`.
|
||||||
|
|
||||||
For instance, if you want the raw response time data for the last 24 hours from the endpoint `frontend` in the group `core`, the URL would look like this:
|
For instance, if you want the raw response time data for the last 24 hours from the endpoint `frontend` in the group `core`, the URL would look like this:
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -15,8 +15,6 @@ func sanitize(s string) string {
|
|||||||
s = strings.ReplaceAll(s, ",", "-")
|
s = strings.ReplaceAll(s, ",", "-")
|
||||||
s = strings.ReplaceAll(s, " ", "-")
|
s = strings.ReplaceAll(s, " ", "-")
|
||||||
s = strings.ReplaceAll(s, "#", "-")
|
s = strings.ReplaceAll(s, "#", "-")
|
||||||
s = strings.ReplaceAll(s, "(", "-")
|
|
||||||
s = strings.ReplaceAll(s, ")", "-")
|
|
||||||
s = strings.ReplaceAll(s, "+", "-")
|
s = strings.ReplaceAll(s, "+", "-")
|
||||||
s = strings.ReplaceAll(s, "&", "-")
|
s = strings.ReplaceAll(s, "&", "-")
|
||||||
return s
|
return s
|
||||||
|
|||||||
@@ -32,12 +32,12 @@ func TestConvertGroupAndNameToKey(t *testing.T) {
|
|||||||
{
|
{
|
||||||
GroupName: "API (v1)",
|
GroupName: "API (v1)",
|
||||||
Name: "endpoint",
|
Name: "endpoint",
|
||||||
ExpectedOutput: "api--v1-_endpoint",
|
ExpectedOutput: "api-(v1)_endpoint",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
GroupName: "website (admin)",
|
GroupName: "website (admin)",
|
||||||
Name: "test",
|
Name: "test",
|
||||||
ExpectedOutput: "website--admin-_test",
|
ExpectedOutput: "website-(admin)_test",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
GroupName: "search",
|
GroupName: "search",
|
||||||
|
|||||||
@@ -183,6 +183,33 @@ func initializeStorage(cfg *config.Config) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Load persisted triggered alerts for suite endpoints
|
||||||
|
for _, suite := range cfg.Suites {
|
||||||
|
for _, ep := range suite.Endpoints {
|
||||||
|
var checksums []string
|
||||||
|
for _, alert := range ep.Alerts {
|
||||||
|
if alert.IsEnabled() {
|
||||||
|
checksums = append(checksums, alert.Checksum())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
numberOfTriggeredAlertsDeleted := store.Get().DeleteAllTriggeredAlertsNotInChecksumsByEndpoint(ep, checksums)
|
||||||
|
if numberOfTriggeredAlertsDeleted > 0 {
|
||||||
|
logr.Debugf("[main.initializeStorage] Deleted %d triggered alerts for suite endpoint with key=%s because their configurations have been changed or deleted", numberOfTriggeredAlertsDeleted, ep.Key())
|
||||||
|
}
|
||||||
|
for _, alert := range ep.Alerts {
|
||||||
|
exists, resolveKey, numberOfSuccessesInARow, err := store.Get().GetTriggeredEndpointAlert(ep, alert)
|
||||||
|
if err != nil {
|
||||||
|
logr.Errorf("[main.initializeStorage] Failed to get triggered alert for suite endpoint with key=%s: %s", ep.Key(), err.Error())
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if exists {
|
||||||
|
alert.Triggered, alert.ResolveKey = true, resolveKey
|
||||||
|
ep.NumberOfSuccessesInARow, ep.NumberOfFailuresInARow = numberOfSuccessesInARow, alert.FailureThreshold
|
||||||
|
numberOfPersistedTriggeredAlertsLoaded++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if numberOfPersistedTriggeredAlertsLoaded > 0 {
|
if numberOfPersistedTriggeredAlertsLoaded > 0 {
|
||||||
logr.Infof("[main.initializeStorage] Loaded %d persisted triggered alerts", numberOfPersistedTriggeredAlertsLoaded)
|
logr.Infof("[main.initializeStorage] Loaded %d persisted triggered alerts", numberOfPersistedTriggeredAlertsLoaded)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,7 +64,6 @@ func executeEndpoint(ep *endpoint.Endpoint, cfg *config.Config, extraLabels []st
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !cfg.Maintenance.IsUnderMaintenance() && !inEndpointMaintenanceWindow {
|
if !cfg.Maintenance.IsUnderMaintenance() && !inEndpointMaintenanceWindow {
|
||||||
// TODO: Consider moving this after the monitoring lock is unlocked? I mean, how much noise can a single alerting provider cause...
|
|
||||||
HandleAlerting(ep, result, cfg.Alerting)
|
HandleAlerting(ep, result, cfg.Alerting)
|
||||||
} else {
|
} else {
|
||||||
logr.Debug("[watchdog.executeEndpoint] Not handling alerting because currently in the maintenance window")
|
logr.Debug("[watchdog.executeEndpoint] Not handling alerting because currently in the maintenance window")
|
||||||
|
|||||||
+2
-2
@@ -50,6 +50,8 @@ func executeSuite(s *suite.Suite, cfg *config.Config, extraLabels []string) {
|
|||||||
if cfg.Metrics {
|
if cfg.Metrics {
|
||||||
metrics.PublishMetricsForSuite(s, result, extraLabels)
|
metrics.PublishMetricsForSuite(s, result, extraLabels)
|
||||||
}
|
}
|
||||||
|
// Store result
|
||||||
|
UpdateSuiteStatus(s, result)
|
||||||
// Handle alerting for suite endpoints
|
// Handle alerting for suite endpoints
|
||||||
for i, ep := range s.Endpoints {
|
for i, ep := range s.Endpoints {
|
||||||
if i < len(result.EndpointResults) {
|
if i < len(result.EndpointResults) {
|
||||||
@@ -72,8 +74,6 @@ func executeSuite(s *suite.Suite, cfg *config.Config, extraLabels []string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
logr.Infof("[watchdog.executeSuite] Completed suite=%s; success=%v; errors=%d; duration=%v; endpoints_executed=%d/%d", s.Name, result.Success, len(result.Errors), result.Duration, len(result.EndpointResults), len(s.Endpoints))
|
logr.Infof("[watchdog.executeSuite] Completed suite=%s; success=%v; errors=%d; duration=%v; endpoints_executed=%d/%d", s.Name, result.Success, len(result.Errors), result.Duration, len(result.EndpointResults), len(s.Endpoints))
|
||||||
// Store result in database
|
|
||||||
UpdateSuiteStatus(s, result)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdateSuiteStatus persists the suite result in the database
|
// UpdateSuiteStatus persists the suite result in the database
|
||||||
|
|||||||
Reference in new issue
Block a user