Skip to content

Commit

Permalink
Merge pull request #609 from RosemanLabs/upstream/add-statuscake-config
Browse files Browse the repository at this point in the history
Statuscake: Add raw_post_data and user_agent
  • Loading branch information
SheryarButt authored Nov 21, 2024
2 parents 18056df + 4a667f0 commit 6b29093
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 0 deletions.
8 changes: 8 additions & 0 deletions api/v1alpha1/endpointmonitor_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,14 @@ type StatusCakeConfig struct {
// String to look for within the response. Considered down if not found
// +optional
FindString string `json:"findString,omitempty"`

// RawPostData can be used to send parameters within the URL. Changes the request from a GET to a POST
// +optional
RawPostData string `json:"rawPostData,omitempty"`

// UserAgent is used to set a user agent string.
// +optional
UserAgent string `json:"userAgent,omitempty"`
}

// PingdomConfig defines the configuration for Pingdom Monitor Provider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,10 @@ spec:
port:
description: TCP Port
type: integer
rawPostData:
description: RawPostData can be used to send parameters within
the URL. Changes the request from a GET to a POST
type: string
realBrowser:
description: Enable Real Browser
type: boolean
Expand All @@ -307,6 +311,9 @@ spec:
triggerRate:
description: Minutes to wait before sending an alert
type: integer
userAgent:
description: UserAgent is used to set a user agent string.
type: string
type: object
updownConfig:
description: Configuration for Updown Monitor Provider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,10 @@ spec:
port:
description: TCP Port
type: integer
rawPostData:
description: RawPostData can be used to send parameters within
the URL. Changes the request from a GET to a POST
type: string
realBrowser:
description: Enable Real Browser
type: boolean
Expand All @@ -307,6 +311,9 @@ spec:
triggerRate:
description: Minutes to wait before sending an alert
type: integer
userAgent:
description: UserAgent is used to set a user agent string.
type: string
type: object
updownConfig:
description: Configuration for Updown Monitor Provider
Expand Down
2 changes: 2 additions & 0 deletions docs/statuscake-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ Currently additional Statuscake configurations can be added through these fields
| FindString | String to look for within the response |
| BasicAuthUser | Required for [basic-authenticationchecks](#basic-auth-checks) |
| Regions | Regions to execute the check from |
| RawPostData | Add data to change the request to a POST |
| UserAgent | Add a user agent string to the request |


### Basic Auth checks
Expand Down
2 changes: 2 additions & 0 deletions examples/endpointMonitor/statuscake-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ spec:
pingUrl: 'https://stakater2.com/'
contactGroup: '123456,654321'
regions: amsterdam, stockholm
rawPostData: '{"test": "data"}'
userAgent: test-user
url: 'https://stakater1.com/'
6 changes: 6 additions & 0 deletions pkg/monitors/statuscake/statuscake-monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,12 @@ func buildUpsertForm(m models.Monitor, cgroup string) url.Values {
if providerConfig != nil {
f.Add("find_string", providerConfig.FindString)
}
if providerConfig != nil && len(providerConfig.RawPostData) > 0 {
f.Add("post_raw", providerConfig.RawPostData)
}
if providerConfig != nil && len(providerConfig.UserAgent) > 0 {
f.Add("user_agent", providerConfig.UserAgent)
}
return f
}

Expand Down

0 comments on commit 6b29093

Please sign in to comment.