Documentation ¶
Index ¶
- type AddMetricDataItem
- type AddMetricDataOpts
- type AddMetricDataOptsBuilder
- type AddMetricDataResult
- type BatchQueryOpts
- type BatchQueryOptsBuilder
- type Datapoint
- type EventData
- type EventDataInfo
- type GetEventDataOpts
- type GetEventDataResult
- type GetOpts
- type GetResult
- type Metric
- type MetricData
- type MetricDatasResult
- type MetricInfo
- type Metricdata
- type MetricsDimension
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddMetricDataItem ¶ added in v1.0.21
type AddMetricDataItem struct { // 指标数据。 Metric MetricInfo `json:"metric" required:"true"` // 数据的有效期,超出该有效期则自动删除该数据,单位秒,最大值604800。 Ttl int `json:"ttl" required:"true"` // 数据收集时间 UNIX时间戳,单位毫秒。 说明: 因为客户端到服务器端有延时,因此插入数据的时间戳应该在[当前时间-3天+20秒,当前时间+10分钟-20秒]区间内,保证到达服务器时不会因为传输时延造成数据不能插入数据库。 CollectTime int `json:"collect_time" required:"true"` // 指标数据的值。 Value float64 `json:"value" required:"true"` // 数据的单位。 Unit string `json:"unit,omitempty"` // 数据的类型,只能是\"int\"或\"float\" Type string `json:"type,omitempty"` }
func (AddMetricDataItem) ToMap ¶ added in v1.0.21
func (opts AddMetricDataItem) ToMap() (map[string]interface{}, error)
type AddMetricDataOpts ¶ added in v1.0.21
type AddMetricDataOpts []AddMetricDataItem
func (AddMetricDataOpts) ToAddMetricDataMap ¶ added in v1.0.21
func (opts AddMetricDataOpts) ToAddMetricDataMap() ([]map[string]interface{}, error)
type AddMetricDataOptsBuilder ¶ added in v1.0.21
type AddMetricDataResult ¶ added in v1.0.21
type AddMetricDataResult struct {
gophercloud.ErrResult
}
func AddMetricData ¶ added in v1.0.21
func AddMetricData(client *gophercloud.ServiceClient, opts AddMetricDataOptsBuilder) (r AddMetricDataResult)
type BatchQueryOpts ¶
type BatchQueryOpts struct { // Specifies the metric data. Metrics []Metric `json:"metrics" required:"true"` // Specifies the start time of the query. From int64 `json:"from" required:"true"` // Specifies the end time of the query. To int64 `json:"to" required:"true"` // Specifies the data monitoring granularity. Period string `json:"period" required:"true"` // Specifies the data rollup method. Filter string `json:"filter" required:"true"` }
BatchQueryOpts represents options for batch query metric data.
func (BatchQueryOpts) ToBatchQueryOptsMap ¶
func (opts BatchQueryOpts) ToBatchQueryOptsMap() (map[string]interface{}, error)
ToBatchQueryOptsMap builds a request body from BatchQueryOpts.
type BatchQueryOptsBuilder ¶
BatchQueryOptsBuilder allows extensions to add additional parameters to the BatchQuery request.
type EventData ¶ added in v1.0.21
type EventData struct {
Datapoints []EventDataInfo `json:"datapoints"`
}
This is a auto create Response Object
type EventDataInfo ¶ added in v1.0.21
type GetEventDataOpts ¶ added in v1.0.21
type GetEventDataOpts struct { // 指标的维度,目前最大支持3个维度,维度编号从0开始;维度格式为dim.{i}=key,value参考弹性云服务器维度。例如dim.0=instance_id,i-12345 Dim0 string `q:"dim.0,required"` Dim1 string `q:"dim.1"` Dim2 string `q:"dim.2"` // 查询数据起始时间,UNIX时间戳,单位毫秒。 From string `q:"from,required"` // 指标命名空间,例如弹性云服务器命名空间。 Namespace string `q:"namespace,required"` // 查询数据截止时间UNIX时间戳,单位毫秒。from必须小于to。 To string `q:"to,required"` // 事件类型,只允许字母、下划线、中划线,字母开头,长度不超过64,如instance_host_info。 Type string `q:"type,required"` }
type GetEventDataResult ¶ added in v1.0.21
type GetEventDataResult struct {
gophercloud.Result
}
func GetEventData ¶ added in v1.0.21
func GetEventData(client *gophercloud.ServiceClient, opts GetEventDataOpts) (r GetEventDataResult)
func (GetEventDataResult) Extract ¶ added in v1.0.21
func (r GetEventDataResult) Extract() (*EventData, error)
type GetOpts ¶ added in v1.0.21
type GetOpts struct { // 指标的维度,目前最大支持3个维度,维度编号从0开始;维度格式为dim.{i}=key,value,最大值为256。 例如dim.0=instance_id,i-12345 Dim0 string `q:"dim.0,required"` Dim1 string `q:"dim.1"` Dim2 string `q:"dim.2"` // 数据聚合方式。 支持的值为max, min, average, sum, variance。 Filter string `q:"filter,required"` // 查询数据起始时间,UNIX时间戳,单位毫秒。建议from的值相对于当前时间向前偏移至少1个周期。由于聚合运算的过程是将一个聚合周期范围内的数据点聚合到周期起始边界上,如果将from和to的范围设置在聚合周期内,会因为聚合未完成而造成查询数据为空,所以建议from参数相对于当前时间向前偏移至少1个周期。以5分钟聚合周期为例:假设当前时间点为10:35,10:30~10:35之间的原始数据会被聚合到10:30这个点上,所以查询5分钟数据点时from参数应为10:30或之前。云监控会根据所选择的聚合粒度向前取整from参数。 From string `q:"from,required"` // 指标名称,例如弹性云服务器监控指标中的cpu_util。 MetricName string `q:"metric_name,required"` // 指标命名空间。 Namespace string `q:"namespace,required"` // 监控数据粒度。 取值范围: 1,实时数据 300,5分钟粒度 1200,20分钟粒度 3600,1小时粒度 14400,4小时粒度 86400,1天粒度 Period string `q:"period,required"` // 查询数据截止时间UNIX时间戳,单位毫秒。from必须小于to。 To string `q:"to,required"` }
type GetResult ¶ added in v1.0.21
type GetResult struct {
gophercloud.Result
}
func Get ¶ added in v1.0.21
func Get(client *gophercloud.ServiceClient, opts GetOpts) (r GetResult)
func (GetResult) Extract ¶ added in v1.0.21
func (r GetResult) Extract() (*Metricdata, error)
type Metric ¶
type Metric struct { // Specifies the namespace in service. Namespace string `json:"namespace" required:"true"` // The value can be a string of 1 to 64 characters // and must start with a letter and contain only uppercase // letters, lowercase letters, digits, and underscores. MetricName string `json:"metric_name" required:"true"` // Specifies the list of the metric dimensions. Dimensions []map[string]string `json:"dimensions" required:"true"` }
type MetricData ¶
type MetricData struct { // Specifies the namespace in service. Namespace string `json:"namespace"` // The value can be a string of 1 to 64 characters // and must start with a letter and contain only uppercase // letters, lowercase letters, digits, and underscores. MetricName string `json:"metric_name"` //Specifies the list of the metric dimensions. Dimensions []map[string]interface{} `json:"dimensions"` // Specifies the metric data list. Datapoints []map[string]interface{} `json:"datapoints"` // Specifies the metric unit. Unit string `json:"unit"` }
type MetricDatasResult ¶
type MetricDatasResult struct {
gophercloud.Result
}
func BatchQuery ¶
func BatchQuery(client *gophercloud.ServiceClient, opts BatchQueryOptsBuilder) (r MetricDatasResult)
Querying Monitoring Data in Batches.
func (MetricDatasResult) ExtractMetricDatas ¶
func (r MetricDatasResult) ExtractMetricDatas() ([]MetricData, error)
ExtractMetricDatas is a function that accepts a result and extracts metric datas.
type MetricInfo ¶ added in v1.0.21
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 Metricdata ¶ added in v1.0.21
type MetricsDimension ¶ added in v1.0.21
type MetricsDimension struct { // 维度名 Name string `json:"name,omitempty"` // 维度值 Value string `json:"value,omitempty"` }
指标维度
Click to show internal directories.
Click to hide internal directories.