-
Notifications
You must be signed in to change notification settings - Fork 3
Monitoring API
Methods for creating and managing service monitors.
Create a new monitor
List all monitors associated with the account
Get monitor information by ID
Update existing monitor by ID
Delete a monitor
Returns all samples for a given time period at a high level
Returns the HAR (HTTP Archive) for a given sample
Returns aggregated sample information for a given time period
Returns all of the data found when viewing your list of monitors in the portal
Returns a list of all available monitoring locations
create(string name, int interval, string locations, **kwargs)
Create a new monitor
Arguments:
name - Name of the monitor
interval - Duration for which the monitor will run from each location. Valid intervals:
1
2
3
4
5
10
15
20
30
60
locations - A list of locations to run from (comma-separated)
Keyword Arguments:
test_script - ID of the test script the monitor should run
description - Description of the monitor
alert_policy - ID of the alert policy the monitor should run
browser - Specifies the browser type (for RBU), CHROME or FF (Firefox)
active - Whether to activate the monitor after creating (True or False)
type - Set a network monitor type (leave blank for script-based monitors)
DNS
PING
SMTP
POP
PORT
dns_settings -- A JSON object containing DNS monitor settings
{
"timeout": "int",
"lookups": "array"
}The "lookups" array contains objects with the following
{
"lookupType": "string ('A' or 'AAAA')",
"authoritative": "boolean",
"hostname": "string",
"dnsServer": "string",
"expectedIps": "string of comma-separated IP addresses"
}ping_settings - A JSON object containing PING monitor settings
{
"timeout": "int",
"host": "string"
}pop_settings - A JSON object containing POP monitor settings
{
"timeout": "int",
"server": "string",
"username": "string",
"password": "string"
}port_settings - A JSON object containing PORT monitor settings
{
"timeout": "int",
"server": "string",
"port": "int",
"protocol": "string ('tcp' or 'udp')",
"command": "string",
"expected_response": "string",
"data_format": "string ('ascii' or 'raw')"
}smtp_settings - A JSON object containing SMTP monitor settings
{
"timeout": "int",
"server": "string",
"email": "string"
}Examples:
# Script
c.montior().create('My Script Monitor', 10, 'washingtondc,sanfrancisco', test_script='script_id', description='script monitor', alert_policy='policy_id', browser='CHROME', active=True)
# DNS
c.monitor().create('My DNS Monitor', 10, 'washingtondc,sanfrancisco', type='DNS', dns_settings={"timeout": 5000, "lookups": {"lookupType": "A", "authoritative": True, "hostname": "my.hostname.com", "dnsServer": "my.dnsserver.com", "expectedIps": "1.1.1.1,2.2.2.2"}}, description='dns monitor', alert_policy='policy_id', active=True)list()
List all monitors associated with the account
Example:
c.monitor().list()get()
Get monitor information by ID
Example:
c.monitor('monitor_id').get()update(**kwargs)
Update existing monitor by ID
Keyword Arguments:
name - Name of the monitor
description - Description of the monitor
interval - Duration for which the monitor will run from each location. Valid intervals:
1
2
3
4
5
10
15
20
30
60
test_script - ID of the test script the monitor should run
locations - A list of locations to run from (comma-separated)
alert_policy - ID of the alert policy the monitor should run
browser - Specifies the browser type (for RBU), CHROME or FF (Firefox)
active - Whether to activate the monitor after creating (True or False)
Example:
c.monitor('monitor_id').update(name='New Name', description='new description', interval=30, test_script='script_id', locations='bucharest,charlotte', alert_policy='policy_id', browser='FF', active=False)delete()
Delete a monitor
Example:
c.monitor('monitor_id').delete()samples(string start_date, string end_date)
Returns all samples for a given time period at a high level
Arguments:
start_date - Start date in ISO 8601 format
end_date - End date in ISO 8601 format
Example:
c.monitor('monitor_id').samples('2018-07-22', '2018-07-24')raw_sample_data(string sample_id)
Returns the HAR (HTTP Archive) for a given sample
Arguments:
sample_id - ID of the sample to retrieve
Example:
c.monitor('monitor_id').raw_sample_data('sample_id')aggregate_sample_data()
Returns aggregated sample information for a given time period
Example:
c.monitor('monitor_id').aggregate_sample_data()summary()
Returns all of the data found when viewing your list of monitors in the portal
Example:
c.monitor('monitor_id').summary()locations()
Returns a list of all available monitoring locations
Example:
c.monitor().locations()