此操作用来添加pushgateway监控配置。
请求语法
POST /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,
"pushgatewayLabels": {
"key1": "value1",
"key2": "value2",
"key3": "value3",
...
}
}
请求参数
参数 描述 是否必须 serverId 指定添加pushgateway监控配置的HBlock服务器ID。一次可以指定多个HBlock服务器的ID,以英文逗号(,)分开。如果不填写,默认为所有HBlock服务器添加pushgateway监控配置。
类型:字符串
否 pushgateway 指定pushgateway的地址和接口。
类型:字符串
取值:格式为ipv4:port、[ipv6]:port或者domain-name:port。
是 pushgatewayLabels 指定pushGateway对应的标签值。 类型:字符串
取值:格式为"key":"value"。
否
请求示例1
为服务器hblock_2、hblock_3添加pushgateway监控配置。
POST /rest/v1/system/config/monitor?serverId=hblock_3,hblock_2 HTTP/1.1
Date: Fri, 24 May 2024 02:24:01 GMT
Content-Type: application/json; charset=utf-8
Authorization: HBlock userName:signature
Content-Length: 138
Host: 192.168.0.110:1443
{
"pushgateway": "192.168.0.1:9091",
"pushgatewayLabels": {
"agent": "agentname",
"idc": "idcname"
}
}
响应示例1
HTTP/1.1 200 OK
x-hblock-request-id: 65ba83698f7742de82c2a26fcd57e6e1
Connection: keep-alive
Date: Fri, 24 May 2024 02:24:01 GMT
Server: HBlock
请求示例2
为所有服务器添加pushgateway监控配置。
POST /rest/v1/system/config/monitor HTTP/1.1
Date: Fri, 24 May 2024 02:43:57 GMT
Content-Type: application/json; charset=utf-8
Authorization: HBlock userName:signature
Content-Length: 130
Host: 192.168.0.110:1443
{
"pushgateway": "192.168.0.1:9091",
"pushgatewayLabels": {
"agent":"ctyun",
"idc": "idc8"
}
}
响应示例2
HTTP/1.1 200 OK
x-hblock-request-id: 9949f15915b24eada38615013e93ea53
Connection: keep-alive
Date: Fri, 24 May 2024 02:43:57 GMT
Server: HBlock