curl --request POST \
--url https://api.qovery.com/alert-rules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"organization_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"cluster_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"description": "<string>",
"tag": "<string>",
"condition": {
"promql": "<string>",
"threshold": 123
},
"for_duration": "<string>",
"presentation": {
"summary": "<string>",
"runbook_url": "<string>"
},
"enabled": true,
"alert_receiver_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"target": {
"target_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}
'import requests
url = "https://api.qovery.com/alert-rules"
payload = {
"organization_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"cluster_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"description": "<string>",
"tag": "<string>",
"condition": {
"promql": "<string>",
"threshold": 123
},
"for_duration": "<string>",
"presentation": {
"summary": "<string>",
"runbook_url": "<string>"
},
"enabled": True,
"alert_receiver_ids": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"target": { "target_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
organization_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
cluster_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
name: '<string>',
description: '<string>',
tag: '<string>',
condition: {promql: '<string>', threshold: 123},
for_duration: '<string>',
presentation: {summary: '<string>', runbook_url: '<string>'},
enabled: true,
alert_receiver_ids: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
target: {target_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'}
})
};
fetch('https://api.qovery.com/alert-rules', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.qovery.com/alert-rules",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'organization_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'cluster_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'name' => '<string>',
'description' => '<string>',
'tag' => '<string>',
'condition' => [
'promql' => '<string>',
'threshold' => 123
],
'for_duration' => '<string>',
'presentation' => [
'summary' => '<string>',
'runbook_url' => '<string>'
],
'enabled' => true,
'alert_receiver_ids' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'target' => [
'target_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.qovery.com/alert-rules"
payload := strings.NewReader("{\n \"organization_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"cluster_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"tag\": \"<string>\",\n \"condition\": {\n \"promql\": \"<string>\",\n \"threshold\": 123\n },\n \"for_duration\": \"<string>\",\n \"presentation\": {\n \"summary\": \"<string>\",\n \"runbook_url\": \"<string>\"\n },\n \"enabled\": true,\n \"alert_receiver_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"target\": {\n \"target_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.qovery.com/alert-rules")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"organization_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"cluster_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"tag\": \"<string>\",\n \"condition\": {\n \"promql\": \"<string>\",\n \"threshold\": 123\n },\n \"for_duration\": \"<string>\",\n \"presentation\": {\n \"summary\": \"<string>\",\n \"runbook_url\": \"<string>\"\n },\n \"enabled\": true,\n \"alert_receiver_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"target\": {\n \"target_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.qovery.com/alert-rules")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"organization_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"cluster_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"tag\": \"<string>\",\n \"condition\": {\n \"promql\": \"<string>\",\n \"threshold\": 123\n },\n \"for_duration\": \"<string>\",\n \"presentation\": {\n \"summary\": \"<string>\",\n \"runbook_url\": \"<string>\"\n },\n \"enabled\": true,\n \"alert_receiver_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"target\": {\n \"target_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"source": "MANAGED",
"name": "<string>",
"state": "UNDEPLOYED",
"organization_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"cluster_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"description": "<string>",
"tag": "<string>",
"condition": {
"kind": "CUSTOM",
"promql": "<string>",
"operator": "NONE",
"threshold": 123,
"function": "NONE"
},
"for_duration": "<string>",
"severity": "LOW",
"enabled": true,
"alert_receiver_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"presentation": {
"summary": "<string>",
"runbook_url": "<string>"
},
"target": {
"target_type": " CLUSTER",
"target_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"service": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"description": "<string>",
"icon_uri": "<string>",
"service_type": "APPLICATION",
"project_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"project_name": "<string>",
"environment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"environment_name": "<string>",
"cluster_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"job_type": "CRON"
}
},
"is_up_to_date": true,
"updated_at": "2023-11-07T05:31:56Z",
"starts_at": "2023-11-07T05:31:56Z"
}Create alert rule
Create a new alert rule with PromQL expression
curl --request POST \
--url https://api.qovery.com/alert-rules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"organization_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"cluster_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"description": "<string>",
"tag": "<string>",
"condition": {
"promql": "<string>",
"threshold": 123
},
"for_duration": "<string>",
"presentation": {
"summary": "<string>",
"runbook_url": "<string>"
},
"enabled": true,
"alert_receiver_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"target": {
"target_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}
'import requests
url = "https://api.qovery.com/alert-rules"
payload = {
"organization_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"cluster_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"description": "<string>",
"tag": "<string>",
"condition": {
"promql": "<string>",
"threshold": 123
},
"for_duration": "<string>",
"presentation": {
"summary": "<string>",
"runbook_url": "<string>"
},
"enabled": True,
"alert_receiver_ids": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"target": { "target_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
organization_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
cluster_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
name: '<string>',
description: '<string>',
tag: '<string>',
condition: {promql: '<string>', threshold: 123},
for_duration: '<string>',
presentation: {summary: '<string>', runbook_url: '<string>'},
enabled: true,
alert_receiver_ids: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
target: {target_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'}
})
};
fetch('https://api.qovery.com/alert-rules', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.qovery.com/alert-rules",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'organization_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'cluster_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'name' => '<string>',
'description' => '<string>',
'tag' => '<string>',
'condition' => [
'promql' => '<string>',
'threshold' => 123
],
'for_duration' => '<string>',
'presentation' => [
'summary' => '<string>',
'runbook_url' => '<string>'
],
'enabled' => true,
'alert_receiver_ids' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'target' => [
'target_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.qovery.com/alert-rules"
payload := strings.NewReader("{\n \"organization_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"cluster_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"tag\": \"<string>\",\n \"condition\": {\n \"promql\": \"<string>\",\n \"threshold\": 123\n },\n \"for_duration\": \"<string>\",\n \"presentation\": {\n \"summary\": \"<string>\",\n \"runbook_url\": \"<string>\"\n },\n \"enabled\": true,\n \"alert_receiver_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"target\": {\n \"target_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.qovery.com/alert-rules")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"organization_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"cluster_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"tag\": \"<string>\",\n \"condition\": {\n \"promql\": \"<string>\",\n \"threshold\": 123\n },\n \"for_duration\": \"<string>\",\n \"presentation\": {\n \"summary\": \"<string>\",\n \"runbook_url\": \"<string>\"\n },\n \"enabled\": true,\n \"alert_receiver_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"target\": {\n \"target_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.qovery.com/alert-rules")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"organization_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"cluster_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"tag\": \"<string>\",\n \"condition\": {\n \"promql\": \"<string>\",\n \"threshold\": 123\n },\n \"for_duration\": \"<string>\",\n \"presentation\": {\n \"summary\": \"<string>\",\n \"runbook_url\": \"<string>\"\n },\n \"enabled\": true,\n \"alert_receiver_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"target\": {\n \"target_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"source": "MANAGED",
"name": "<string>",
"state": "UNDEPLOYED",
"organization_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"cluster_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"description": "<string>",
"tag": "<string>",
"condition": {
"kind": "CUSTOM",
"promql": "<string>",
"operator": "NONE",
"threshold": 123,
"function": "NONE"
},
"for_duration": "<string>",
"severity": "LOW",
"enabled": true,
"alert_receiver_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"presentation": {
"summary": "<string>",
"runbook_url": "<string>"
},
"target": {
"target_type": " CLUSTER",
"target_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"service": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"description": "<string>",
"icon_uri": "<string>",
"service_type": "APPLICATION",
"project_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"project_name": "<string>",
"environment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"environment_name": "<string>",
"cluster_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"job_type": "CRON"
}
},
"is_up_to_date": true,
"updated_at": "2023-11-07T05:31:56Z",
"starts_at": "2023-11-07T05:31:56Z"
}Authorizations
JWT tokens should be used with OIDC account (human to machine). JWT tokens used by the Qovery console to communicate with the API have a TTL. Curl Example ' curl https://console.qovery.com/organization -H "Authorization: Bearer $qovery_token" '
Body
Alert severity level: - LOW: Minor issues or informational alerts that don't require immediate attention. Can be addressed during normal business hours. - MEDIUM: Moderate issues that should be investigated soon but don't impact critical services. May cause degraded performance or minor service disruption. - HIGH: Serious issues affecting service quality or availability. Requires prompt attention and resolution within hours. - CRITICAL: Critical issue requiring immediate action. Service outage, data loss risk, or severe performance degradation affecting users.
LOW, MEDIUM, HIGH, CRITICAL Response
Created
- AlertRuleResponse
- AlertRuleResponse
Base schema for alert rule responses with discriminator
Alert severity level: - LOW: Minor issues or informational alerts that don't require immediate attention. Can be addressed during normal business hours. - MEDIUM: Moderate issues that should be investigated soon but don't impact critical services. May cause degraded performance or minor service disruption. - HIGH: Serious issues affecting service quality or availability. Requires prompt attention and resolution within hours. - CRITICAL: Critical issue requiring immediate action. Service outage, data loss risk, or severe performance degradation affecting users.
LOW, MEDIUM, HIGH, CRITICAL Was this page helpful?