Spaces method and path for this operation:
Refer to Spaces for more information.
Update a monitor with the specified attributes. The required and default fields may vary based on the monitor type.
You must have all privileges for the Synthetics feature in the Observability section of the Kibana feature privileges.
You can also partially update a monitor.
This will only update the fields that are specified in the request body.
All other fields are left unchanged.
The specified fields should conform to the monitor type.
For example, you can't update the inline_script field of a HTTP monitor.
[Required authorization] Route required privileges: uptime-read AND uptime-write.
Path parameters
-
The identifier for the monitor that you want to update.
Minimum length is
1, maximum length is1024.
Body
-
The alert configuration. The default is
{ status: { enabled: true }, tls: { enabled: true } }.Additional properties are allowed.
-
PEM certificates whose public keys (SPKI) are allowlisted so Chromium bypasses certificate errors for matching presented certificates. This does not add a CA to Chromium's trust store.
-
The check request settings, as nested
requestandresponseobjects. -
Optional request body content.
-
A dictionary of additional HTTP headers to send. By default, Synthetics sets the User-Agent header to identify itself.
-
The HTTP method to use:
HEAD,GET,POST, orOPTIONS. -
A dictionary of expected HTTP headers. If the header is not found, the check fails.
-
Specify whether the monitor is enabled. Defaults to
true. -
The host to monitor; it can be an IP address or a hostname.
Maximum length is
4096. -
Ignore HTTPS errors. Defaults to
false. -
The inline script.
Maximum length is
1000000. -
If
true, ping using the ipv4 protocol. Defaults totrue. -
If
true, ping using the ipv6 protocol. Defaults totrue. -
Key-value pairs of labels to associate with the monitor. Labels can be used for filtering and grouping monitors.
-
The Elastic-managed locations to deploy the monitor to. Monitors can be deployed in multiple locations so that you can detect differences in availability and response times across those locations. To list available locations, run the
elastic-synthetics locationscommand with the deployment's Kibana URL, or go to Synthetics > Management and click Create monitor.You can provide
locationsorprivate_locationsor both. At least one is required.Not more than
1000elements. -
The IDs of the maintenance windows to apply to the monitor.
Not more than
1000elements. Maximum length of each is1024. -
The mode of the monitor. If it is
all, the monitor pings all resolvable IPs for a hostname. If it isany, the monitor pings only one IP address for a hostname. If you're using a DNS-load balancer and want to ping every IP address for the specified hostname, useall. Defaults toany.Values are
anyorall. -
The monitor name.
Maximum length is
4096. -
The namespace field should be lowercase and not contain spaces. The namespace must not include any of the following characters:
*,\,/,?,",<,>,|, whitespace,,,#,:, or-. Defaults todefault. -
The password for authenticating with the server. The credentials are passed with the request.
-
Playwright options.
-
The private locations to deploy the monitor to. These locations are hosted and managed by you, whereas
locationsare hosted by Elastic. You can specify a private location using the location's name. To list available private locations, run theelastic-synthetics locationscommand with the deployment's Kibana URL, or go to Synthetics > Settings and click Private locations.Not more than
1000elements. -
Additional headers to send to proxies during CONNECT requests.
-
The URL of the proxy to use for this monitor.
-
Specify that hostnames are resolved locally instead of being resolved on the proxy server. If
false, name resolution occurs on the proxy server. Defaults tofalse. -
Controls the indexing of the HTTP response body contents to the
http.response.body.contentsfield. -
Turn retesting for when a monitor fails on or off. By default, monitors are automatically retested if the monitor goes from "up" to "down". If the result of the retest is also "down", an error is created and, if configured, an alert is sent. Using
retest_on_failurecan reduce noise related to transient problems. -
The screenshot option:
on,off, oronly-on-failure. Defaults toon. -
The APM service name.
-
The IDs of additional spaces to make the monitor available in, besides the current space.
Not more than
1000elements. Maximum length of each is1024. -
The TLS/SSL connection settings for use with the HTTPS endpoint. If you don't specify settings, the system defaults are used.
-
Synthetics agent CLI arguments.
- timeout
string | null | number The monitor timeout in seconds. The monitor fails if it doesn't complete within this time. Defaults to
16.For browser monitors, the minimum timeout is 30 seconds. Browser monitor timeouts only apply on private locations; on public locations the timeout has no effect and the response includes a warning.
-
Values are
http,tcp,icmp,browser, orapi. -
The URL to monitor.
Maximum length is
4096. -
The username for authenticating with the server. The credentials are passed with the request.
-
The wait time in seconds. Defaults to
1.
curl \
-X PUT "${KIBANA_URL}/api/synthetics/monitors/monitor-id" \
-H "Authorization: ApiKey ${API_KEY}" \
-H "kbn-xsrf: true" \
-H "Content-Type: application/json" \
-d '{"type":"http","name":"Website Availability","url":"https://example.com","tags":["website","availability"],"locations":["united_kingdom"]}'
PUT kbn://api/synthetics/monitors/monitor-id
{"type":"http","name":"Website Availability","url":"https://example.com","tags":["website","availability"],"locations":["united_kingdom"]}
{
"locations": [
"united_kingdom"
],
"name": "Website Availability",
"tags": [
"website",
"availability"
],
"type": "http",
"url": "https://example.com"
}
{
"host": "example.com",
"name": "Server Availability",
"private_locations": [
"my_private_location"
],
"type": "tcp"
}
{
"host": "example.com",
"locations": [
"united_kingdom"
],
"name": "Ping Test",
"type": "icmp"
}
{
"inline_script": "step('Go to https://google.com.co', () => page.goto('https://www.google.com'))",
"locations": [
"united_kingdom"
],
"name": "Example journey",
"type": "browser"
}
{
"enabled": false
}
{
"enabled": true,
"name": "Example journey",
"type": "browser",
"warnings": [
{
"id": "monitor-id",
"message": "For browser monitors, timeout is only supported on private locations. Browser monitor \"Example journey\" specifies a timeout and is running on public locations: \"public-1, public-2\". The timeout will have no effect on these locations.",
"publicLocationIds": [
"public-1",
"public-2"
]
}
]
}