mackerel-rb
Installation
Add this line to your application's Gemfile:
gem 'mackerel-rb'
And then execute:
$ bundle
Or install it yourself as:
$ gem install mackerel-rb
Usage
Mackerel.configure do |config|
config.api_key = "<Your API Key>" # Default: ENV['MACKEREL_APIKEY']
config.proxy = "http://proxy.example.com:80" # Default: nil (Not use http proxy)
end
hosts = Mackerel.hosts
hosts.each do |host|
puts host
#=> #<Hashie::Mash createdAt=1437422856 displayName="www001.mackerel-rb.dev" id="Dummmmmmmmy", ..., status="standby" type="unknown">
end
Feature
Services
- List of Services -
GET/api/v0/services
- List of metric-names -
GET/api/v0/service/<serviceName>/metrics-names
Roles
- List of Roles -
GET/api/v0/services/<serviceName>/roles
Hosts
- Registering host information -
POST/api/v0/hosts
- Getting host information -
GET/api/v0/hosts/<hostId>
- Updating host information -
PUT/api/v0/hosts/<hostId>
- Updating host status -
POST/api/v0/hosts/<hostId>/status
- Updating host roles -
PUT/api/v0/hosts/<hostId>/role-fullnames
- Retiring a host -
POST/api/v0/hosts/<hostId>/retire
- List of hosts -
GET/api/v0/hosts.json
- Getting host metrics -
GET/api/v0/hosts/<hostId>/metrics
- List of metric-names -
GET/api/v0/hosts/<hostId>/metrics-names
Metrics
- Posting metrics -
POST/api/v0/tsdb
- Getting latest metrics -
GET/api/v0/tsdb/latest
- Posting graph definitions -
POST/api/v0/graph-defs/create
- Posting service metrics -
POST/api/v0/services/<serviceName>/tsdb
- Posting monitoring check results -
POST/api/v0/monitoring/checks/report
Monitors
- Register monitor configurations -
POST/api/v0/monitors
- Get monitor configurations -
GET/api/v0/monitors
- Get monitor configurations -
GET/api/v0/monitors/<monitorId>
- Update monitor configurations -
PUT/api/v0/monitors/<monitorId>
- Delete monitor configurations -
DELETE/api/v0/monitors/<monitorId>
Dashboards
- Creating Dashboards -
POST/api/v0/dashboards
- Getting Dashboards -
GET/api/v0/dashboards/<dashboardId>
- Updating Dashboards -
PUT/api/v0/dashboards/<dashboardId>
- Deleting Dashboards -
DELETE/api/v0/dashboards/<dashboardId>
- List of Dashboards -
GET/api/v0/dashboards
Alerts
- List of Alerts -
GET/api/v0/alerts
- Closing Alert -
POST/api/v0/alerts/<alertId>/close
Organization
- Getting Organization -
GET/api/v0/org
Contributing
- Fork it ( https://github.com/pepabo/mackerel-rb/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request