• Projects
  • Service
  • About
  • branding.bz
  • Podcast
  • Tips
  • FAQ
  • Recruit
  • Download
  • Contact
  • branding.bz(ブランド構築SaaS)
  • DESIGN NOW(デザインメディア)
  • X
  • LinkedIn
  • Spotify
  • Facebook

213-0011 神奈川県川崎市高津区久本3-6-7-303

© 2026 ID INC. All rights reserved

claude-skills/スキル
SKILLOfficialmonitoring

logfire-infrastructure

プラグイン
logfire
ソース
GitHub で見る ↗
説明

Pydantic Logfireを使用して、ホスト、Dockerコンテナ、Kubernetesクラスタ、データベース・キュー・キャッシュサーバー、クラウドプロバイダのメトリクス(測定データ)を監視できます。アプリケーションコードの変更は不要です。 **次のような場合に使用:** - ホスト・サーバー・仮想マシンの監視をしたい - Dockerコンテナの監視をしたい - Kubernetesクラスタの監視をしたい - インフラストラクチャメトリクスをLogfireに送信したい - データベース(Postgres、Redis、MongoDB、Kafkaなど)の監視をしたい - クラウドメトリクス(AWS、GCPなど)を収集したい - Logfireの文脈でOpenTelemetry Collectorについて述べている **注意:** このスキルはインフラストラクチャの監視専用です。アプリケーションコードのトレース・ログ・AI/エージェントスパンの計測が必要な場合は、logfire-instrumentationスキルを使用してください。

原文を表示

Monitor hosts, Docker containers, Kubernetes clusters, database/queue/cache servers, and cloud-provider metrics with Pydantic Logfire — no application code required. Use this skill whenever the user asks to "monitor my host/server/VM", "monitor my Docker containers", "monitor my Kubernetes cluster", "send infrastructure metrics to Logfire", "watch my database/Postgres/Redis/MongoDB/Kafka", "collect cloud metrics" (AWS/GCP), or mentions the OpenTelemetry Collector in the context of Logfire. This is infrastructure only — for instrumenting APPLICATION CODE (traces, logs, AI/agent spans) use the logfire-instrumentation skill instead.

ユースケース
  • ホスト・サーバー・仮想マシンを監視したい
  • Dockerコンテナを監視したい
  • Kubernetesクラスタを監視したい
  • データベースのメトリクスを監視したい
  • クラウドプロバイダのメトリクスを収集したい
本文(日本語訳)

Logfireでインフラを監視する

このスキルはアプリケーション層のトレース・ログ・AI/エージェントのスパン(動作記録)には使用しないでください。そちらは logfire-instrumentation です。両者は組み合わせて使う場合が多く、完全なセットアップでは通常どちらも実行します。

仕組み

OpenTelemetry Collector(標準的な監視データの収集ツール)が、ホスト・コンテナ・クラスタ・インフラサービスのメトリクス(性能指標)をLogfireに送信します。アプリケーションコードの変更は不要です。Logfireは完全に互換したOTel(OpenTelemetry)バックエンド(データ受け取り側)として、Collectorから送られる標準的なOTLPトレース・ログ・メトリクスを受け取ります(わずかな例外はCollectorリファレンスを参照)。Collectorがすべてのメカニズムです。このスキルは任意で上級向けツールです。ユーザーがアプリ自体のトレースだけを必要とする場合は、logfire-instrumentation の言語SDK(ソフトウェア開発キット)だけで十分です。

ステップ1: 認証と正確なプロジェクト選択

whoami コマンドで正しいプロジェクトに認証されていることを確認するまで、インフラ設定ファイル(docker-compose.yml・Kubernetesマニフェスト等)を開いたり読んだり実行したりしないでください。このステップで監視対象を知る必要はありません。認証はブラウザによるサインインで待機する可能性がある唯一のステップなので、最初に進めると待ち時間がターン1から始まり、ステップ2の検出作業の後ではありません。

Authenticate and Select the Exact Project を使い、提供されたLogfireのURLからCLI(コマンドラインツール)ターゲットを導き出し、検証済みのCLIパスで対象対応の whoami チェックを実行してください。JS/TSプロジェクトで uv がない場合は、プレーンな npx の代わりに外部プリフィックス付きnpmフォールバック(代替手段)を使ってください。これはリポジトリローカルバイナリの実行を避けます。既に正しいプロジェクトが報告され、--region または --base-url ターゲットが解決している場合はステップ2にスキップしてください。そうでない場合は、projects use で作成された書き込み認証情報の安全な受け渡しを含む、そちらの完全な認証とプロジェクト選択シーケンスを続行してください。

ステップ2: 監視対象の特定

インフラの実際の構成を検出し、推測に頼らないでください:

  • ホスト/VM: マシン自体を監視(CPU・メモリ・ディスク・ネットワーク・負荷)。
  • Docker: 実行中のコンテナについて docker-compose.yml / Dockerfile を読む。
  • Kubernetes: マニフェスト・kubeconfig ・kubectl コンテキストを探す。
  • データベース/キュー/キャッシュサーバー: Postgres・MySQL・Redis・MongoDB・Kafka・RabbitMQ・Nginx・Apache・Elasticsearch・Memcached について docker-compose.yml / pyproject.toml / package.json を読む。
  • クラウドプロバイダー: ユーザーがプロバイダーを指定した場合、またはアプリが明らかにそこで実行されている場合のGCP・AWSメトリクス(Cloud Monitoring・CloudWatch・ECS)。

複数が同時に該当する可能性があります。単一のCollectorは複数のレシーバー(受信機)を並行パイプラインで実行できます。

ステップ3: Collectorを設定

ステップ2で特定されたレシーバーについてCollectorリファレンスに従ってください。共有エクスポーター(送信元)セットアップ、その後ソースごとの専用セクション(ホストメトリクス・Docker・Kubernetes・データベース/キュー/キャッシュサーバー・クラウドプロバイダーメトリクス)をカバーしており、各セクションには正確なレシーバー名・動作する設定・実際に問題になる注意点(Dockerソケット権限・APIバージョン固定・host.docker.internal vs localhost・IAM権限・ADOT vs Contribコレクターイメージ)が含まれています。

Collectorリファレンスが説明する同じサービス・リソースメタデータ規則を設定してください(host.name・service.name・service.instance.id)。これによりデータが「ホスト」「Kubernetes」「メトリクス」ページ全体で正しくグループ化されます。

Collectorを起動または再起動する前に、設定ファイルを検証してください。レシーバー名の誤りやインデント不正は、Collectorが起動してログに何も出さず無言でパイプラインを落とすのではなく、検証エラーとして表面化するべきです:

otelcol-contrib validate --config=collector-config.yaml
# または、コア版(非Contrib)の場合: otelcol validate --config=...

どちらのバイナリも PATH になければ、実行中のCollectorコンテナを検査(例えば kubectl exec で)するか、イメージのエントリーポイント・systemdユニット・Helmチャートから特定のデプロイメント検証コマンドを使ってください。docker compose config または kubectl get pod <name> -o yaml は明示的に設定された場合、コマンドを表示できます。

ステップ4: 検証

レシーバーの配線は、Collectorがクリーンに起動した時点では完了していません。データが実際に正しいページ、正しいホスト/コンテナ/クラスタに到着したことを確認してください。何かが到着したというだけではなく。このセッション内で実際にクエリを実行せずに、メトリクスが「到着した」と報告しないでください。チェックされなかった尤もらしい要約は、検証できないと言うより悪いです。

  1. 設定変更後、Collectorを再起動します(上記で検証済み)。
  2. 設定したリソースをそのページのあらゆるデータだけでなく正確にクエリします。 このセッションでLogfireのMCPサーバーまたはAPIが接続されている場合、ステップ3で設定した特定の host.name / コンテナ / クラスタについて過去数分以内をクエリしてください。その正確な識別子に対してゼロ行を返すクエリは、ページが別の何かのデータを表示していても、それが到着していないことを意味します。そうでない場合は、特定の製品ページ(ホスト・Docker・Kubernetes)、またはデータベース/キュー/キャッシュ/クラウドソース用のメトリクスエクスプローラーを開き、同じ正確な識別子を探してください。
  3. 何も表示されない場合、順序に従って確認します: エクスポーターのエンドポイント/リージョンと書き込みトークン、レシーバーが有効なパイプラインに含まれている(定義されているが service.pipelines で参照されていない)、リソース属性(host.name・service.name)が設定されている。リファレンス自身の検証セクションに完全なトラブルシューティング手順があります。
  4. 修正し再確認して、「何らか」のデータではなく特定のソースが表示されるまで続けます。

確認したことから最終レポートで終了してください。テンプレートではなく、whoami から得た組織/プロジェクト/リージョン、どのレシーバーがアクティブか、検証した正確なホスト/コンテナ/クラスタ識別子を含みます。関連ビューへの直接リンク(ソースに基づいた /hosts / /docker / /kubernetes / /metrics)を whoami のプロジェクトURLから含めてください。これでユーザーは自分のソース到着を見られ、どこを見ればよいか聞く必要がありません。プレースホルダーを含むレポートは、上記のステップがスキップされ終了していないことを意味します。

参考資料

  • OTel Collectorを介したホスト・Docker・Kubernetes・データベース/キュー/キャッシュ・クラウドプロバイダーメトリクス — レシーバー設定・IAM/権限に関する注意点・独自の検証ループ。
原文(English)を表示

Monitor Infrastructure with Logfire

Do not use this skill for application-level traces, logs, or AI/agent spans — that's logfire-instrumentation. The two compose: a full setup often runs both.

How This Works

The OpenTelemetry Collector ships host, container, cluster, and infrastructure-service metrics to Logfire with no application code changes — Logfire is a fully compliant OTel backend and ingests standard OTLP traces, logs, and metrics from it (one narrow exception noted in the collector reference), so the Collector is the entire mechanism. This is optional and is an advanced tool: if the user only wants their app's own traces, logfire-instrumentation's language SDKs are enough on their own.

Step 1: Authenticate and Select the Exact Project

Do not open, read, or run any infrastructure config file (docker-compose.yml, a Kubernetes manifest, or similar) until whoami confirms you're authenticated to the right project — nothing about this step requires knowing what's being monitored. Auth is also the one step that can block on a human (browser sign-in), so starting it first means that wait begins on turn one, not after Step 2's detection work.

Use Authenticate and Select the Exact Project to derive the CLI target from the supplied Logfire URL and run its target-aware whoami check with a verified CLI path — for JS/TS projects without uv, use the external-prefix npm fallback instead of plain npx, which can execute a repository-local binary. Skip to Step 2 if that already reports the right project and resolved --region or --base-url target; otherwise, continue through the full authentication and project-selection sequence there, including its safe handoff for the write credential created by projects use.

Step 2: Identify What to Monitor

Detect the infrastructure actually in play, don't assume:

  • Host/VM: monitoring the machine itself (CPU, memory, disk, network, load).
  • Docker: read docker-compose.yml / Dockerfiles for running containers.
  • Kubernetes: look for manifests, a kubeconfig, or kubectl context.
  • Database/queue/cache servers: read docker-compose.yml / pyproject.toml / package.json for Postgres, MySQL, Redis, MongoDB, Kafka, RabbitMQ, Nginx, Apache, Elasticsearch, or Memcached.
  • Cloud provider: GCP or AWS metrics (Cloud Monitoring, CloudWatch, ECS), when the user names the provider or the app clearly runs there.

More than one can apply at once — a single Collector can run multiple receivers in parallel pipelines.

Step 3: Configure the Collector

Follow the collector reference for the receiver(s) identified in Step 2 — it covers the shared exporter setup, then a dedicated section per source: host metrics, Docker, Kubernetes, database/queue/cache servers, and cloud-provider metrics, each with the exact receiver name, a working config, and the caveats that actually bite (Docker socket permissions, API version pinning, host.docker.internal vs localhost, IAM permissions, ADOT vs. Contrib collector images).

Set the same service & resource metadata conventions the collector reference describes — host.name, service.name, service.instance.id — so data groups correctly across the Hosts, Kubernetes, and Metrics pages.

Before starting or restarting the Collector, validate the config file — a receiver typo or bad indentation should surface as a validation error, not a Collector that starts, logs nothing useful, and silently drops the pipeline:

otelcol-contrib validate --config=collector-config.yaml
# or, for the core (non-Contrib) distribution: otelcol validate --config=...

If neither binary is on PATH, inspect the running Collector container (for example with kubectl exec) or use the deployment-specific validation command from the image entrypoint, systemd unit, or Helm chart. docker compose config or kubectl get pod <name> -o yaml can show the command when it is explicitly configured.

Step 4: Verify

Wiring a receiver isn't done when the Collector starts cleanly — confirm the data actually reached the right page for the right host/container/cluster, not just that something arrived. Never report a metric as "arrived" without having queried for it in this same session — a plausible-sounding summary that wasn't checked is worse than saying you couldn't verify.

  1. Restart the Collector after any config change (having validated it, above).
  2. Query for the exact resource you configured, not just any data on the page. If a Logfire MCP server or API is connected in this session, query for the specific host.name / container / cluster you set in Step 3 within the last few minutes — a query that returns zero rows for that exact identifier means it didn't land, even if the page shows data from something else. Otherwise, open the specific product page — Hosts, Docker, or Kubernetes — or the Metrics explorer for database/queue/cache/cloud sources, and look for that same exact identifier.
  3. If nothing appears, check in order: the exporter endpoint/region and write token, that the receiver is in an active pipeline (not defined but never referenced under service.pipelines), and that resource attributes (host.name, service.name) are set — the reference's own Verify section has the full troubleshooting path.
  4. Fix and re-check until the specific source is visible, not just "some" data.

Close with a final report built from what you just confirmed — org/project/region from whoami, which receiver(s) are active, and the exact host/container/cluster identifier you verified — not a template. Include a direct link to the relevant view (/hosts, /docker, /kubernetes, or /metrics, based on the source) using the project's URL from whoami, so the user can see their own source arrive without having to ask where to look. A report with a placeholder in it means a step above was skipped, not finished.

References

  • Host, Docker, Kubernetes, database/queue/cache, and cloud-provider metrics via the OTel Collector — receiver configs, IAM/permission caveats, and its own verify loop.

原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。