Feature/115 page environment catalogue des probes
Add API RPCs to allow web dev on #115 (closed) :
rpc ListProbes(ListProbesRequest) returns (ListProbesResponse)
$ curl -s -H "agent:9e82e551-ccee-489a-a4c8-81329e70a8a3" -H "api-key:f90d9d23-b0cf-410a-b1cc-d0f8678f8b8b" -XGET 'http://127.0.0.1:7576/v1/probes' | jq .
{
"probes": [
{
"name": "probes/xUkSnG_BSVCn-AX1khPLYg",
"probe_name": "ping",
"display_name": "Ping",
"description": "ICMP for the masses",
"parameters": [
{
"param_name": "count",
"type": "int"
},
{
"param_name": "interval",
"type": "int"
}
]
}
],
"next_page_token": "AAAAAAAAAAAAAAAAAQAAAA"
}
rpc ListChecks(ListChecksRequest) returns (ListChecksResponse)
$ curl -s -H "agent:9e82e551-ccee-489a-a4c8-81329e70a8a3" -H "api-key:f90d9d23-b0cf-410a-b1cc-d0f8678f8b8b" -XGET 'http://127.0.0.1:7576/v1/checks/targets/MQF0eIJcRZyEBgG_sdLPWA' | jq .
{
"checks": [
{
"name": "checks/i2QYtZBVSnuXjLhQhuAV6w",
"target": "targets/MQF0eIJcRZyEBgG_sdLPWA",
"probe": "probes/xUkSnG_BSVCn-AX1khPLYg",
"state_definition": "threshold",
"state_values": "{\"states\": [{\"state\": \"critical\",\"match\": \"any\",\"conditions\": [{\"field\": \"rtt\",\"operator\": \"gt\",\"value\": 2,\"reason\": \"way too high\"},{\"field\": \"rtt\",\"operator\": \"le\",\"value\": 0,\"reason\": \"too small to be true\"}]}]}"
}
],
"next_page_token": "AAAAAAAAAAAAAAAAAQAAAA"
}
rpc GetCheck(GetCheckRequest) returns (Check)
$ curl -s -H "agent:9e82e551-ccee-489a-a4c8-81329e70a8a3" -H "api-key:f90d9d23-b0cf-410a-b1cc-d0f8678f8b8b" -XGET 'http://127.0.0.1:7576/v1/checks/i2QYtZBVSnuXjLhQhuAV6w' | jq .
{
"name": "checks/i2QYtZBVSnuXjLhQhuAV6w",
"target": "targets/MQF0eIJcRZyEBgG_sdLPWA",
"probe": "probes/xUkSnG_BSVCn-AX1khPLYg",
"state_definition": "threshold",
"state_values": "{\"states\": [{\"state\": \"critical\",\"match\": \"any\",\"conditions\": [{\"field\": \"rtt\",\"operator\": \"gt\",\"value\": 2,\"reason\": \"way too high\"},{\"field\": \"rtt\",\"operator\": \"le\",\"value\": 0,\"reason\": \"too small to be true\"}]}]}"
}
Edited by Julien Andrieux