class Dogapi::V1::MonitorService
Constants
- API_VERSION
Public Instance Methods
cancel_downtime(downtime_id)
click to toggle source
# File lib/dogapi/v1/monitor.rb, line 203 def cancel_downtime(downtime_id) begin params = { :api_key => @api_key, :application_key => @application_key } request(Net::HTTP::Delete, "/api/#{API_VERSION}/downtime/#{downtime_id}", params, nil, false) rescue Exception => e suppress_error_if_silent e end end
delete_monitor(monitor_id)
click to toggle source
# File lib/dogapi/v1/monitor.rb, line 63 def delete_monitor(monitor_id) begin params = { :api_key => @api_key, :application_key => @application_key } request(Net::HTTP::Delete, "/api/#{API_VERSION}/monitor/#{monitor_id}", params, nil, false) rescue Exception => e suppress_error_if_silent e end end
get_all_downtimes(options = {})
click to toggle source
# File lib/dogapi/v1/monitor.rb, line 216 def get_all_downtimes(options = {}) begin params = { :api_key => @api_key, :application_key => @application_key } if options[:current_only] params[:current_only] = options[:current_only] options.delete :current_only end request(Net::HTTP::Get, "/api/#{API_VERSION}/downtime", params, nil, false) rescue Exception => e suppress_error_if_silent e end end
get_all_monitors(options = {})
click to toggle source
# File lib/dogapi/v1/monitor.rb, line 76 def get_all_monitors(options = {}) begin params = { :api_key => @api_key, :application_key => @application_key } # :group_states is an optional list of statuses to filter returned # groups. If no value is given then no group states will be returned. # Possible values are: "all", "ok", "warn", "alert", "no data". if options[:group_states] params[:group_states] = options[:group_states] params[:group_states] = params[:group_states].join(',') if params[:group_states].respond_to?(:join) end # :tags is an optional list of scope tags to filter the list of monitors # returned. If no value is given, then all monitors, regardless of # scope, will be returned. if options[:tags] params[:tags] = options[:tags] params[:tags] = params[:tags].join(',') if params[:tags].respond_to?(:join) end request(Net::HTTP::Get, "/api/#{API_VERSION}/monitor", params, nil, false) rescue Exception => e suppress_error_if_silent e end end
get_downtime(downtime_id)
click to toggle source
# File lib/dogapi/v1/monitor.rb, line 190 def get_downtime(downtime_id) begin params = { :api_key => @api_key, :application_key => @application_key } request(Net::HTTP::Get, "/api/#{API_VERSION}/downtime/#{downtime_id}", params, nil, false) rescue Exception => e suppress_error_if_silent e end end
get_monitor(monitor_id, options = {})
click to toggle source
# File lib/dogapi/v1/monitor.rb, line 45 def get_monitor(monitor_id, options = {}) begin params = { :api_key => @api_key, :application_key => @application_key } # :group_states is an optional list of statuses to filter returned # groups. If no value is given then no group states will be returned. # Possible values are: "all", "ok", "warn", "alert", "no data". params[:group_states] = options[:group_states].join(',') if options[:group_states] request(Net::HTTP::Get, "/api/#{API_VERSION}/monitor/#{monitor_id}", params, nil, false) rescue Exception => e suppress_error_if_silent e end end
monitor(type, query, options = {})
click to toggle source
# File lib/dogapi/v1/monitor.rb, line 10 def monitor(type, query, options = {}) begin params = { :api_key => @api_key, :application_key => @application_key } body = { 'type' => type, 'query' => query, }.merge options request(Net::HTTP::Post, "/api/#{API_VERSION}/monitor", params, body, true) rescue Exception => e suppress_error_if_silent e end end
mute_host(hostname, options = {})
click to toggle source
HOST MUTING
# File lib/dogapi/v1/monitor.rb, line 237 def mute_host(hostname, options = {}) begin params = { :api_key => @api_key, :application_key => @application_key } request(Net::HTTP::Post, "/api/#{API_VERSION}/host/#{hostname}/mute", params, options, true) rescue Exception => e suppress_error_if_silent e end end
mute_monitor(monitor_id, options = {})
click to toggle source
# File lib/dogapi/v1/monitor.rb, line 131 def mute_monitor(monitor_id, options = {}) begin params = { :api_key => @api_key, :application_key => @application_key } request(Net::HTTP::Post, "/api/#{API_VERSION}/monitor/#{monitor_id}/mute", params, options, true) rescue Exception => e suppress_error_if_silent e end end
mute_monitors()
click to toggle source
# File lib/dogapi/v1/monitor.rb, line 105 def mute_monitors() begin params = { :api_key => @api_key, :application_key => @application_key } request(Net::HTTP::Post, "/api/#{API_VERSION}/monitor/mute_all", params, nil, false) rescue Exception => e suppress_error_if_silent e end end
schedule_downtime(scope, options = {})
click to toggle source
DOWNTIMES
# File lib/dogapi/v1/monitor.rb, line 160 def schedule_downtime(scope, options = {}) begin params = { :api_key => @api_key, :application_key => @application_key } body = { 'scope' => scope }.merge options request(Net::HTTP::Post, "/api/#{API_VERSION}/downtime", params, body, true) rescue Exception => e suppress_error_if_silent e end end
unmute_host(hostname)
click to toggle source
# File lib/dogapi/v1/monitor.rb, line 249 def unmute_host(hostname) begin params = { :api_key => @api_key, :application_key => @application_key } request(Net::HTTP::Post, "/api/#{API_VERSION}/host/#{hostname}/unmute", params, nil, true) rescue Exception => e suppress_error_if_silent e end end
unmute_monitor(monitor_id, options = {})
click to toggle source
# File lib/dogapi/v1/monitor.rb, line 144 def unmute_monitor(monitor_id, options = {}) begin params = { :api_key => @api_key, :application_key => @application_key } request(Net::HTTP::Post, "/api/#{API_VERSION}/monitor/#{monitor_id}/unmute", params, options, true) rescue Exception => e suppress_error_if_silent e end end
unmute_monitors()
click to toggle source
# File lib/dogapi/v1/monitor.rb, line 118 def unmute_monitors() begin params = { :api_key => @api_key, :application_key => @application_key } request(Net::HTTP::Post, "/api/#{API_VERSION}/monitor/unmute_all", params, nil, false) rescue Exception => e suppress_error_if_silent e end end
update_downtime(downtime_id, options = {})
click to toggle source
# File lib/dogapi/v1/monitor.rb, line 177 def update_downtime(downtime_id, options = {}) begin params = { :api_key => @api_key, :application_key => @application_key } request(Net::HTTP::Put, "/api/#{API_VERSION}/downtime/#{downtime_id}", params, options, true) rescue Exception => e suppress_error_if_silent e end end
update_monitor(monitor_id, query, options)
click to toggle source
# File lib/dogapi/v1/monitor.rb, line 28 def update_monitor(monitor_id, query, options) begin params = { :api_key => @api_key, :application_key => @application_key } body = { 'query' => query, }.merge options request(Net::HTTP::Put, "/api/#{API_VERSION}/monitor/#{monitor_id}", params, body, true) rescue Exception => e suppress_error_if_silent e end end