Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding support for AliCloud monitor #626

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
25 changes: 25 additions & 0 deletions docs/alicloud-configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Gcloud Configuration

You can configure AliCloud Cloud Monitoring Uptime Checks as a Ingress Monitor by using below configuration:


| Key | Description |
| -------------|------------------------------------------------------------------------------------|
| name | Name of the provider (e.g. AliCloud) |
| apiKey | Access Key ID (AKID): This is a unique identifier for your Alibaba Cloud account. It is used in conjunction with the Access Key Secret to sign requests.|
| apiToken | Access Key Secret (AKSK): This is a secret key associated with the Access Key ID. It is used to sign requests to ensure that they are sent by a legitimate user. |
| apiURL | `apiUrl` refers to: https://api.aliyun.com/product/Cms |

When you create an Alibaba Cloud account, you are provided with an Access Key ID (AKID) and an Access Key Secret (AKSK). These credentials are used to sign requests to Alibaba Cloud APIs, ensuring that the requests are securely authenticated.

AccessKey ID and AccessKey Secret are your security credentials to access API of Alibaba Cloud, have full access to your account. Keep the AccessKey confidential.

**Example Configuration:**

```yaml
providers:
- name: AliCloud
apiKey: <ACCESS KEY>
apiToken: <SECRET KEY>
apiURL: "metrics.cn-qingdao.aliyuncs.com"
```
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