This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

mackerel.client is a python library to access Mackerel (https://mackerel.io/).

This client is Ported from mackerel-client-ruby.

Install

$ pip install mackerel.client

Dependency

mackerel.client use requests, simplejson and click.

Usage

Get hosts

from mackerel.client import Client

client = Client(mackerel_api_key='<Put your API key')
host = client.get_hosts()

Get host

from mackerel.client import Client

client = Client(mackerel_api_key='<Put your API key')
host = client.get_host('<hostId>')

Update host status

from mackerel.client import Client

client = Client(mackerel_api_key='<Put your API key')
# Poweroff.
self.client.update_host_status('<hostId>', 'poweroff')
# Standby.
self.client.update_host_status('<hostId>', 'standby')
# Working.
self.client.update_host_status('<hostId>', 'working')
# Maintenance.
self.client.update_host_status('<hostId>', 'maintenance')

Retire host

from mackerel.client import Client

client = Client(mackerel_api_key='<Put your API key')
self.client.retire_host('<hostId>')

Get latest metrics

from mackerel.client import Client

client = Client(mackerel_api_key='<Put your API key')
# Get hostId A's and hostId B's loadavg5, memory.free value.
metrics = self.client.get_latest_metrics(['<hostId A>', '<hostId B>'],
                                         ['loadavg5', 'memory.free'])

Post metrics

from mackerel.client import Client

client = Client(mackerel_api_key='<Put your API key>')
metrics = [
    {
        'hostId': '<hostId>', 'name': 'custom.metrics.loadavg',
        'time': 1401537844, 'value': 1.4
    },
    {
        'hostId': '<hostId>', 'name': 'custom.metrics.uptime',
        'time': 1401537844, 'value': 500
    }

]
# Post `custom.metrics.loadavg` and `custom.metrics.uptime` to `hostId`.
client.post_metrics(metrics)

Post service metrics

from mackerel.client import Client

client = Client(mackerel_api_key='<Put your API key>')
metrics = [
    {
        'name': 'custom.metrics.latency',
        'time': 1401537844, 'value': 0.5
    },
    {
        'name': 'custom.metrics.uptime',
        'time': 1401537844, 'value': 500
    }
]
# Post 'custom.metrics.latency' and 'custom.metrics.uptime' to `service_name`.
self.client.post_service_metrics('service_name', metrics)

CLI

Get host(s) information from hostname or service, role.

$ mkr.py info [--name foo] [--service service] [--role role]

Set status of a host.

$ mkr.py status --host-id foo --status working

Retire a host.

$ mkr.py retire --host-id foo

Get status of a host.

$ mkr.py status --host-id foo

Authentication

$ export MACKEREL_APIKEY=foobar
Release History

Release History

0.0.2

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
mackerel.client-0.0.2.tar.gz (6.0 kB) Copy SHA256 Checksum SHA256 Source Mar 14, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting