0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

障害時の情報取得

Posted at

障害発生時の情報取得

私がこれまでにいた現場では、各ミドルウェア担当ごとに、障害情報取得スクリプトを自作していた。

問題点

  • DRYできてない。
  • Apacheで障害が起きたとしても、Apacheのログしか取得してない。
  • 定義ファイルだけを取得するスクリプトと障害情報?を取得するものでスクリプトが別れている。もちろんメンテは片方ずつしかされてなかったりする。

こういうときって、APだったり、負荷分散だったり、のログもほしいもの。
ほしければ、自分で実装しなければいけない。

解決策

sosreportの活用を!
sosreportのプラグインを自作してしまえばいいんだ!

とりあえず定義ファイルとコマンドを抜くだけだったら以下のようにすればいい。

from sos.plugins import Plugin, RedHatPlugin

class MyPlugin(Plugin, RedHatPlugin):
    """pluginの説明"""

    def setup(self):
        self.add_copy_spec([
            "取得したいファイルのパス",
            "取得したいファイルのパス",
            "取得したいファイルのパス",

        self.add_cmd_output("実行したいコマンド")
        ])

こんなプラグインを、
/usr/lib/python2.7/site-packages/sos/plugins につっこんでおけばよい。
ファイルは普通にアーカイブされているし、コマンド結果も、
sos_commands/プラグイン名/コマンド名 で保存されている。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?