Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/10mohi6/mackerel-api-client-python

mackerel.api is a python library for mackerel api on Python 3.7 and above.
https://github.com/10mohi6/mackerel-api-client-python

api client mackerel python rest rest-api

Last synced: 14 days ago
JSON representation

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

Awesome Lists containing this project

README

        

# mackerel.api

[![PyPI](https://img.shields.io/pypi/v/mackerel.api)](https://pypi.org/project/mackerel.api/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![codecov](https://codecov.io/gh/10mohi6/mackerel-api-client-python/branch/main/graph/badge.svg?token=dCNHE9TzxS)](https://codecov.io/gh/10mohi6/mackerel-api-client-python)
[![Build Status](https://app.travis-ci.com/10mohi6/mackerel-api-client-python.svg?branch=main)](https://app.travis-ci.com/10mohi6/mackerel-api-client-python)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/mackerel.api)](https://pypi.org/project/mackerel.api/)
[![Downloads](https://pepy.tech/badge/mackerel.api)](https://pepy.tech/project/mackerel.api)

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

## Install

$ pip install mackerel.api

## Usage

```python
from mackerel.api import Client

client = Client("")
res = client.get("/org")
print(res.status_code, res.json())
```

## API

[documentation](https://mackerel.io/ja/api-docs/)

### service

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

### host

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

### host metric

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

### service metric

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

### check

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

### metadata

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

### monitor

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

### downtime

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

### channel

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

### group

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

### alert

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

### alert group

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

### dashboard

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

### graph annotation

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

### user

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

### invitation

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

### org

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

### aws integration

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