Skip to content

Commit

Permalink
Adding support for AliCloud monitor
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskery committed Jan 7, 2025
1 parent dbd3c31 commit a15c2d0
Show file tree
Hide file tree
Showing 13 changed files with 562 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Currently we support the following monitors:
- [Application Insights](https://docs.microsoft.com/en-us/azure/azure-monitor/app/monitor-web-app-availability) ([Additional Config](docs/appinsights-configuration.md))
- [gcloud](https://cloud.google.com/monitoring/uptime-checks) ([Additional Config](docs/gcloud-configuration.md))
- [Grafana](https://grafana.com/grafana/plugins/grafana-synthetic-monitoring-app/) ([Additional Config](docs/grafana-configuration.md))
- [AliCloud](https://help.aliyun.com/zh/cms/user-guide/site-monitoring/?spm=5176.2020520111.console-base_help.dexternal.4d7866103lMFSV&scm=20140722.S_help%40%40%E6%96%87%E6%A1%A3%40%40416684.S_BB2%40bl%2BRQW%40ag0%2BBB1%40ag0%2Bhot%2Bos0.ID_416684-RL_%E7%AB%99%E7%82%B9%E7%9B%91%E6%8E%A7-LOC_console~UND~help-OR_ser-V_4-P0_0) ([Additional Config](docs/alicloud-configuration.md))

## Usage

Expand Down
23 changes: 23 additions & 0 deletions api/v1alpha1/endpointmonitor_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ type EndpointMonitorSpec struct {
// Configuration for Grafana Cloud Monitor Provider
// +optional
GrafanaConfig *GrafanaConfig `json:"grafanaConfig,omitempty"`

// Configuration for Alibaba Cloud Monitor Provider
// +optional
AliCloudConfig *AliCloudConfig `json:"aliCloudConfig,omitempty"`
}

// UptimeRobotConfig defines the configuration for UptimeRobot Monitor Provider
Expand Down Expand Up @@ -414,6 +418,25 @@ type GrafanaConfig struct {
AlertSensitivity string `json:"alertSensitivity,omitempty"`
}

type AliCloudConfig struct {
// The type of the site monitoring task.
//
// Valid values: HTTP, PING, TCP, UDP, DNS, SMTP, POP3, and FTP.
//
// > You must create at least one site monitoring task. You must specify all of the `Address`, `TaskName`, and `TaskType` parameters in each request.
//
// example:
//
// HTTP
TaskType string `json:"TaskType,omitempty"`
// The extended options of the protocol that is used by the site monitoring task. The options vary based on the protocol.
//
// example:
//
// {"time_out":5000}
OptionsJson string `json:"optionsJson,omitempty"`
}

// URLSource represents the set of resources to fetch the URL from
type URLSource struct {
// +optional
Expand Down
20 changes: 20 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 @@ -35,6 +35,22 @@ spec:
spec:
description: EndpointMonitorSpec defines the desired state of EndpointMonitor
properties:
aliCloudConfig:
description: Configuration for Alibaba Cloud Monitor Provider
properties:
TaskType:
description: "The type of the site monitoring task. \n Valid values:
HTTP, PING, TCP, UDP, DNS, SMTP, POP3, and FTP. \n > You must
create at least one site monitoring task. You must specify all
of the `Address`, `TaskName`, and `TaskType` parameters in each
request. \n example: \n HTTP"
type: string
optionsJson:
description: "The extended options of the protocol that is used
by the site monitoring task. The options vary based on the protocol.
\n example: \n {\"time_out\":5000}"
type: string
type: object
appInsightsConfig:
description: Configuration for AppInsights Monitor Provider
properties:
Expand Down
Empty file added docs/alicloud-configuration.md
Empty file.
5 changes: 5 additions & 0 deletions examples/configs/test-config-alicloud.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
providers:
- name: AliCloud
apiKey: <ACCESS KEY>
apiToken: <SECRET KEY>
apiURL: "metrics.cn-qingdao.aliyuncs.com"
13 changes: 13 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,19 @@ require (
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/alibabacloud-go/alibabacloud-gateway-spi v0.0.5 // indirect
github.com/alibabacloud-go/cms-20190101/v9 v9.1.3 // indirect
github.com/alibabacloud-go/darabonba-openapi/v2 v2.0.10 // indirect
github.com/alibabacloud-go/debug v1.0.1 // indirect
github.com/alibabacloud-go/endpoint-util v1.1.0 // indirect
github.com/alibabacloud-go/openapi-util v0.1.1 // indirect
github.com/alibabacloud-go/tea v1.2.2 // indirect
github.com/alibabacloud-go/tea-utils/v2 v2.0.6 // indirect
github.com/alibabacloud-go/tea-xml v1.1.3 // indirect
github.com/aliyun/credentials-go v1.3.10 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/clbanning/mxj/v2 v2.5.5 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/dimchansky/utfbom v1.1.0 // indirect
github.com/emicklei/go-restful v2.16.0+incompatible // indirect
Expand Down Expand Up @@ -81,6 +92,7 @@ require (
github.com/prometheus/common v0.46.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/tjfoc/gmsm v1.4.1 // indirect
go.opencensus.io v0.24.0 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
Expand All @@ -98,6 +110,7 @@ require (
google.golang.org/grpc v1.67.1 // indirect
google.golang.org/protobuf v1.35.2 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiextensions-apiserver v0.24.0 // indirect
k8s.io/component-base v0.24.0 // indirect
Expand Down
Loading

0 comments on commit a15c2d0

Please sign in to comment.