Documentation
¶
Index ¶
- func List(client *gophercloud.ServiceClient, opts ListOpts) pagination.Pager
- type Actions
- type Alarm
- type Alarms
- type AlarmsPage
- type Condition
- type CreateAlarm
- type CreateOpts
- type CreateOptsBuilder
- type CreateResult
- type DeleteResult
- type GetResult
- type ListOpts
- type MetaData
- type MetricAlarms
- type MetricInfo
- type MetricsDimension
- type UpdateOpts
- type UpdateOptsBuilder
- type UpdateResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func List ¶
func List(client *gophercloud.ServiceClient, opts ListOpts) pagination.Pager
Types ¶
type Alarm ¶
type Alarm struct {
MetricAlarms []MetricAlarms `json:"metric_alarms"`
}
type Alarms ¶
type Alarms struct {
MetricAlarms []MetricAlarms `json:"metric_alarms"`
MetaData MetaData `json:"meta_data"`
}
func ExtractAlarms ¶
func ExtractAlarms(r pagination.Page) (Alarms, error)
type AlarmsPage ¶
type AlarmsPage struct {
pagination.LinkedPageBase
}
func (AlarmsPage) IsEmpty ¶
func (r AlarmsPage) IsEmpty() (bool, error)
IsEmpty checks whether a NetworkPage struct is empty.
func (AlarmsPage) NextPageURL ¶
func (r AlarmsPage) NextPageURL() (string, error)
func (AlarmsPage) WrapNextPageURL ¶
func (r AlarmsPage) WrapNextPageURL(start string) (string, error)
ExtractNextURL is an internal function useful for packages of collection resources that are paginated in a certain way.
It attempts to extract the "start" URL from slice of Link structs, or "" if no such URL is present.
type Condition ¶
type Condition struct {
ComparisonOperator string `json:"comparison_operator" required:"true"`
Count int `json:"count" required:"true"`
Filter string `json:"filter" required:"true"`
Period int `json:"period" required:"true"`
Unit string `json:"unit,omitempty"`
Value int `json:"value" required:"true"`
SuppressDuration int `json:"suppress_duration,omitempty"`
}
type CreateAlarm ¶
type CreateAlarm struct {
AlarmId string `json:"alarm_id,omitempty"`
}
type CreateOpts ¶
type CreateOpts struct {
// 告警名称,只能包含0-9/a-z/A-Z/_/-或汉字。
AlarmName string `json:"alarm_name" required:"true"`
AlarmDescription string `json:"alarm_description,omitempty"`
// 告警指标。
Metric MetricInfo `json:"metric" required:"true"`
// 告警触发条件。
Condition Condition `json:"condition" required:"true"`
// 是否启用该条告警,默认为true。
AlarmEnabled *bool `json:"alarm_enabled,omitempty"`
// 是否启用该条告警触发的动作,默认为true。注:若alarm_action_enabled为true,对应的alarm_actions、ok_actions至少有一个不能为空。若alarm_actions、ok_actions同时存在时,notificationList值保持一致。
AlarmActionEnabled *bool `json:"alarm_action_enabled,omitempty"`
// 告警级别,默认为2,级别为1、2、3、4。分别对应紧急、重要、次要、提示。
AlarmLevel int `json:"alarm_level,omitempty"`
// 告警类型。仅针对事件告警的参数,枚举类型:EVENT.SYS或者EVENT.CUSTOM
AlarmType string `json:"alarm_type,omitempty"`
// 告警触发的动作。 结构样例如下: { \"type\": \"notification\",\"notificationList\": [\"urn:smn:southchina:68438a86d98e427e907e0097b7e35d47:sd\"] } type取值:notification:通知。 autoscaling:弹性伸缩。
AlarmActions []Actions `json:"alarm_actions,omitempty"`
// 数据不足触发的动作(该参数已废弃,建议无需配置)。
InsufficientdataActions []Actions `json:"insufficientdata_actions,omitempty"`
//告警恢复触发的动作。
OkActions []Actions `json:"ok_actions,omitempty"`
}
func (CreateOpts) ToCreateMap ¶
func (opts CreateOpts) ToCreateMap() (map[string]interface{}, error)
type CreateOptsBuilder ¶
type CreateResult ¶
type CreateResult struct {
gophercloud.Result
}
func Create ¶
func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult)
func (CreateResult) Extract ¶
func (r CreateResult) Extract() (*CreateAlarm, error)
type DeleteResult ¶
type DeleteResult struct {
gophercloud.ErrResult
}
func Delete ¶
func Delete(client *gophercloud.ServiceClient, alarmId string) (r DeleteResult)
type GetResult ¶
type GetResult struct {
gophercloud.Result
}
func Get ¶
func Get(client *gophercloud.ServiceClient, alarmId string) (r GetResult)
type MetaData ¶
type MetaData struct {
// 当前返回结果条数。
Count int `json:"count"`
// 总条数。
Total int `json:"total"`
// 下一个开始的标记,用于分页。
Marker string `json:"marker"`
}
查询结果元数据信息,包括分页信息等。
type MetricAlarms ¶
type MetricAlarms struct {
// 告警名称。
AlarmName string `json:"alarm_name"`
// 告警描述。
AlarmDescription string `json:"alarm_description,omitempty"`
// 告警指标。
Metric MetricInfo `json:"metric"`
// 告警触发条件。
Condition Condition `json:"condition"`
// 是否启用该条告警。
AlarmEnabled bool `json:"alarm_enabled,omitempty"`
// 告警级别,默认为2,级别为1、2、3、4。分别对应紧急、重要、次要、提示。
AlarmLevel int `json:"alarm_level,omitempty"`
// 告警类型。仅针对事件告警的参数,枚举类型:EVENT.SYS或者EVENT.CUSTOM
AlarmType string `json:"alarm_type,omitempty"`
// 是否启用该条告警触发的动作。
AlarmActionEnabled bool `json:"alarm_action_enabled,omitempty"`
// 告警触发的动作。 结构如下: { \"type\": \"notification\", \"notificationList\": [\"urn:smn:southchina:68438a86d98e427e907e0097b7e35d47:sd\"] } type取值: notification:通知。 autoscaling:弹性伸缩。 notificationList:告警状态发生变化时,被通知对象的列表。
AlarmActions []Actions `json:"alarm_actions,omitempty"`
// 告警恢复触发的动作。 结构如下: { \"type\": \"notification\", \"notificationList\": [\"urn:smn:southchina:68438a86d98e427e907e0097b7e35d47:sd\"] } type取值: notification:通知。 notificationList:告警状态发生变化时,被通知对象的列表。
OkActions []Actions `json:"ok_actions,omitempty"`
// 数据不足触发的动作(该参数已废弃,建议无需配置)。
InsufficientdataActions []Actions `json:"insufficientdata_actions,omitempty"`
// 告警规则的ID。
AlarmId string `json:"alarm_id"`
// 告警状态变更的时间,UNIX时间戳,单位毫秒。
UpdateTime int64 `json:"update_time"`
// 告警状态,取值说明: ok,正常 alarm,告警 insufficient_data,数据不足
AlarmState string `json:"alarm_state"`
}
type MetricInfo ¶
type MetricInfo struct {
// 指标维度
Dimensions []MetricsDimension `json:"dimensions" required:"true"`
// 指标名称,必须以字母开头,只能包含0-9/a-z/A-Z/_,长度最短为1,最大为64。 具体指标名请参见查询指标列表中查询出的指标名。
MetricName string `json:"metric_name" required:"true"`
// 指标命名空间,,例如弹性云服务器命名空间。格式为service.item;service和item必须是字符串,必须以字母开头,只能包含0-9/a-z/A-Z/_,总长度最短为3,最大为32。说明: 当alarm_type为(EVENT.SYS| EVENT.CUSTOM)时允许为空。
Namespace string `json:"namespace" required:"true"`
}
指标信息
type MetricsDimension ¶
type MetricsDimension struct {
// 维度名
Name string `json:"name,omitempty"`
// 维度值
Value string `json:"value,omitempty"`
}
指标维度
type UpdateOpts ¶
type UpdateOpts struct {
// 告警是否启用。true:启动。false:停止
AlarmEnabled *bool `json:"alarm_enabled" required:"true"`
}
func (UpdateOpts) ToUpdateMap ¶
func (opts UpdateOpts) ToUpdateMap() (map[string]interface{}, error)
type UpdateOptsBuilder ¶
type UpdateResult ¶
type UpdateResult struct {
gophercloud.ErrResult
}
func Update ¶
func Update(client *gophercloud.ServiceClient, alarmId string, opts UpdateOptsBuilder) (r UpdateResult)
Click to show internal directories.
Click to hide internal directories.