此操作用来修改pushgateway监控配置。
说明
不建议修改默认携带的label:job、集群ID、集群名称、ServerIP、hostname。
请求语法
PUT /rest/v1/system/config/monitor?serverId=serverid1,serverid2,serveridN HTTP/1.1
Date: date
Content-Type: application/json; charset=utf-8
Content-Length: length
Host: ip:port
Authorization: authorization
{
"pushgateway":address:port,
"pushgatewayTimeout":pushgatewayTimeout,
"pushgatewayLabels": {
"key1": "value1",
"key2": "value2",
"key3": "value3",
...
},
"changeAll": changeAll,
"collectInterval": collectInterval,
"collectMetric": name,
"collectMetricItems": [
"item1",
"item2",
"item3",
...
],
}
请求参数
参数 | 描述 | 是否必须 |
---|---|---|
serverId | 指定要修改pushgateway监控配置的HBlock服务器ID。一次可以指定多个HBlock服务器的ID,以英文逗号(,)分开。如果不填写,默认为所有HBlock服务器修改pushgateway监控配置。 类型:字符串 | 否 |
pushgateway | 指定pushgateway的地址和接口。 类型:字符串 取值:格式为IPv4:port、[IPv6]:port或者domain-name:port。 | 否 |
pushgatewayTimeout | 向pushgateway发送数据的超时时间。 类型:长整型 取值:[1000, 1000000],单位为毫秒。 | 否 |
pushgatewayLabels | 指定pushGateway对应的标签值。 类型:字符串 取值:格式为"key":"value"。 | 否 |
changeAll | 修改配置时,以覆盖方式更新,还是以添加方式更新。主要针对pushgatewayLabels和collectMetricItems参数的设置。 注意 如果未指定collectMetricItems,也未指定pushgatewayLabels,则此参数不起作用。 类型:布尔 取值:
默认值为false。 | 否 |
collectInterval | 指定采集时间间隔。 类型:长整型 取值:负整数或[2000, 1000000]范围的,单位为毫秒。 说明
| 否 |
collectMetric | 指定采集的监控指标。 类型:枚举 取值为:server、fileSystem、interface、load、disk、tcp、os。 默认采集的上述所有监控指标。 | 否 |
collectMetricItems | 指定监控指标下的配置项。目前仅监控指标disk、fileSystem、interface可以指定配置项。 说明
类型:字符串 | 否 |
请求示例1
为服务器hblock_2、hblock_3修改pushgateway监控配置。
PUT /rest/v1/system/config/monitor?serverId=hblock_3,hblock_2 HTTP/1.1
Date: Fri, 24 May 2024 02: 59: 53 GMT
Content-Type: application/json; charset=utf-8
Authorization: HBlock userName:signature
Content-Length: 317
Host: 192.168.0.110: 1443
{
"pushgateway": "192.168.0.1:9091",
"pushgatewayTimeout": 3000,
"pushgatewayLabels": {
"agent": "ctyunoos",
"idc": "2"
},
"changeAll": true,
"collectInterval": 5000,
"collectMetric": "disk",
"collectMetricItems": [
"tmpfs",
"cgroup"
]
}
响应示例1
HTTP/1.1 204 No Content
x-hblock-request-id: a097237d448f4371a8838df64e753f3e
Connection: keep-alive
Date: Fri, 24 May 2024 02:59:53 GMT
Server: HBlock
请求示例2
为所有服务器修改pushgateway监控配置。
PUT /rest/v1/system/config/monitor HTTP/1.1
Date: Fri, 24 May 2024 05:55:52 GMT
Content-Type: application/json; charset=utf-8
Authorization: HBlock userName:signature
Content-Length: 318
Host: 192.168.0.110:1443
{
"pushgateway": "192.168.0.1:9091",
"pushgatewayTimeout": 3000,
"pushgatewayLabels": {
"agent": "ctyun",
"idc": "3"
},
"changeAll": false,
"collectInterval": 5000,
"collectMetric": "disk",
"collectMetricItems": [
"pstore",
"devpts"
]
}
响应示例2
HTTP/1.1 204 No Content
x-hblock-request-id: 860024bc04814789b55f9d662914922a
Connection: keep-alive
Date: Fri, 24 May 2024 05:55:52 GMT
Server: HBlock