Class: Mackerel::Client

Inherits:
Object
  • Object
show all
Includes:
REST::Alert, REST::Annotation, REST::Channel, REST::Dashboard, REST::Host, REST::Invitation, REST::Metadata, REST::Metric, REST::Monitor, REST::Monitoring, REST::NotificationGroup, REST::Organization, REST::Service, REST::User
Defined in:
lib/mackerel/client.rb,
lib/mackerel/client/helper.rb

Defined Under Namespace

Modules: Helper

Instance Method Summary collapse

Methods included from REST::NotificationGroup

#delete_notification_group, #get_notification_groups, #post_notification_group, #update_notification_group

Methods included from REST::Channel

#get_channels

Methods included from REST::Metadata

#delete_metadata, #get_metadata, #list_metadata, #update_metadata

Methods included from REST::User

#get_users, #remove_user

Methods included from REST::Service

#get_roles, #get_service_metric_names, #get_services

Methods included from REST::Organization

#get_organization

Methods included from REST::Monitoring

#post_monitoring_check_report

Methods included from REST::Monitor

#delete_monitor, #get_monitors, #post_monitor, #update_monitor

Methods included from REST::Metric

#define_graphs, #get_host_metrics, #get_latest_metrics, #get_service_metrics, #post_metrics, #post_service_metrics

Methods included from REST::Invitation

#post_invitation, #revoke_invitation

Methods included from REST::Host

#get_host, #get_host_metric_names, #get_hosts, #post_host, #retire_host, #update_host, #update_host_roles, #update_host_status

Methods included from REST::Dashboard

#delete_dashboard, #get_dashboard, #get_dashboards, #post_dashboard, #update_dashboard

Methods included from REST::Annotation

#delete_graph_annotation, #get_graph_annotations, #post_graph_annotation, #update_graph_annotation

Methods included from REST::Alert

#close_alert, #get_alerts

Constructor Details

#initialize(args = {}) ⇒ Client

Returns a new instance of Client.



42
43
44
45
46
47
# File 'lib/mackerel/client.rb', line 42

def initialize(args = {})
  @origin       = args[:mackerel_origin]  || 'https://api.mackerelio.com'
  @api_key      = args[:mackerel_api_key] || raise(ERROR_MESSAGE_FOR_API_KEY_ABSENCE)
  @timeout      = args[:timeout]          || 30 # Ref: apiRequestTimeout at mackerel-agent
  @open_timeout = args[:open_timeout]     || 30 # Ref: apiRequestTimeout at mackerel-agent
end