Skip to content

Commit c3b6a56

Browse files
authored
Merge pull request #419 from nickspizzas/statuscake_findstring
feat: adding findstring option to statuscake monitor
2 parents 31a22c2 + a401b35 commit c3b6a56

File tree

6 files changed

+18
-0
lines changed

6 files changed

+18
-0
lines changed

api/v1alpha1/endpointmonitor_types.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,10 @@ type StatusCakeConfig struct {
212212
// Enable Real Browser
213213
// +optional
214214
RealBrowser bool `json:"realBrowser,omitempty"`
215+
216+
// String to look for within the response. Considered down if not found
217+
// +optional
218+
FindString string `json:"findString,omitempty"`
215219
}
216220

217221
// PingdomConfig defines the configuration for Pingdom Monitor Provider

charts/ingressmonitorcontroller/crds/endpointmonitor.stakater.com_endpointmonitors.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,10 @@ spec:
139139
enableSslAlert:
140140
description: Enable SSL Alert
141141
type: boolean
142+
findString:
143+
description: String to look for within the response. Considered
144+
down if not found
145+
type: string
142146
followRedirect:
143147
description: Enable ingress redirects
144148
type: boolean

config/crd/bases/endpointmonitor.stakater.com_endpointmonitors.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,10 @@ spec:
139139
enableSslAlert:
140140
description: Enable SSL Alert
141141
type: boolean
142+
findString:
143+
description: String to look for within the response. Considered
144+
down if not found
145+
type: string
142146
followRedirect:
143147
description: Enable ingress redirects
144148
type: boolean

docs/statuscake-configuration.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Currently additional Statuscake configurations can be added through these fields
2323
| TriggerRate | Minutes to wait before sending an alert |
2424
| ContactGroup | Contact Group to be alerted. |
2525
| TestTags | Comma separated list of tags |
26+
| FindString | String to look for within the response |
2627
| BasicAuthUser | Required for [basic-authenticationchecks](#basic-auth-checks) |
2728

2829

pkg/monitors/statuscake/statuscake-monitor.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,9 @@ func buildUpsertForm(m models.Monitor, cgroup string) url.Values {
193193
if providerConfig != nil && providerConfig.Confirmation > 0 {
194194
f.Add("confirmation", strconv.Itoa(providerConfig.Confirmation))
195195
}
196+
if providerConfig != nil {
197+
f.Add("find_string", providerConfig.FindString)
198+
}
196199
return f
197200
}
198201

pkg/monitors/statuscake/statuscake-monitor_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ func TestBuildUpsertForm(t *testing.T) {
105105
BasicAuthUser: "testuser",
106106
Confirmation: 2,
107107
EnableSSLAlert: true,
108+
FindString: "",
108109

109110
// changed to string array type on statuscake api
110111
// TODO: release new apiVersion to cater new type in apiVersion struct
@@ -125,6 +126,7 @@ func TestBuildUpsertForm(t *testing.T) {
125126
assert.Equal(t, "2", vals.Get("confirmation"))
126127
assert.Equal(t, "123456,654321", convertUrlValuesToString(vals, "contact_groups[]"))
127128
assert.Equal(t, "1", vals.Get("enable_ssl_alert"))
129+
assert.Equal(t, "", vals.Get("find_string"))
128130
assert.Equal(t, "1", vals.Get("follow_redirects"))
129131
assert.Equal(t, "1", vals.Get("paused"))
130132
assert.Equal(t, "", vals.Get("ping_url"))

0 commit comments

Comments
 (0)