uptimerobot.monitor.new: Add a new monitor

Description Usage Arguments Details Value Author(s) Examples

Description

uptimerobot.monitor.new creates a new monitor with the given properties.

Usage

1
2
3
uptimerobot.monitor.new(api.key, friendly.name, url, type, subtype = NULL,
  port = NULL, interval = 5, keyword.type = NULL, keyword.value = NULL,
  HTTP.username = NULL, HTTP.password = NULL, alert.contacts = NULL)

Arguments

api.key

string with a valid key for connecting to Uptimerobot API.

friendly.name

string the friendly (screen) name of the monitor.

url

string with the URL/IP of the monitor.

type

string or integer with the type of the monitor. You can use both the friendly name (string) or the index (integer) here.

subtype

string used only for "Port monitoring" to set which pre-defined port/service is monitored or if a custom port is monitored. You can use both the friendly name (string) or the index (integer) here.

port

string used only for "Port monitoring" to set the port monitored.

interval

integer with the interval for the monitoring check (in minutes).

keyword.type

required string in Keyword monitoring".

keyword.value

string with the value of the keyword (required for keyword monitoring).

HTTP.username

string used for password-protected web pages (HTTP Basic Auth). Available for HTTP and keyword monitoring.

HTTP.password

string used for password-protected web pages (HTTP Basic Auth). Available for HTTP and keyword monitoring.

alert.contacts

character vector or data frame with the IDs to alert each with their threshold and recurrence values.

Details

The alert contacts are whom to be notified when the monitor goes up/down.

Multiple alert contact IDs can be sent in a character vector or in a data frame. If you pass alert contact IDs in a vector, each element must be formatted in the form <id>_<threshold>_<recurrence> (note the underscores). If you prefer to format it as a data.frame, it must have these three columns: id, threshold, recurrence, numeric or integer. Order of the columns doesn't matter.

Please note that thresholds and recurrences can be omitted (default to zero) and, as they are only available in the Pro Plan, they are always 0 in the Free Plan.

Value

A numeric with the ID of the newly created monitor in case of success. An error is thrown otherwise.

Author(s)

Gabriele Baldassarre

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
## Not run: 
 # Let's assume the api.key is available into the environment variable KEY
 api.key <- Sys.getenv("KEY", "")

 # Create a monitor and get its monitor.id
 monitor.id <- uptimerobot.monitor.new(api.key,
   friendly.name="Open Analytics",
   url="https://gabrielebaldassarre.com", type="http"
 )

 # Change the friendly name of the monitor
  if(uptimerobot.monitor.edit(api.key,
     monitor.id,
     friendly.name="Open Analytics - gabrielebaldassarre.com"
  ){
   message("Monitor has been successfully edited!")
 }

 # Delete the just-made monitor
 if(uptimerobot.monitor.delete(api.key, monitor.id){
   message("Monitor has been successfully deleted!")
 }

## End(Not run)

uptimeRobot documentation built on May 2, 2019, 2:48 p.m.