module Zeus::AlertsInterface
Interface for dealing with alerts api calls
Public Instance Methods
create alert @param [Hash] alert_data must contain:
@param [String] alert_name name of the alert @param [String] username account username @param [String] token account token @param [String] alerts_type alert type, metrics or logs @param [String] alert_expression expression to evaluate the alert @param [String] alert_severity severity level of the alert @param [String] metric_name <TODO add description> @param [String] emails recipients to receive notifications @param [String] status if the alerts is enabled or not @param [Integer] frequency <TODO add description>
@return [Zeus::APIClient::Result]
# File lib/zeus/api_client/alerts_interface.rb, line 40 def create_alert(alert_data) alert_data[:token] = @access_token response = post("/alerts/#{@access_token}", alert_data) Result.new(response) rescue => e Result.new(e.response) end
delete alert @param [Integer] alert_id id of alert to be deleted @return [Zeus::APIClient::Result]
# File lib/zeus/api_client/alerts_interface.rb, line 101 def delete_alert(alert_id) response = delete("/alerts/#{@access_token}/#{alert_id}") Result.new(response) rescue => e Result.new(e.response) end
disable alerts @param [Array] alert_id_list list of alert ids to be disabled @return [Zeus::APIClient::Result]
# File lib/zeus/api_client/alerts_interface.rb, line 126 def disable_alerts(alert_id_array) params = { id: alert_id_array } begin response = post("/alerts/#{@access_token}/disable", params) Result.new(response) rescue => e Result.new(e.response) end end
enable alerts @param [Array] alert_id_list list of alert ids to be enabled @return [Zeus::APIClient::Result]
# File lib/zeus/api_client/alerts_interface.rb, line 112 def enable_alerts(alert_id_array) params = { id: alert_id_array } begin response = post("/alerts/#{@access_token}/enable", params) Result.new(response) rescue => e Result.new(e.response) end end
get alert @param [Integer] alert_id id of alert to be retrieved @return [Zeus::APIClient::Result]
# File lib/zeus/api_client/alerts_interface.rb, line 90 def get_alert(alert_id) response = get("/alerts/#{@access_token}/#{alert_id}") Result.new(response) rescue => e Result.new(e.response) end
get alerts @param [String] metric Name of metric that alerts are associated with @return [Zeus::APIClient::Result]
# File lib/zeus/api_client/alerts_interface.rb, line 76 def get_alerts(metric = nil) params = { metric: metric } begin response = get("/alerts/#{@access_token}", params) Result.new(response) rescue => e Result.new(e.response) end end
modify alert @param [Integer] alert_id id of the alert to be modified @param [Hash] alert_data must contain:
@param [String] alert_name name of the alert @param [String] username account username @param [String] token account token @param [String] alert_expression expression to evaluate the alert Optional params: @param [String] alerts_type alert type, metrics or logs @param [String] alert_severity severity level of the alert @param [String] metric_name <TODO add description> @param [String] emails recipients to receive notifications @param [String] status if the alerts is enabled or not @param [Integer] frequency <TODO add description>
@return [Zeus::APIClient::Result]
# File lib/zeus/api_client/alerts_interface.rb, line 64 def modify_alert(alert_id, alert_data) alert_data[:token] = @access_token response = put("/alerts/#{@access_token}/#{alert_id}", alert_data) Result.new(response) rescue => e Result.new(e.response) end