curl --request POST \
--url https://sreagent.app/api/v1/config/certificate_monitors \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"hostname": "<string>",
"check_interval_hours": 123,
"critical_days_before": 123,
"port": 123,
"warn_days_before": 123
}
'import requests
url = "https://sreagent.app/api/v1/config/certificate_monitors"
payload = {
"hostname": "<string>",
"check_interval_hours": 123,
"critical_days_before": 123,
"port": 123,
"warn_days_before": 123
}
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({
hostname: '<string>',
check_interval_hours: 123,
critical_days_before: 123,
port: 123,
warn_days_before: 123
})
};
fetch('https://sreagent.app/api/v1/config/certificate_monitors', 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://sreagent.app/api/v1/config/certificate_monitors",
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([
'hostname' => '<string>',
'check_interval_hours' => 123,
'critical_days_before' => 123,
'port' => 123,
'warn_days_before' => 123
]),
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://sreagent.app/api/v1/config/certificate_monitors"
payload := strings.NewReader("{\n \"hostname\": \"<string>\",\n \"check_interval_hours\": 123,\n \"critical_days_before\": 123,\n \"port\": 123,\n \"warn_days_before\": 123\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://sreagent.app/api/v1/config/certificate_monitors")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"hostname\": \"<string>\",\n \"check_interval_hours\": 123,\n \"critical_days_before\": 123,\n \"port\": 123,\n \"warn_days_before\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sreagent.app/api/v1/config/certificate_monitors")
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 \"hostname\": \"<string>\",\n \"check_interval_hours\": 123,\n \"critical_days_before\": 123,\n \"port\": 123,\n \"warn_days_before\": 123\n}"
response = http.request(request)
puts response.read_body{
"error": "<string>",
"message": "<string>"
}Create a certificate monitor
Watch a hostname’s TLS certificate. The platform opens a TLS connection to hostname:port every check_interval_hours, records what it found, and raises an alert once the certificate is within warn_days_before of expiry and a sharper one within critical_days_before. It alerts on a certificate that fails verification too, whatever its expiry date says: an untrusted chain or a wrong-host certificate is already failing for everything that checks one. warn_days_before must be greater than critical_days_before, or a certificate between the two would be announced as the milder of the two problems. A host on a private, loopback or otherwise non-public address is refused, because a monitor is a standing instruction to dial it unattended. The first check runs on the next scheduled check; check_certificate_now runs one at once. Included in the Business and Enterprise plans.
curl --request POST \
--url https://sreagent.app/api/v1/config/certificate_monitors \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"hostname": "<string>",
"check_interval_hours": 123,
"critical_days_before": 123,
"port": 123,
"warn_days_before": 123
}
'import requests
url = "https://sreagent.app/api/v1/config/certificate_monitors"
payload = {
"hostname": "<string>",
"check_interval_hours": 123,
"critical_days_before": 123,
"port": 123,
"warn_days_before": 123
}
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({
hostname: '<string>',
check_interval_hours: 123,
critical_days_before: 123,
port: 123,
warn_days_before: 123
})
};
fetch('https://sreagent.app/api/v1/config/certificate_monitors', 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://sreagent.app/api/v1/config/certificate_monitors",
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([
'hostname' => '<string>',
'check_interval_hours' => 123,
'critical_days_before' => 123,
'port' => 123,
'warn_days_before' => 123
]),
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://sreagent.app/api/v1/config/certificate_monitors"
payload := strings.NewReader("{\n \"hostname\": \"<string>\",\n \"check_interval_hours\": 123,\n \"critical_days_before\": 123,\n \"port\": 123,\n \"warn_days_before\": 123\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://sreagent.app/api/v1/config/certificate_monitors")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"hostname\": \"<string>\",\n \"check_interval_hours\": 123,\n \"critical_days_before\": 123,\n \"port\": 123,\n \"warn_days_before\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sreagent.app/api/v1/config/certificate_monitors")
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 \"hostname\": \"<string>\",\n \"check_interval_hours\": 123,\n \"critical_days_before\": 123,\n \"port\": 123,\n \"warn_days_before\": 123\n}"
response = http.request(request)
puts response.read_body{
"error": "<string>",
"message": "<string>"
}Authorizations
Body
Response
Created.
Was this page helpful?