Monitoring Policies

OneAndOne::MonitoringPolicy()

The MonitoringPolicy class allows a user to perform actions against the 1and1 API.

list(page: nil, per_page: nil, sort: nil, q: nil, fields: nil)

Return a list of all monitoring policies.

Parameters:
  • page (int) – Allows the use of pagination. Indicate which page to start on.
  • per_page (int) – Number of items per page.
  • sort (str) – sort: 'name' retrieves a list of elements sorted alphabetically. sort: 'creation_date' retrieves a list of elements sorted by their creation date in descending order.
  • q (str) – q is for query. Use this parameter to return only the items that match your search query.
  • fields (str) – Returns only the parameters requested. (i.e. fields: ‘id, name, description, hardware.ram’)
Return type:

JSON

create(name: nil, description: nil, email: nil, agent: nil, thresholds: nil, ports: nil, processes: nil)

Create a monitoring policy.

Parameters:
  • name (str) – monitoring policy name.
  • description (str) – monitoring policy description.
  • email (str) – user’s email.
  • agent (bool) – set true for using agent.
  • thresholds (hash) – a “thresholds hash” that sets warning and critical limits for cpu, ram, disk, transfer, and internal_ping.
  • ports (array) – an array of “port hashes”.
  • processes (array) – an array of “process hashes”.
Return type:

JSON

get(monitoring_policy_id: @id)

Returns a monitoring policy’s current specs.

Parameters:
  • monitoring_policy_id (str) – the unique identifier for the monitoring policy.
Return type:

JSON

modify(monitoring_policy_id: @id, name: nil, description: nil, email: nil, thresholds: nil)

Modify a monitoring policy.

Parameters:
  • monitoring_policy_id (str) – the unique identifier for the monitoring policy.
  • name (str) – monitoring policy name.
  • description (str) – monitoring policy description.
  • email (str) – user’s email.
  • thresholds (hash) – a “thresholds hash” that sets warning and critical limits for cpu, ram, disk, transfer, and internal_ping.
Return type:

JSON

delete(monitoring_policy_id: @id)

Delete a monitoring policy.

Parameters:
  • monitoring_policy_id (str) – the unique identifier for the monitoring policy.
Return type:

JSON

ports(monitoring_policy_id: @id)

List a monitoring policy’s ports.

Parameters:
  • monitoring_policy_id (str) – the unique identifier for the monitoring policy.
Return type:

JSON

add_ports(monitoring_policy_id: @id, ports: nil)

Add ports to a monitoring policy.

Parameters:
  • monitoring_policy_id (str) – the unique identifier for the monitoring policy.
  • ports (array) – an array of “port hashes”.
Return type:

JSON

port(monitoring_policy_id: @id, port_id: nil)

Returns information about a monitoring policy’s port.

Parameters:
  • monitoring_policy_id (str) – the unique identifier for the monitoring policy.
  • port_id (str) – the unique identifier for the port.
Return type:

JSON

modify_port(monitoring_policy_id: @id, port_id: nil, new_port: nil)

Modify a monitoring policy’s port.

Parameters:
  • monitoring_policy_id (str) – the unique identifier for the monitoring policy.
  • port_id (str) – the unique identifier for the port.
  • new_port (hash) – takes a “port hash”,
Return type:

JSON

delete_port(monitoring_policy_id: @id, port_id: nil)

Delete a monitoring policy’s port.

Parameters:
  • monitoring_policy_id (str) – the unique identifier for the monitoring policy.
  • port_id (str) – the unique identifier for the port.
Return type:

JSON

processes(monitoring_policy_id: @id)

List a monitoring policy’s processes.

Parameters:
  • monitoring_policy_id (str) – the unique identifier for the monitoring policy.
Return type:

JSON

process(monitoring_policy_id: @id, process_id: nil)

Returns information about a monitoring policy’s process.

Parameters:
  • monitoring_policy_id (str) – the unique identifier for the monitoring policy.
  • process_id (str) – the unique identifier for the process.
Return type:

JSON

add_processes(monitoring_policy_id: @id, processes: nil)

Add processes to a monitoring policy.

Parameters:
  • monitoring_policy_id (str) – the unique identifier for the monitoring policy.
  • processes (array) – an array of “process hashes”.
Return type:

JSON

modify_process(monitoring_policy_id: @id, process_id: nil, new_process: nil)

Modify a monitoring policy’s process.

Parameters:
  • monitoring_policy_id (str) – the unique identifier for the monitoring policy.
  • process_id (str) – the unique identifier for the process.
  • new_process (hash) – takes a “process hash”,
Return type:

JSON

delete_process(monitoring_policy_id: @id, process_id: nil)

Delete a monitoring policy’s process.

Parameters:
  • monitoring_policy_id (str) – the unique identifier for the monitoring policy.
  • process_id (str) – the unique identifier for the process.
Return type:

JSON

servers(monitoring_policy_id: @id)

List a monitoring policy’s servers.

Parameters:
  • monitoring_policy_id (str) – the unique identifier for the monitoring policy.
Return type:

JSON

server(monitoring_policy_id: @id, server_id: nil)

Returns information about a monitoring policy’s server.

Parameters:
  • monitoring_policy_id (str) – the unique identifier for the monitoring policy.
  • server_id (str) – the unique identifier for the server.
Return type:

JSON

add_servers(monitoring_policy_id: @id, servers: nil)

Add servers to a monitoring policy.

Parameters:
  • monitoring_policy_id (str) – the unique identifier for the monitoring policy.
  • servers (array) – an array of server ID strings.
Return type:

JSON

remove_server(monitoring_policy_id: @id, server_id: nil)

Remove a server from a monitoring policy.

Parameters:
  • monitoring_policy_id (str) – the unique identifier for the monitoring policy.
  • server_id (str) – the unique identifier for the server.
Return type:

JSON

wait_for()

Polls the monitoring policy until an “ACTIVE” state is returned. Use this when chaining actions.

Return type:nil