Skip to content

Commit 5ca2dac

Browse files
committed
feat: adding findstring option to statuscake monitor
1 parent f5103e4 commit 5ca2dac

File tree

4 files changed

+10
-0
lines changed

4 files changed

+10
-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

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)