跳转至

采集器「阿里云-站点监控-指标采集」配置手册

阅读本文前,请先阅读:

使用本采集器前,必须安装「观测云集成 Core 核心包」及其配套的第三方依赖包

采集站点监控指标数据前,必须先配置「阿里云-站点监控任务采集」自定义对象采集器

该采集器默认支持开启多线程(默认开启五个线程),如果需要更改线程池大小,可以设置环境变量 COLLECTOR_THREAD_POOL_SIZE

1. 配置结构

站点监控指标采集无需额外配置,

2. 指标数据格式

数据正常同步后,可以在观测云的「指标」中查看数据。

数据示例如下:

JSON
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{
  "fields": {
    "HTTPConnectTime": 33.0,
    "HTTPDNSTime": 9.0,
    "HTTPDownloadSize": 56172.0,
    "HTTPDownloadSpeed": 8582605.0,
    "HTTPDownloadTime": 6.0,
    "HTTPResponseCode": 200.0,
    "SSLConnectTime": 42.0,
    "TotalTime": 227.0,
    "curlConnectTime": 15.0,
    "curlPretransferTime": 42.0,
    "curlStarttransferTime": 143.0,
    "errorCode": 0.0,
    "redirectCount": 1.0,
    "redirectTime": 77.0,
    "tcpConnectTime": 15.0
  },
  "measurement": "aliyun_site_monitor",
  "tags": {
    "TaskId": "693a16b9-xxxx",
    "areaCN": "华东",
    "areaEN": "HuaDong",
    "cityCN": "上海市",
    "cityEN": "Shanghai",
    "countryCN": "中国",
    "countryEN": "China",
    "ispCN": "阿里巴巴",
    "ispEN": "Alibaba",
    "provinceCN": "上海市",
    "provinceEN": "Shanghai"
  },
  "timestamp": 1715050378317
}

所有的指标值都会以 float 类型上报

3. 与自定义对象采集器联动

当同一个 DataFlux Func 中运行了「阿里云-站点监控任务采集」自定义对象采集器时,本采集器会自动根据tags.TaskId 字段尝试匹配自定义对象中的tags.name字段。

由于需要先获知自定义对象信息才能在云监控类采集器中进行联动,因此一般建议将云监控的采集器放置在列表末尾,如:

Python
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# 创建采集器
import guance_aliyun_site_monitor_task__main as main
import guance_aliyun_site_monitor_metric__main as monitor_main

@DFF.API('AlibabaCloud-Site-Monitor Collection', timeout=3600, fixed_crontab='* * * * *')
def run():
  collectors = [
      main.DataCollector(account),
      monitor_main.DataCollector(account) # 云监控类采集器一般放在最末尾
  ]

当成功匹配后,会将所匹配的自定义对象tags中的字段加入到监控数据的tags中,以此实现在使用实例名称筛选云监控的指标数据等效果。

最终上报数据如下:

JSON
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{
  "fields": {
    "HTTPConnectTime": 33.0,
    "HTTPDNSTime": 9.0,
    "HTTPDownloadSize": 56172.0,
    "HTTPDownloadSpeed": 8582605.0,
    "HTTPDownloadTime": 6.0,
    "HTTPResponseCode": 200.0,
    "SSLConnectTime": 42.0,
    "TotalTime": 227.0,
    "curlConnectTime": 15.0,
    "curlPretransferTime": 42.0,
    "curlStarttransferTime": 143.0,
    "errorCode": 0.0,
    "redirectCount": 1.0,
    "redirectTime": 77.0,
    "tcpConnectTime": 15.0
  },
  "measurement": "aliyun_site_monitor",
  "tags": {
    "Address": "www.guance.com",
    "AgentGroup": "PC",
    "Interval": "60000",
    "TaskId": "693a16b9-xxxx",
    "TaskName": "观测云主站",
    "TaskState": "1",
    "TaskType": "HTTP",
    "areaCN": "华东",
    "areaEN": "HuaDong",
    "cityCN": "上海市",
    "cityEN": "Shanghai",
    "countryCN": "中国",
    "countryEN": "China",
    "ispCN": "阿里巴巴",
    "ispEN": "Alibaba",
    "name": "693a16b9-xxxx",
    "provinceCN": "上海市",
    "provinceEN": "Shanghai"
  },
  "timestamp": 1715052030667
}

5. 云监控调用次数说明

目前文档没有对此接口有收费说明

X. 附录

请参考阿里云官方文档: