Skip to main content

host-check-tool

This package ships procdiag — a local-first Linux host-resource diagnosis tool. **「なぜこの PC が重い・落ちる・ディスクが満杯か」**に答える。

CPU・メモリ・ディスクの使用状況を一定期間低負荷で記録し、決定論的な検出ルールに 基づいて運用レベルの改善提案を日本語レポートとして出力する。リアルタイム監視 ダッシュボードではなく**「記録 → 診断 → 提案」の事後診断ワークフロー**であり、 工場のエッジ PC・ラインサーバーなど IT 人材が常駐しない環境を主用途とする。

  • オフライン・閉域網ファースト — 外部通信ゼロ。レポートは CDN 参照なしの単一 HTML
  • 3 コマンドで動く — pip install → procdiag init → procdiag record
  • 決定論的な診断 — 13 の検出ルール × テンプレートで提案を生成 (LLM 非依存)。 出力は機械可読 (JSON) で、外部での活用は利用者に委ねる
  • 観測者効果の最小化と透明性 — 自身のオーバーヘッドを計測・報告し、 予算超過時は自動減速する

Python Version License

Quick Start

# インストール
pip install host-check-tool

# 設定と data/ ディレクトリを生成
procdiag init

# 記録を開始 (Ctrl-C で安全に停止)
procdiag record

# 別のターミナルから — または記録停止後に実行
procdiag check

# HTML + JSON レポートを生成
procdiag report --out report.html --json report.json

コマンドリファレンス

コマンド 内容
procdiag init [DIR] config.py と data/ を生成
procdiag record 常駐ループで CPU/メモリ/ディスクを記録
procdiag check 記録済みデータに診断ルールを実行し改善提案を出力
procdiag report HTML + JSON レポートを一括生成
procdiag status 記録期間・サンプル数・自己負荷を表示
procdiag doctor 記録開始前にホストの観測能力 (PSI/cgroup/権限/センサ等) を診断
procdiag explain [RULE|sampler] ルールまたはサンプラーの詳細を表示
procdiag list-rules 登録済みルールを一覧表示
procdiag list-samplers 登録済みサンプラーを Tier 別に一覧表示
procdiag export 記録データを CSV または JSON でエクスポート
procdiag prune 保持ポリシーの手動実行
procdiag service print systemd ユニットファイルを表示
procdiag service install user systemd ユニットを配置

主要オプション:

procdiag record --duration 24h --config config.py --db data/procdiag.db
procdiag check  --format json --output findings.json
procdiag check  --only MEM-LEAK-01,DISK-FULL-01

終了コード

procdiag check (alias: procdiag advise) はスクリプト・CI に組み込めるよう 終了コードで結果を返す:

コード 意味
0 Finding なし (正常)
1 critical / warning の Finding あり
2 info レベルの Finding のみ

systemd 運用

# ユーザー systemd として配置
procdiag service install --config /etc/procdiag/config.py

# 有効化
systemctl --user daemon-reload
systemctl --user enable --now procdiag.service

# ログアウト後も継続する場合
sudo loginctl enable-linger $USER

system ユニット (root) として配置する場合:

procdiag service print --system | sudo tee /etc/systemd/system/procdiag.service

設定

procdiag init で生成される config.py を編集する。 Pydantic モデルで検証されるため、タイポや型ミスは起動時にエラーになる。

config = ProcdiagConfig(
    db_path="./data/procdiag.db",
    sampling=SamplingConfig(
        system_interval=1.0,    # Tier1: PSI + CPU/Mem/IO (秒)
        cgroup_interval=5.0,    # Tier2a: cgroup v2 統計
        process_interval=10.0,  # Tier2b: プロセス走査
        disk_interval=60.0,     # Tier3: ディスク使用量
        watch_dirs=[
            WatchDir(path="/var/log", time_budget_sec=10),
        ],
    ),
    retention=RetentionConfig(raw="48h", rollup="90d"),
)

依存関係

  • Python 3.10+
  • psutil — OS メトリクス取得
  • pydantic — 設定バリデーション
  • jinja2 — HTML レポートテンプレート
  • click — CLI フレームワーク
  • 標準ライブラリのみ (sqlite3, signal, threading, …)

numpy・pandas・rich は不要。外部ネットワーク通信ゼロ。

詳細ドキュメント

設計・アーキテクチャ・ルールカタログは docs/procdiag.md を参照。

ライセンス

MIT

Metadata

Release files for host-check-tool 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for host-check-tool 0.3.0
File Size Uploaded Provenance
host_check_tool-0.3.0.tar.gz 110.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for host-check-tool 0.3.0
File Interpreter ABI Platform
host_check_tool-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 247.5 kB

Release files / host_check_tool-0.3.0.tar.gz

Download URL host_check_tool-0.3.0.tar.gz
Size 110.2 kB
Tags Source
SHA-256 checksum
How to use checksums
686187417fc3cedc4ecc48c613b0c093d5a1babc7f066347daea4fa187eb4262
BLAKE2b-256 checksum
How to use checksums
717ce07222cbb6159e7d236b188adb9ffc5ab91d32d66441c25beb33c64399b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.1 CPython/3.11.10 Linux/6.8.0-124-generic

Release files / host_check_tool-0.3.0-py3-none-any.whl

Download URL host_check_tool-0.3.0-py3-none-any.whl
Size 137.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ef4d9a0b325fbea3d1acbebfaa663dde9ab8f501d2992d408c9e148e81113d5d
BLAKE2b-256 checksum
How to use checksums
9d5ffcfbeb5495926e0fbef2ebcc99c27c3406e7c761cca625289dc8d967e7df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.1 CPython/3.11.10 Linux/6.8.0-124-generic

Security for host-check-tool 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page