Skip to content

Commit

Permalink
Merge pull request #570 from karlderkaefer/add-pingdom-transaction-ch…
Browse files Browse the repository at this point in the history
…ecks

Add Pingdom Transaction Checks
  • Loading branch information
MuneebAijaz committed Jun 12, 2024
2 parents 88a3c47 + 08fa1fd commit 3016d1e
Show file tree
Hide file tree
Showing 23 changed files with 1,178 additions and 150 deletions.
7 changes: 3 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,9 @@ vet: ## Run go vet against code.

ENVTEST_ASSETS_DIR = $(shell pwd)/testbin
.PHONY: test
test: generate fmt vet manifests
mkdir -p $(ENVTEST_ASSETS_DIR)
test -f $(ENVTEST_ASSETS_DIR)/setup-envtest.sh || curl -sSLo $(ENVTEST_ASSETS_DIR)/setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/v0.6.3/hack/setup-envtest.sh
source $(ENVTEST_ASSETS_DIR)/setup-envtest.sh; fetch_envtest_tools $(ENVTEST_ASSETS_DIR); setup_envtest_env $(ENVTEST_ASSETS_DIR); go test ./... -count=1 -coverprofile cover.out
test: generate fmt vet manifests envtest
$(ENVTEST) use -p path 1.28.x!
go test ./... -count=1 -coverprofile cover.out

##@ Build

Expand Down
68 changes: 68 additions & 0 deletions api/v1alpha1/endpointmonitor_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ type EndpointMonitorSpec struct {
// +optional
PingdomConfig *PingdomConfig `json:"pingdomConfig,omitempty"`

// Configuration for Pingdom Transaction Monitor Provider
// +optional
PingdomTransactionConfig *PingdomTransactionConfig `json:"pingdomTransactionConfig,omitempty"`

// Configuration for AppInsights Monitor Provider
// +optional
AppInsightsConfig *AppInsightsConfig `json:"appInsightsConfig,omitempty"`
Expand Down Expand Up @@ -288,6 +292,70 @@ type PingdomConfig struct {
PostDataEnvVar string `json:"postDataEnvVar,omitempty"`
}

// PingdomTransactionConfig defines the configuration for Pingdom Transaction Monitor Provider
type PingdomTransactionConfig struct {

// Check status: active or inactive
// +optional
Paused bool `json:"paused,omitempty"`

// Custom message that is part of the email and webhook alerts
// +optional
CustomMessage string `json:"custom_message,omitempty"`

// TMS test intervals in minutes. Allowed intervals: 5,10,20,60,720,1440. The interval you're allowed to set may vary depending on your current plan.
// +optional
// +kubebuilder:validation:Enum=5;10;20;60;720;1440
Interval int `json:"interval,omitempty"`

// Name of the region where the check is executed. Supported regions: us-east, us-west, eu, au
// +optional
// +kubebuilder:validation:Enum=us-east;us-west;eu;au
Region string `json:"region,omitempty"`

// Send notification when down X times
SendNotificationWhenDown int64 `json:"send_notification_when_down,omitempty"`

// Check importance- how important are the alerts when the check fails. Allowed values: low, high
// +optional
// +kubebuilder:validation:Enum=low;high
SeverityLevel string `json:"severity_level,omitempty"`

// steps to be executed as part of the check
// +required
Steps []PingdomStep `json:"steps"`

// List of tags for a check. The tag name may contain the characters 'A-Z', 'a-z', '0-9', '_' and '-'. The maximum length of a tag is 64 characters.
Tags []string `json:"tags,omitempty"`

// `-` separated set list of integrations ids (e.g. "91166-12168")
// +optional
AlertIntegrations string `json:"alertIntegrations,omitempty"`

// `-` separated contact id's (e.g. "1234567_8_9-9876543_2_1")
// +optional
AlertContacts string `json:"alertContacts,omitempty"`

// `-` separated team id's (e.g. "1234567_8_9-9876543_2_1")
// +optional
TeamAlertContacts string `json:"teamAlertContacts,omitempty"`
}

// PingdomStep respresents a step of the script to run a transcaction check
type PingdomStep struct {
// contains the html element with assigned value
// the key element is always lowercase for example {"url": "https://www.pingdom.com"}
// see available values at https://pkg.go.dev/github.com/karlderkaefer/pingdom-golang-client@latest/pkg/pingdom/client/tmschecks#StepArg
// +required
Args map[string]string `json:"args"`
// contains the function that is executed as part of the step
// commands: go_to, click, fill, check, uncheck, sleep, select_radio, basic_auth, submit, wait_for_element, wait_for_contains
// validations: url, exists, not_exists, contains, not_contains, field_contains, field_not_contains, is_checked, is_not_checked, radio_selected, dropdown_selected, dropdown_not_selected
// see updated list https://docs.pingdom.com/api/#section/TMS-Steps-Vocabulary/Script-transaction-checks
// +required
Function string `json:"function"`
}

// AppInsightsConfig defines the configuration for AppInsights Monitor Provider
type AppInsightsConfig struct {
// Returned status code that is counted as a success
Expand Down
54 changes: 54 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,95 @@ spec:
HTTP checks.
type: boolean
type: object
pingdomTransactionConfig:
description: Configuration for Pingdom Transaction Monitor Provider
properties:
alertContacts:
description: '`-` separated contact id''s (e.g. "1234567_8_9-9876543_2_1")'
type: string
alertIntegrations:
description: '`-` separated set list of integrations ids (e.g.
"91166-12168")'
type: string
custom_message:
description: Custom message that is part of the email and webhook
alerts
type: string
interval:
description: 'TMS test intervals in minutes. Allowed intervals:
5,10,20,60,720,1440. The interval you''re allowed to set may
vary depending on your current plan.'
enum:
- 5
- 10
- 20
- 60
- 720
- 1440
type: integer
paused:
description: 'Check status: active or inactive'
type: boolean
region:
description: 'Name of the region where the check is executed.
Supported regions: us-east, us-west, eu, au'
enum:
- us-east
- us-west
- eu
- au
type: string
send_notification_when_down:
description: Send notification when down X times
format: int64
type: integer
severity_level:
description: 'Check importance- how important are the alerts when
the check fails. Allowed values: low, high'
enum:
- low
- high
type: string
steps:
description: steps to be executed as part of the check
items:
description: PingdomStep respresents a step of the script to
run a transcaction check
properties:
args:
additionalProperties:
type: string
description: 'contains the html element with assigned value
the key element is always lowercase for example {"url":
"https://www.pingdom.com"} see available values at https://pkg.go.dev/github.com/karlderkaefer/pingdom-golang-client@latest/pkg/pingdom/client/tmschecks#StepArg'
type: object
function:
description: 'contains the function that is executed as
part of the step commands: go_to, click, fill, check,
uncheck, sleep, select_radio, basic_auth, submit, wait_for_element,
wait_for_contains validations: url, exists, not_exists,
contains, not_contains, field_contains, field_not_contains,
is_checked, is_not_checked, radio_selected, dropdown_selected,
dropdown_not_selected see updated list https://docs.pingdom.com/api/#section/TMS-Steps-Vocabulary/Script-transaction-checks'
type: string
required:
- args
- function
type: object
type: array
tags:
description: List of tags for a check. The tag name may contain
the characters 'A-Z', 'a-z', '0-9', '_' and '-'. The maximum
length of a tag is 64 characters.
items:
type: string
type: array
teamAlertContacts:
description: '`-` separated team id''s (e.g. "1234567_8_9-9876543_2_1")'
type: string
required:
- steps
type: object
providers:
description: Comma separated list of providers
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,95 @@ spec:
HTTP checks.
type: boolean
type: object
pingdomTransactionConfig:
description: Configuration for Pingdom Transaction Monitor Provider
properties:
alertContacts:
description: '`-` separated contact id''s (e.g. "1234567_8_9-9876543_2_1")'
type: string
alertIntegrations:
description: '`-` separated set list of integrations ids (e.g.
"91166-12168")'
type: string
custom_message:
description: Custom message that is part of the email and webhook
alerts
type: string
interval:
description: 'TMS test intervals in minutes. Allowed intervals:
5,10,20,60,720,1440. The interval you''re allowed to set may
vary depending on your current plan.'
enum:
- 5
- 10
- 20
- 60
- 720
- 1440
type: integer
paused:
description: 'Check status: active or inactive'
type: boolean
region:
description: 'Name of the region where the check is executed.
Supported regions: us-east, us-west, eu, au'
enum:
- us-east
- us-west
- eu
- au
type: string
send_notification_when_down:
description: Send notification when down X times
format: int64
type: integer
severity_level:
description: 'Check importance- how important are the alerts when
the check fails. Allowed values: low, high'
enum:
- low
- high
type: string
steps:
description: steps to be executed as part of the check
items:
description: PingdomStep respresents a step of the script to
run a transcaction check
properties:
args:
additionalProperties:
type: string
description: 'contains the html element with assigned value
the key element is always lowercase for example {"url":
"https://www.pingdom.com"} see available values at https://pkg.go.dev/github.com/karlderkaefer/pingdom-golang-client@latest/pkg/pingdom/client/tmschecks#StepArg'
type: object
function:
description: 'contains the function that is executed as
part of the step commands: go_to, click, fill, check,
uncheck, sleep, select_radio, basic_auth, submit, wait_for_element,
wait_for_contains validations: url, exists, not_exists,
contains, not_contains, field_contains, field_not_contains,
is_checked, is_not_checked, radio_selected, dropdown_selected,
dropdown_not_selected see updated list https://docs.pingdom.com/api/#section/TMS-Steps-Vocabulary/Script-transaction-checks'
type: string
required:
- args
- function
type: object
type: array
tags:
description: List of tags for a check. The tag name may contain
the characters 'A-Z', 'a-z', '0-9', '_' and '-'. The maximum
length of a tag is 64 characters.
items:
type: string
type: array
teamAlertContacts:
description: '`-` separated team id''s (e.g. "1234567_8_9-9876543_2_1")'
type: string
required:
- steps
type: object
providers:
description: Comma separated list of providers
type: string
Expand Down
1 change: 1 addition & 0 deletions docs/pingdom-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,4 @@ spec:
teamAlertContacts: "1234567_8_9-9876543_2_1,1234567_8_9-9876543_2_2"
postDataEnvVar: "monitor-user"
```
Loading

0 comments on commit 3016d1e

Please sign in to comment.