Skip to main content

mackerel.api is a python client library for mackerel api on Python 3.7 and above.

Project description

mackerel.api

PyPI License: MIT codecov Build Status PyPI - Python Version Downloads

mackerel.api is a python library for mackerel api on Python 3.7 and above.

Install

$ pip install mackerel.api

Usage

from mackerel.api import Client

client = Client("<mackerel api key>")
res = client.get("/org")
print(res.status_code, res.json())

API

documentation

service

# サービスの一覧
client.get("/services")
# サービスの登録
client.post("/services", {"name": "<serviceName>, … "})
# サービスの削除
client.delete("/services/<serviceName>")
# ロールの一覧
client.get("/services/<serviceName>/roles")
# ロールの登録
client.post("/services/<serviceName>/roles", {"name": "<serviceName>, … "})
# ロールの削除
client.delete("/services/<serviceName>/roles/<roleName>")
# メトリック名の一覧
client.get("/services/<serviceName>/metric-names")

host

# ホストの登録
client.post("/hosts", {"name": "<hostName>",  })
# ホスト情報の取得
client.get("/hosts/<hostId>")
# ホスト情報の更新
client.put("/hosts/<hostId>", {"name": "<hostName>",  })
# ホストのステータスの更新
client.post("/hosts/<hostId>/status", {"status": "<hostStatus>"})
# ホストのロールの更新
client.put("/hosts/<hostId>/role-fullnames", {"roleFullnames": [ <string>, <string>,  ]})
# ホストの退役
client.post("/hosts/<hostId>/retire", {})
# ホストの一覧
client.get("/hosts")
# メトリック名の一覧
client.get("/hosts/<hostId>/metric-names")
# 監視ステータスの一覧
client.get("/hosts/<hostId>/monitored-statuses")

host metric

# メトリックの投稿
client.post("/tsdb", [ <metricValue>, <metricValue>,  ])
# ホストのメトリックの値の取得
client.get("/hosts/<hostId>/metrics", {"name": "<metricName>",  })
# メトリックの最新値の取得
client.get("/tsdb/latest", {"hostId": "<hostId>",  })
# グラフ定義の投稿
client.post("/graph-defs/create", [ <graphDef>, <graphDef>,  ])

service metric

# サービスメトリックの投稿
client.post("/services/<serviceName>/tsdb", [ <metricValue>, <metricValue>,  ])
# サービスメトリックの値の取得
client.get("/services/<serviceName>/metrics", {"name": "<serviceName>",  })

check

# チェック監視結果の投稿
client.post("/monitoring/checks/report", {"reports": [ <report>, <report>,  ]})

metadata

# ホストメタデータの取得
client.get("/hosts/<hostId>/metadata/<namespace>")
# ホストメタデータの登録・更新
client.put("/hosts/<hostId>/metadata/<namespace>", {  })
# ホストメタデータの削除
client.delete("/hosts/<hostId>/metadata/<namespace>")
# ホストメタデータの一覧
client.get("/hosts/<hostId>/metadata")
# サービスメタデータの取得
client.get("/services/<serviceName>/metadata/<namespace>")
# サービスメタデータの登録・更新
client.put("/services/<serviceName>/metadata/<namespace>", {  })
# サービスメタデータの削除
client.delete("services/<serviceName>/metadata/<namespace>")
# サービスメタデータの一覧
client.get("/services/<serviceName>/metadata")
# ロールメタデータの取得
client.get("/services/<serviceName>/roles/<roleName>/metadata/<namespace>")
# ロールメタデータの登録・更新
client.put("/services/<serviceName>/roles/<roleName>/metadata/<namespace>", {  })
# ロールメタデータの削除
client.delete("/services/<serviceName>/roles/<roleName>/metadata/<namespace>")
# ロールメタデータの一覧
client.get("/services/<serviceName>/roles/<roleName>/metadata")

monitor

# 監視ルールの登録
client.post("/monitors", {"type": "host",  })
# 監視ルールの一覧
client.get("/monitors")
# 監視ルールの取得
client.get("/monitors/<monitorId>")
# 監視ルールの更新
client.put("/monitors/<monitorId>", {  })
# 監視ルールの削除
client.delete("/monitors/<monitorId>")

downtime

# ダウンタイムの登録
client.post("/downtimes", {"name": "<downtimeName>",  })
# ダウンタイムの一覧
client.get("/downtimes")
# ダウンタイムの更新
client.put("/downtimes/<downtimeId>", {"name": "<downtimeName>",  })
# ダウンタイムの削除
client.delete("/downtimes/<downtimeId>")

channel

# 通知チャンネルの一覧
client.get("/channels")
# 通知チャンネルの登録
client.post("/channels", {"type": "email",  })
# 通知チャンネルの削除
client.delete("/channels/<channelId>")

group

# 通知グループの登録
client.post("/notification-groups", {"name": "<groupName>",  })
# 通知グループの一覧取得
client.get("/notification-groups")
# 通知グループの更新
client.put("/notification-groups/<notificationGroupId>", {"name": "<groupName>",  })
# 通知グループの削除
client.delete("/notification-groups/<notificationGroupId>")

alert

# アラートの一覧
client.get("/alerts")
# アラートの取得
client.get("/alerts/<alertId>")
# アラートを閉じる
client.post("/alerts/<alertId>/close", {"reason": "<text>"})

alert group

# アラートグループ設定の一覧
client.get("/alert-group-settings")
# アラートグループ設定の作成
client.post("/alert-group-settings", {"name": "<alertGroupName>",  })
# アラートグループ設定の取得
client.get("/alert-group-settings/<alertGroupSettingId>")
# アラートグループ設定の更新
client.put("/alert-group-settings/<alertGroupSettingId>", {"name": "<groupName>",  })
# アラートグループ設定の削除
client.delete("/alert-group-settings/<alertGroupSettingId>")

dashboard

# ダッシュボードの作成
client.post("/dashboards", {"title": "<dashboardTitle>",  })
# ダッシュボードの取得
client.get("/dashboards/<dashboardId>")
# ダッシュボードの更新
client.put("/dashboards/<dashboardId>", {"title": "<dashboardTitle>",  })
# ダッシュボードの削除
client.delete("/dashboards/<dashboardId>")
# ダッシュボードの一覧
client.get("/dashboards")

graph annotation

# グラフアノテーションの作成
client.post("/graph-annotations", {"title": "<annotationTitle>",  })
# グラフアノテーションの取得
client.get("/graph-annotations", {"service": "<serviceName>",  })
# グラフアノテーションの更新
client.put("/graph-annotations/<annotationId>", {"title": "<annotationTitle>",  })
# グラフアノテーションの削除
client.delete("/graph-annotations/<annotationId>")

user

# オーガニゼーションメンバーに所属するユーザーの一覧
client.get("/users")
# オーガニゼーションメンバーに所属するユーザーの削除
client.delete("/users/<userId>")

invitation

# 招待の一覧
client.get("/invitations")
# 招待の作成
client.post("/invitations", {"email": "<emailAddress>",  })
# 招待の取り消し
client.post("/invitations/revoke", {"email": "<emailAddress>",  })

org

# オーガニゼーションの情報を取得
client.get("/org")

aws integration

# AWSインテグレーション設定の一覧
client.get("/aws-integrations")
# AWSインテグレーション設定の取得
client.get("/aws-integrations/<awsIntegrationId>")
# AWSインテグレーション設定の登録
client.post("/aws-integrations", {"name": "<awsIntegrationName>, … "})
# AWSインテグレーション設定の更新
client.put("/aws-integrations/<awsIntegrationId>", {"name": "<awsIntegrationName>",  })
# AWSインテグレーション設定の削除
client.delete("aws-integrations/<awsIntegrationId>")
# AWSインテグレーション外部IDの生成
client.post("/aws-integrations-external-id")
# AWSインテグレーションの除外可能なメトリック名一覧
client.get("/aws-integrations-excludable-metrics")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mackerel.api-1.0.2.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mackerel.api-1.0.2-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file mackerel.api-1.0.2.tar.gz.

File metadata

  • Download URL: mackerel.api-1.0.2.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.12

File hashes

Hashes for mackerel.api-1.0.2.tar.gz
Algorithm Hash digest
SHA256 c3f0ebf8ee6ac0cd4404d6e8cf3bef0b58107d8b17c67db42288f96baf9f6939
MD5 28fc61eb9e9184f0f298a07fbca336cc
BLAKE2b-256 00c95d09a2c9ef885338d8cbecb42b98abbcd05d43111c2719afed2db9ffc84d

See more details on using hashes here.

File details

Details for the file mackerel.api-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: mackerel.api-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.12

File hashes

Hashes for mackerel.api-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 cc093ff6a3b34ebe46175abc4eabefb0825d883bc15bb5f0627b97d5d6470690
MD5 27c0d2ca5272f30574e764821da9b75f
BLAKE2b-256 f72bb86240937756de30ca99c7625410c16abc4cd31fe415c3a3c57a33403535

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page