此操作(zuo)用來修改pushgateway監控配置(zhi)。
說明
不建議修改默認攜帶的label:job、集(ji)群ID、集(ji)群名稱、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 | String | 指定要修改pushgateway監控配置的HBlock服務器ID。一次可以指定多個HBlock服務器的ID,以英文逗號(,)分開。如果不填寫,默認為所有HBlock服務器修改pushgateway監控配置。 | 否 |
| pushgateway | String | 指(zhi)定pushgateway的地址和接(jie)口(kou)。 取值:格式為IPv4:port、[IPv6]:port或者domain-name:port。 | 是 |
| pushgatewayTimeout | Long | 向pushgateway發送(song)數據(ju)的超時時間(jian)。 取值:[1000, 1000000],單位為毫秒。 | 否 |
| pushgatewayLabels | Object | 指定pushgateway對應的標簽值。 取值:格式為"key":"value"。 | 否 |
| changeAll | Boolean | 修改配置(zhi)(zhi)時,以(yi)覆蓋(gai)方(fang)式(shi)更新(xin),還是以(yi)添(tian)加(jia)方(fang)式(shi)更新(xin)。主(zhu)要針對pushgatewayLabels和collectMetricItems參(can)數的設置(zhi)(zhi)。 注意 如果未指定(ding)collectMetricItems,也未指定(ding)pushgatewayLabels,則此參數不(bu)起(qi)作用。 取值:
默認(ren)值為false。 | 否 |
| collectInterval | Long | 指定采集時間間隔。 取值:負整數或(huo)[2000, 1000000]范圍的(de),單位為毫秒。 說明
| 否 |
| collectMetric | String | 指(zhi)(zhi)定采集的監控指(zhi)(zhi)標。 取(qu)值為:server、fileSystem、interface、load、disk、tcp、os。 默認采集(ji)的上述所有監(jian)控指標。 | 否 |
| collectMetricItems | Array of collectMetricItem | 指(zhi)定(ding)監控指(zhi)標下的(de)配置(zhi)項(xiang)。目前(qian)僅監控指(zhi)標disk、fileSystem、interface可以指(zhi)定(ding)配置(zhi)項(xiang)。 說明
| 否 |
請求示例1
為服(fu)務器(qi)hblock_2、hblock_3修改(gai)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
為所有服務(wu)器修改pushgateway監控(kong)配置。
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