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
- page (
-
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 forcpu
,ram
,disk
,transfer
, andinternal_ping
. - ports (
array
) – an array of “port hashes”. - processes (
array
) – an array of “process hashes”.
Return type: JSON
- name (
-
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
- monitoring_policy_id (
-
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 forcpu
,ram
,disk
,transfer
, andinternal_ping
.
Return type: JSON
- monitoring_policy_id (
-
delete
(monitoring_policy_id: @id)¶ Delete a monitoring policy.
Parameters: - monitoring_policy_id (
str
) – the unique identifier for the monitoring policy.
Return type: JSON
- monitoring_policy_id (
-
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
- monitoring_policy_id (
-
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
- monitoring_policy_id (
-
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
- monitoring_policy_id (
-
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
- monitoring_policy_id (
-
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
- monitoring_policy_id (
-
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
- monitoring_policy_id (
-
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
- monitoring_policy_id (
-
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
- monitoring_policy_id (
-
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
- monitoring_policy_id (
-
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
- monitoring_policy_id (
-
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
- monitoring_policy_id (
-
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
- monitoring_policy_id (
-
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
- monitoring_policy_id (
-
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
- monitoring_policy_id (
-
wait_for
()¶ Polls the monitoring policy until an “ACTIVE” state is returned. Use this when chaining actions.
Return type: nil
-