Skip to content

Feature/122 page alert edition d une alerte

GetAlert

$ curl -s -H "agent:9e82e551-ccee-489a-a4c8-81329e70a8a3" -H "api-key:f90d9d23-b0cf-410a-b1cc-d0f8678f8b8b" -H "Content-Type: application/json" -XGET 'http://127.0.0.1:7576/v1/organizations/kDtJz8EqQ0C7KgOF6qwxfg/alerts/UBSPqhapR7CCNmZS0dYv7Q' | jq '.'
{
  "name": "alerts/UBSPqhapR7CCNmZS0dYv7Q",
  "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\"}]}]}"
    }
  ],
  "channel": "channels/AAAAAAAAAAAAAAAAAAAAAA",
  "definition": "state_recurrence",
  "parameters": {
    "recurrence": {
      "@type": "type.googleapis.com/google.protobuf.DoubleValue",
      "value": 5
    }
  }
}

UpdateAlert

Changing Parameters

$ curl -s -H "agent:9e82e551-ccee-489a-a4c8-81329e70a8a3" -H "api-key:f90d9d23-b0cf-410a-b1cc-d0f8678f8b8b" -H "Content-Type: application/json" -XPUT 'http://127.0.0.1:7576/v1/organizations/kDtJz8EqQ0C7KgOF6qwxfg/alerts/UBSPqhapR7CCNmZS0dYv7Q' -d '{"update_mask": {"paths": ["parameters"]},"alert": {"name": "organizations/kDtJz8EqQ0C7KgOF6qwxfg/alerts/UBSPqhapR7CCNmZS0dYv7Q","parameters": {"recurrence": {"@type": "type.googleapis.com/google.protobuf.DoubleValue","value": 3}}}}' | jq '.'
{
  "name": "organizations/kDtJz8EqQ0C7KgOF6qwxfg/alerts/UBSPqhapR7CCNmZS0dYv7Q",
  "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\"}]}]}"
    }
  ],
  "channel": "channels/5VnnFdt9QCOnvpZZI_rDbA",
  "definition": "state_recurrence",
  "parameters": {
    "recurrence": {
      "@type": "type.googleapis.com/google.protobuf.DoubleValue",
      "value": 3
    }
  }
}

Changing Channel

$ curl -s -H "agent:9e82e551-ccee-489a-a4c8-81329e70a8a3" -H "api-key:f90d9d23-b0cf-410a-b1cc-d0f8678f8b8b" -H "Content-Type: application/json" -XPUT 'http://127.0.0.1:7576/v1/organizations/kDtJz8EqQ0C7KgOF6qwxfg/alerts/UBSPqhapR7CCNmZS0dYv7Q' -d '{"update_mask": {"paths": ["channel"]},"alert": {"name": "organizations/kDtJz8EqQ0C7KgOF6qwxfg/alerts/UBSPqhapR7CCNmZS0dYv7Q","channel": "channels/ZeRDBCy_TMe69DTjwLkHCQ"}}' | jq '.'
{
  "name": "organizations/kDtJz8EqQ0C7KgOF6qwxfg/alerts/UBSPqhapR7CCNmZS0dYv7Q",
  "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\"}]}]}"
    }
  ],
  "channel": "channels/ZeRDBCy_TMe69DTjwLkHCQ",
  "definition": "state_recurrence",
  "parameters": {
    "recurrence": {
      "@type": "type.googleapis.com/google.protobuf.DoubleValue",
      "value": 3
    }
  }
}

Changing Checks

$ curl -s -H "agent:9e82e551-ccee-489a-a4c8-81329e70a8a3" -H "api-key:f90d9d23-b0cf-410a-b1cc-d0f8678f8b8b" -H "Content-Type: application/json" -XPUT 'http://127.0.0.1:7576/v1/organizations/kDtJz8EqQ0C7KgOF6qwxfg/alerts/UBSPqhapR7CCNmZS0dYv7Q' -d '{"update_mask": {"paths": ["checks"]},"alert": {"name": "organizations/kDtJz8EqQ0C7KgOF6qwxfg/alerts/UBSPqhapR7CCNmZS0dYv7Q","checks": [{"name": "checks/n3_6ZVOlRPGVOHwHb3fi4Q"}]}}' | jq '.'
{
  "name": "organizations/kDtJz8EqQ0C7KgOF6qwxfg/alerts/UBSPqhapR7CCNmZS0dYv7Q",
  "checks": [
    {
      "name": "checks/n3_6ZVOlRPGVOHwHb3fi4Q",
      "target": "targets/MQF0eIJcRZyEBgG_sdLPWA",
      "probe": "probes/xUkSnG_BSVCn-AX1khPLYg",
      "state_definition": "history",
      "state_values": "{}"
    }
  ],
  "channel": "channels/ZeRDBCy_TMe69DTjwLkHCQ",
  "definition": "state_recurrence",
  "parameters": {
    "recurrence": {
      "@type": "type.googleapis.com/google.protobuf.DoubleValue",
      "value": 3
    }
  }
}

Changing Checks and Channel

$ curl -s -H "agent:9e82e551-ccee-489a-a4c8-81329e70a8a3" -H "api-key:f90d9d23-b0cf-410a-b1cc-d0f8678f8b8b" -H "Content-Type: application/json" -XPUT 'http://127.0.0.1:7576/v1/organizations/kDtJz8EqQ0C7KgOF6qwxfg/alerts/UBSPqhapR7CCNmZS0dYv7Q' -d '{"update_mask": {"paths": ["checks","channel"]},"alert": {"name": "organizations/kDtJz8EqQ0C7KgOF6qwxfg/alerts/UBSPqhapR7CCNmZS0dYv7Q","checks": [{"name": "checks/i2QYtZBVSnuXjLhQhuAV6w"}],"channel": "channels/5VnnFdt9QCOnvpZZI_rDbA"}}' | jq '.'
{
  "name": "organizations/kDtJz8EqQ0C7KgOF6qwxfg/alerts/UBSPqhapR7CCNmZS0dYv7Q",
  "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\"}]}]}"
    }
  ],
  "channel": "channels/5VnnFdt9QCOnvpZZI_rDbA",
  "definition": "state_recurrence",
  "parameters": {
    "recurrence": {
      "@type": "type.googleapis.com/google.protobuf.DoubleValue",
      "value": 3
    }
  }
}
Edited by Julien Andrieux

Merge request reports