monitors
Creates, updates, deletes, gets or lists a monitors resource.
Overview
| Name | monitors |
| Type | Resource |
| Id | aws.networkmonitor.monitors |
Fields
The following fields are returned by SELECT queries:
- get_monitor
- list_monitors
| Name | Datatype | Description |
|---|---|---|
aggregation_period | integer (int64) | The aggregation period for the specified monitor. |
created_at | string (date-time) | The time and date when the monitor was created. |
modified_at | string (date-time) | The time and date when the monitor was last modified. |
monitor_arn | string | The ARN of the selected monitor. (pattern: <code>arn:.*</code>) |
monitor_name | string | The name of the monitor. (pattern: <code>[a-zA-Z0-9_-]+</code>) |
probes | array | The details about each probe associated with that monitor. |
state | string | Lists the status of the state of each monitor. (PENDING, ACTIVE, INACTIVE, ERROR, DELETING) |
tags | object | The list of key-value pairs assigned to the monitor. |
| Name | Datatype | Description |
|---|---|---|
aggregation_period | integer (int64) | The time, in seconds, that metrics are collected and sent to Amazon CloudWatch. Valid values are either 30 or 60. |
monitor_arn | string | The ARN of the monitor. (pattern: <code>arn:.*</code>) |
monitor_name | string | The name of the monitor. (pattern: <code>[a-zA-Z0-9_-]+</code>) |
state | string | The state of the monitor. (PENDING, ACTIVE, INACTIVE, ERROR, DELETING) |
tags | object | The list of key-value pairs assigned to the monitor. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_monitor | select | monitor_name, region | Returns details about a specific monitor. This action requires the monitorName parameter. Run ListMonitors to get a list of monitor names. | |
list_monitors | select | region | nextToken, maxResults, state | Returns a list of all of your monitors. |
create_monitor | insert | region, monitorName | Creates a monitor between a source subnet and destination IP address. Within a monitor you'll create one or more probes that monitor network traffic between your source Amazon Web Services VPC subnets and your destination IP addresses. Each probe then aggregates and sends metrics to Amazon CloudWatch. You can also create a monitor with probes using this command. For each probe, you define the following: source—The subnet IDs where the probes will be created. destination— The target destination IP address for the probe. destinationPort—Required only if the protocol is TCP. protocol—The communication protocol between the source and destination. This will be either TCP or ICMP. packetSize—The size of the packets. This must be a number between 56 and 8500. (Optional) tags —Key-value pairs created and assigned to the probe. | |
update_monitor | update | monitor_name, region, aggregationPeriod | Updates the aggregationPeriod for a monitor. Monitors support an aggregationPeriod of either 30 or 60 seconds. This action requires the monitorName and probeId parameter. Run ListMonitors to get a list of monitor names. | |
delete_monitor | delete | monitor_name, region | Deletes a specified monitor. This action requires the monitorName parameter. Run ListMonitors to get a list of monitor names. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
monitor_name | string | The name of the monitor to delete. |
region | string | AWS region (default: us-east-1) |
maxResults | integer | The maximum number of results to return with a single call. To retrieve the remaining results, make another call with the returned nextToken value. If MaxResults is given a value larger than 100, only 100 results are returned. |
nextToken | string | The token for the next page of results. |
state | string | The list of all monitors and their states. |
SELECT examples
- get_monitor
- list_monitors
Returns details about a specific monitor. This action requires the monitorName parameter. Run ListMonitors to get a list of monitor names.
SELECT
aggregation_period,
created_at,
modified_at,
monitor_arn,
monitor_name,
probes,
state,
tags
FROM aws.networkmonitor.monitors
WHERE monitor_name = '{{ monitor_name }}' -- required
AND region = '{{ region }}' -- required
;
Returns a list of all of your monitors.
SELECT
aggregation_period,
monitor_arn,
monitor_name,
state,
tags
FROM aws.networkmonitor.monitors
WHERE region = '{{ region }}' -- required
AND nextToken = '{{ nextToken }}'
AND maxResults = '{{ maxResults }}'
AND state = '{{ state }}'
;
INSERT examples
- create_monitor
- Manifest
Creates a monitor between a source subnet and destination IP address. Within a monitor you'll create one or more probes that monitor network traffic between your source Amazon Web Services VPC subnets and your destination IP addresses. Each probe then aggregates and sends metrics to Amazon CloudWatch. You can also create a monitor with probes using this command. For each probe, you define the following: source—The subnet IDs where the probes will be created. destination— The target destination IP address for the probe. destinationPort—Required only if the protocol is TCP. protocol—The communication protocol between the source and destination. This will be either TCP or ICMP. packetSize—The size of the packets. This must be a number between 56 and 8500. (Optional) tags —Key-value pairs created and assigned to the probe.
INSERT INTO aws.networkmonitor.monitors (
monitorName,
probes,
aggregationPeriod,
clientToken,
tags,
region
)
SELECT
'{{ monitorName }}' /* required */,
'{{ probes }}',
{{ aggregationPeriod }},
'{{ clientToken }}',
'{{ tags }}',
'{{ region }}'
RETURNING
aggregation_period,
monitor_arn,
monitor_name,
state,
tags
;
# Description fields are for documentation purposes
- name: monitors
props:
- name: region
value: "{{ region }}"
description: Required parameter for the monitors resource.
- name: monitorName
value: "{{ monitorName }}"
- name: probes
value:
- sourceArn: "{{ sourceArn }}"
destination: "{{ destination }}"
destinationPort: {{ destinationPort }}
protocol: "{{ protocol }}"
packetSize: {{ packetSize }}
probeTags: "{{ probeTags }}"
- name: aggregationPeriod
value: {{ aggregationPeriod }}
- name: clientToken
value: "{{ clientToken }}"
- name: tags
value: "{{ tags }}"
UPDATE examples
- update_monitor
Updates the aggregationPeriod for a monitor. Monitors support an aggregationPeriod of either 30 or 60 seconds. This action requires the monitorName and probeId parameter. Run ListMonitors to get a list of monitor names.
UPDATE aws.networkmonitor.monitors
SET
aggregationPeriod = {{ aggregationPeriod }}
WHERE
monitor_name = '{{ monitor_name }}' --required
AND region = '{{ region }}' --required
AND aggregationPeriod = '{{ aggregationPeriod }}' --required
RETURNING
aggregation_period,
monitor_arn,
monitor_name,
state,
tags;
DELETE examples
- delete_monitor
Deletes a specified monitor. This action requires the monitorName parameter. Run ListMonitors to get a list of monitor names.
DELETE FROM aws.networkmonitor.monitors
WHERE monitor_name = '{{ monitor_name }}' --required
AND region = '{{ region }}' --required
;