ファイルまたはディレクトリの監視
Instana エージェントをインストールすると、ファイルやディレクトリを監視するためのセンサーが自動的に展開・インストールされます。 Instana のUIでは、特定のファイルやディレクトリに関連するイベントを確認できます。
サポート対象のオペレーティング・システム
ファイルまたはディレクトリを監視するために、以下のオペレーティングシステムがサポートされています:
- Linux
- Mac OS または OS X
- Windows
- Solaris SPARC
- AIX
の構成
Instana ローカルマシンの設定に基づいて、監視対象のファイルまたはディレクトリに関するイベントを生成します。
Instana のUIで特定のファイルまたはディレクトリのイベントを取得するには、条件を設定したモニターを作成し、エージェント設定ファイルの以下のフィールドを設定してイベント <agent_install_dir>/etc/instana/configuration.yaml間隔を指定する必要があります。
filemonitoring を有効にするには、ファイル configuration.yaml 内で enabled: true 設定し、有効なモニターを少なくとも2つ指定してください。イベント間隔
次の例は、イベント間隔を設定するためのコンフィギュレーションを示している:
com.instana.plugin.filemonitoring:
enabled: true
file_events:
- event_intervals:
- interval_1: 30 # sec
- interval_2: 90 # sec
- interval_3: 50 # sec
- interval_4: 70 # sec
監視項目および条件
次の例は、条件付きモニターを設定するためのコンフィギュレーションを示している。 この設定では、フォルダ内のファイル数を監視するためのファイル監視ルールが追加される。 イベントをトリガーする条件は、フォルダ内のファイル数が3個に達するとイベントがトリガーされるように設定されている。
com.instana.plugin.filemonitoring:
enabled: true
file_events:
- event_intervals:
- interval_1: 30 # sec
- interval_2: 90 # sec
- interval_3: 50 # sec
- interval_4: 70 # sec
- path: '<path of the file or folder>' #eg for file: '/Users/username/Downloads/agent.log' #eg for directory: '/Users/username/Downloads/'
conditions:
- 'FILE_COUNT = <file count>' #eg: 3
name: '<name should be unique for each monitor>' #eg: 'Compare-filecount'
interval: '<interval variable as described in the event_interval section >' #eg: 'interval_1'
severity: '<WARNING or CRITICAL>' #eg: 'WARNING'
必要であれば、複数の条件で複数のモニターを作成することもできる。 モニターとコンディションの詳細な属性については、モニターの設定可能な統計情報とコンディションの設定可能な統計情報を参照してください。
イベントは、エージェントconfiguration.yamlファイルで指定されたモニターと条件に基づいて生成されます。 以下のような関係がイベントのトリガーとなる:
- AND:モニター内に複数の条件が存在し、すべての条件しきい値を満たすとイベントがトリガーされる。
- OR: イベントは、ファイルまたはディレクトリ・パスに複数のモニターが存在し、いずれかのモニター内の条件が満たされたときにトリガーされます。
次の例は、条件間のAND関係を示している:
com.instana.plugin.filemonitoring:
enabled: true
file_events:
- event_intervals:
- interval_1: 30 # sec
- interval_2: 90 # sec
- interval_3: 50 # sec
- interval_4: 70 # sec
- path: '/Users/username/Downloads/agent.log' # file path
conditions:
- 'SIZE >= 3000' # file size in bytes
- 'LAST_MODIFIED_TIME < 2D:10H:30M' # last modified Day:Hour:Minute duration
name: 'filesize-filelastmodifiedtime' # name should be unique for each monitor
interval: 'interval_1' # interval variable as described in the event_interval section
severity: 'WARNING' # WARNING or CRITICAL
次の例は、モニター間のOR関係を示している:
com.instana.plugin.filemonitoring:
enabled: true
file_events:
- event_intervals:
- interval_1: 30 # sec
- interval_2: 90 # sec
- interval_3: 50 # sec
- interval_4: 70 # sec
- path: '/Users/username/Downloads/agent.log' # file path
conditions:
- 'SIZE >= 3000' # file size in bytes
- 'LAST_MODIFIED_TIME < 2D:10H:30M' # last modified Day:Hour:Minute duration
name: 'filesizedatemodified' # name should be unique for each monitor
interval: 'interval_1' # interval variable as described in the event_interval section
severity: 'WARNING' # WARNING or CRITICAL
- path: '/Users/username/Downloads/agent.log' # file path
conditions:
- 'CHECKSUM != <Specify SHA-512 Checksum value>' # Use SHA-512 algorithm for generating checksum
name: 'filechecksum' # name should be unique for each monitor
interval: 'interval_2' # interval variable as described in the event_interval section
severity: 'WARNING' # WARNING or CRITICAL
checksum_file_size: 100 # for checking checksum please mention the file size (in MB) limit
checksum_file_size パラメータに上限を設定する必要があります。 この checksum_file_size パラメータに上限を設定しない場合、デフォルト値は10 MBになります。 チェックサム監視の目的で、より小さなファイルを使用することをお勧めします。モニターの設定可能な統計情報
以下の表はモニターの統計情報の概要である:
| 統計 | 説明 |
|---|---|
path |
ファイルまたはディレクトリのパス。 ディレクトリパスを指定する場合は、/で終わる必要があります。 例えば、パス:/Users/Instana/scripts/. ここでscriptsはディレクトリである。 |
conditions |
イベントのトリガーとなる条件。 |
name |
各モニターに固有の名前。 |
interval |
event_intervals内で指定された任意の間隔。 |
severity |
WARNINGまたはCRITICAL |
条件ごとに設定可能な統計情報
以下の表は、コンディションのスタッツの概要である:
| 統計 | 説明 |
|---|---|
SIZE |
SIZE属性は、指定されたファイルサイズに対してトリガーされるイベントを設定します。 サイズはバイト単位でなければならない。 |
FILE_COUNT |
FILE_COUNT属性は、指定されたディレクトリパス内に存在するファイルの数を設定します。 |
LAST_MODIFIED_TIME |
LAST_MODIFIED_TIME 属性は、指定されたディレクトリパス内のファイルの最終更新時刻を設定します。 |
CHECKSUM |
CHECKSUM属性は、指定されたディレクトリパス内に存在するファイルのチェックサムを検証します。 CHECKSUMを作成するには、SHA-512を優先ハッシュアルゴリズムとして使わなければなりません。 |
コンディションの設定可能な統計属性には、以下の演算子を使用できます:
| 演算子 |
|---|
> |
>= |
< |
<= |
= |
!= |
IN |
次の例は、IN演算子の使い方を示している:
com.instana.plugin.filemonitoring:
enabled: true
file_events:
- event_intervals:
- interval_1: 30 # sec
- interval_2: 90 # sec
- interval_3: 50 # sec
- interval_4: 70 # sec
- path: 'agent.log' # file that needs to be searched
conditions:
- 'agent.log IN (/Users/username/Instana/agent-installer/instana-agent/data/log/,/Users/username/Downloads/)' #specify Directory paths for searching the agent.log file
name: 'agent.log in folders' # name should be unique for each monitor
interval: 'interval_1' # interval variable as described in the event_interval section
severity: 'WARNING' # WARNING or CRITICAL
IN を使用できます。 この IN 演算子は、指定されたファイルがディレクトリパス内に存在する場合にのみ、アラートを発生させます。 ディレクトリのパスは、以下の (path1,path2,..) 形式で指定できます。イベントの表示
イベントを表示するには、 Instana のUIにあるナビゲーションメニューから 「イベント」 を選択してください。 すべてのイベントはイベントダッシュボードで見ることができます。