Host
ホスト監視
📚 情報ソース
このドキュメントは以下の情報源を基に作成されています:
主要ソース
補足ソース
- Linux/Windows システム管理ベストプラクティス: リソース監視とパフォーマンスチューニング
- 実運用環境の設定例: マルチプラットフォーム環境での統一的な監視設定
ホスト監視の基本設定
📚 公式ドキュメント: ホスト監視の基本設定
基本設定
| com.instana.plugin.host:
tags:
- 'production'
- 'app1'
- 'datacenter-tokyo'
filesystems:
- 'server:/usr/local/pub'
- 'tmpfs:/mount/point/path'
collectInstalledSoftware: true
collectSystemId: false
interface-inclusive-regex: ''
interface-exclusive-regex: ''
winServiceRegex: ''
|
設定項目の詳細
| 項目 |
説明 |
デフォルト値 |
推奨値 |
tags |
ホストに付与するタグのリスト |
[] |
環境に応じて |
filesystems |
監視対象のファイルシステム |
全て |
重要なものを指定 |
collectInstalledSoftware |
インストール済みソフトウェア情報の収集 |
true |
true |
collectSystemId |
システムID情報の収集 |
false |
セキュリティ要件に応じて |
interface-inclusive-regex |
監視対象ネットワークインターフェースの正規表現(含む) |
.* |
環境に応じて |
interface-exclusive-regex |
監視対象外ネットワークインターフェースの正規表現(除外) |
なし |
不要なものを除外 |
winServiceRegex |
Windows: 監視対象サービスの正規表現 |
.* |
重要なサービスのみ |
高度な設定
| com.instana.plugin.host:
# タグ設定
tags:
- 'production'
- 'web-server'
- 'datacenter-tokyo'
- 'team-platform'
- 'cost-center-1234'
# ファイルシステム監視
filesystems:
- '/dev/sda1'
- '/dev/sdb1'
- 'nfs-server:/export/data'
- 'tmpfs:/tmp'
# ファイルシステム除外
exclude-filesystems:
- '/dev/loop*'
- 'tmpfs:/run'
- 'tmpfs:/sys'
# ソフトウェア情報収集
collectInstalledSoftware: true
software:
include-packages:
- 'nginx'
- 'postgresql'
- 'redis'
exclude-packages:
- 'linux-headers-*'
- '*-dev'
# システムID収集
collectSystemId: false
# ネットワークインターフェース
interface-inclusive-regex: '^(eth|ens|enp)[0-9]+$'
interface-exclusive-regex: '^(lo|docker|veth).*$'
# メトリクス収集間隔
metrics:
cpu:
interval: 1 # 秒
memory:
interval: 1
disk:
interval: 5
network:
interval: 1
# アラート閾値
thresholds:
cpu:
warning: 70 # %
critical: 90
memory:
warning: 80
critical: 95
disk:
warning: 80
critical: 90
load:
warning: 4.0
critical: 8.0
|
設定値の取得方法:
| 項目 |
取得方法 |
tags |
組織の命名規則に従って自由に設定 |
filesystems |
Linux: df -hまたはmount、Windows: wmic logicaldisk get name |
interface-inclusive-regex |
Linux: ip addrまたはifconfig、Windows: ipconfig |
winServiceRegex |
Windows: services.mscまたはGet-Service |
タグの使い方:
- 環境の識別: production、staging、development
- アプリケーションの識別: app1、web-server、database
- 地理的な場所: datacenter-tokyo、region-us-east
- チーム/部門: team-platform、dept-engineering
- コスト管理: cost-center-1234、project-alpha
CPUメトリクス
📚 公式ドキュメント: CPUメトリクス
基本設定
collect-load-average: true
collect-context-switches: true
collect-interrupts: true
# アラート設定
alerts:
high-usage:
threshold: 90 # %
duration: 300 # 秒
| high-load:
threshold: 8.0
duration: 300
high-iowait:
threshold: 30 # %
duration: 60
|
```
Windows サービス監視
📚 公式ドキュメント: Windows サービス監視
基本設定
yaml
com.instana.plugin.host:
winServiceRegex: '.*'
高度な設定
| com.instana.plugin.host:
# Windowsサービス監視
winServiceRegex: '^(IIS|SQL Server|W3SVC|MSSQLSERVER).*'
# サービス詳細設定
windows:
services:
include:
- 'IIS Admin Service'
- 'SQL Server (MSSQLSERVER)'
- 'World Wide Web Publishing Service'
# 自動起動サービスのみ監視
auto-start-only: true
# サービス状態アラート
alerts:
service-stopped:
enabled: true
critical-services:
- 'SQL Server (MSSQLSERVER)'
- 'IIS Admin Service'
|
ファイル監視
📚 公式ドキュメント: ファイル監視
基本設定
| com.instana.plugin.filemonitoring:
enabled: true
file_events:
- event_intervals:
- interval_1: 300
- path: '/var/log/application.log'
conditions:
- 'ERROR'
name: 'Application Error Event'
interval: 'interval_1'
severity: 'high'
checksum_file_size: 10
|
高度な設定
| com.instana.plugin.filemonitoring:
enabled: true
# イベント間隔定義
event_intervals:
- interval_fast: 60 # 1分
- interval_normal: 300 # 5分
- interval_slow: 900 # 15分
# ファイルイベント
file_events:
# アプリケーションエラーログ
- path: '/var/log/application.log'
conditions:
- 'ERROR'
- 'FATAL'
- 'Exception'
name: 'Application Error'
interval: 'interval_fast'
severity: 'high'
# セキュリティログ
- path: '/var/log/auth.log'
conditions:
- 'Failed password'
- 'authentication failure'
name: 'Authentication Failure'
interval: 'interval_fast'
severity: 'critical'
# システムログ
- path: '/var/log/syslog'
conditions:
- 'kernel panic'
- 'Out of memory'
name: 'System Critical'
interval: 'interval_fast'
severity: 'critical'
# 設定ファイル変更
- path: '/etc/nginx/nginx.conf'
monitor_changes: true
name: 'Nginx Config Change'
interval: 'interval_normal'
severity: 'medium'
# ファイルサイズ監視
file_size_monitoring:
- path: '/var/log/application.log'
max_size_mb: 1000
alert_threshold_mb: 800
- path: '/var/log/access.log'
max_size_mb: 5000
alert_threshold_mb: 4000
# チェックサム設定
checksum_file_size: 10 # MB
|
実践的な使用例
1. 本番環境のWebサーバー監視
シナリオ: Nginx Webサーバーの包括的な監視
| com.instana.plugin.host:
# タグ設定
tags:
- 'production'
- 'web-server'
- 'nginx'
- 'datacenter-tokyo'
- 'team-platform'
- 'tier-frontend'
# ファイルシステム監視
filesystems:
- '/dev/sda1' # ルートパーティション
- '/dev/sdb1' # ログパーティション
# ネットワークインターフェース
interface-inclusive-regex: '^eth[0-9]+$'
interface-exclusive-regex: '^(lo|docker).*$'
# ソフトウェア情報収集
collectInstalledSoftware: true
# メモリ監視
# ディスク監視
# ネットワーク監視
# プロセス監視
# ファイル監視
com.instana.plugin.filemonitoring:
enabled: true
file_events:
- path: '/var/log/nginx/error.log'
conditions:
- 'error'
- 'crit'
name: 'Nginx Error'
interval: 'interval_fast'
severity: 'high'
|
2. データベースサーバー監視
シナリオ: PostgreSQLデータベースサーバーの詳細監視
| com.instana.plugin.host:
tags:
- 'production'
- 'database'
- 'postgresql'
- 'datacenter-tokyo'
- 'team-data'
- 'tier-backend'
filesystems:
- '/dev/sda1' # OS
- '/dev/sdb1' # データ
- '/dev/sdc1' # WAL
- '/dev/sdd1' # バックアップ
# メモリ監視(データベースは大量メモリ使用)
# ディスク監視(I/O重視)
# プロセス監視
# ファイル監視
com.instana.plugin.filemonitoring:
enabled: true
file_events:
- path: '/var/log/postgresql/postgresql.log'
conditions:
- 'ERROR'
- 'FATAL'
- 'PANIC'
name: 'PostgreSQL Error'
interval: 'interval_fast'
severity: 'critical'
- path: '/var/lib/postgresql/data/postgresql.conf'
monitor_changes: true
name: 'PostgreSQL Config Change'
interval: 'interval_normal'
severity: 'medium'
|
3. Kubernetesワーカーノード監視
シナリオ: Kubernetesワーカーノードの包括的な監視
| com.instana.plugin.host:
tags:
- 'production'
- 'kubernetes'
- 'worker-node'
- 'cluster-prod-1'
- 'datacenter-tokyo'
# コンテナ用ファイルシステム
filesystems:
- '/dev/sda1' # OS
- '/dev/sdb1' # /var/lib/docker
# ネットワークインターフェース(Kubernetesネットワーク)
interface-inclusive-regex: '^(eth|ens|cni)[0-9]+$'
interface-exclusive-regex: '^(lo|docker|veth|flannel).*$'
# メモリ監視(コンテナメモリ)
# ディスク監視(コンテナイメージとボリューム)
# ネットワーク監視(Pod間通信)
# プロセス監視(Kubernetesコンポーネント)
### 4. Windowsサーバー監視
**シナリオ:** Windows Server 2019でIISとSQL Serverを実行
```yaml
com.instana.plugin.host:
tags:
- 'production'
- 'windows-server'
- 'iis'
- 'sql-server'
- 'datacenter-tokyo'
# Windowsサービス監視
winServiceRegex: '^(IIS|SQL Server|W3SVC|MSSQLSERVER).*'
# ソフトウェア情報収集
collectInstalledSoftware: true
# Windows固有設定
windows:
services:
include:
- 'IIS Admin Service'
- 'SQL Server (MSSQLSERVER)'
- 'SQL Server Agent (MSSQLSERVER)'
- 'World Wide Web Publishing Service'
auto-start-only: true
alerts:
service-stopped:
enabled: true
critical-services:
- 'SQL Server (MSSQLSERVER)'
- 'IIS Admin Service'
# パフォーマンスカウンター
performance-counters:
- counter: '\\Processor(_Total)\\% Processor Time'
interval: 1
- counter: '\\Memory\\Available MBytes'
interval: 1
- counter: '\\PhysicalDisk(_Total)\\Disk Reads/sec'
interval: 5
- counter: '\\PhysicalDisk(_Total)\\Disk Writes/sec'
interval: 5
# メモリ監視
# ディスク監視
# ファイル監視
com.instana.plugin.filemonitoring:
enabled: true
file_events:
- path: 'C:\inetpub\logs\LogFiles\W3SVC1\*.log'
conditions:
- '500'
- '503'
name: 'IIS Error'
interval: 'interval_fast'
severity: 'high'
- path: 'C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\Log\ERRORLOG'
conditions:
- 'Error'
- 'Failed'
name: 'SQL Server Error'
interval: 'interval_fast'
severity: 'high'
|
5. ハイブリッドクラウド環境の統一監視
シナリオ: オンプレミス、AWS、Azureにまたがるサーバー群の統一監視
| # オンプレミスサーバー
com.instana.plugin.host:
tags:
- 'production'
- 'location-onprem'
- 'datacenter-tokyo'
- 'web-server'
filesystems:
- '/dev/sda1'
interface-inclusive-regex: '^eth[0-9]+$'
# AWSサーバー
com.instana.plugin.host:
tags:
- 'production'
- 'location-aws'
- 'region-us-east-1'
- 'availability-zone-us-east-1a'
- 'instance-type-t3.large'
- 'web-server'
# AWS固有メタデータ
aws:
collect-metadata: true
collect-tags: true
filesystems:
- '/dev/xvda1'
- '/dev/xvdb1' # EBS
# Azureサーバー
com.instana.plugin.host:
tags:
- 'production'
- 'location-azure'
- 'region-japaneast'
- 'vm-size-Standard_D4s_v3'
- 'web-server'
# Azure固有メタデータ
azure:
collect-metadata: true
collect-tags: true
filesystems:
- '/dev/sda1'
- '/dev/sdb1' # Managed Disk
# 統一メトリクス収集
---
## ベストプラクティス
### 1. タグ戦略
#### 階層的なタグ構造
```yaml
com.instana.plugin.host:
tags:
# レイヤー1: 環境
- 'env:production'
# レイヤー2: ロケーション
- 'location:onprem'
- 'datacenter:tokyo'
- 'rack:r01'
# レイヤー3: 役割
- 'role:web-server'
- 'tier:frontend'
# レイヤー4: アプリケーション
- 'app:ecommerce'
- 'service:checkout'
# レイヤー5: チーム/コスト
- 'team:platform'
- 'cost-center:1234'
- 'project:alpha'
|
タグ命名規則
| カテゴリ |
形式 |
例 |
| 環境 |
env:<value> |
env:production |
| ロケーション |
location:<value> |
location:aws |
| 役割 |
role:<value> |
role:database |
| アプリケーション |
app:<value> |
app:myapp |
| チーム |
team:<value> |
team:platform |
2. メトリクス収集間隔の最適化
推奨収集間隔
| メトリクスタイプ |
推奨間隔 |
理由 |
| CPU |
1秒 |
変動が激しい |
| メモリ |
1秒 |
リアルタイム監視が重要 |
| ディスク使用率 |
5-10秒 |
変動が緩やか |
| ディスクI/O |
1-5秒 |
パフォーマンス監視に重要 |
| ネットワーク |
1秒 |
トラフィック監視に重要 |
| プロセス |
5-10秒 |
変動が緩やか |
| # 高トラフィック環境
com.instana.plugin.host:
metrics:
cpu:
interval: 1
memory:
interval: 1
disk:
interval: 5
network:
interval: 1
# 低トラフィック環境
com.instana.plugin.host:
metrics:
cpu:
interval: 5
memory:
interval: 5
disk:
interval: 10
network:
interval: 5
|
3. アラート閾値の設定
環境別の推奨閾値
本番環境(厳しい閾値):
| com.instana.plugin.host:
thresholds:
cpu:
warning: 70
critical: 85
memory:
warning: 80
critical: 90
disk:
warning: 75
critical: 85
load:
warning: 3.0
critical: 6.0
|
開発環境(緩い閾値):
| com.instana.plugin.host:
thresholds:
cpu:
warning: 85
critical: 95
memory:
warning: 90
critical: 95
disk:
warning: 85
critical: 95
load:
warning: 8.0
critical: 12.0
|
4. ファイルシステム監視
重要なファイルシステムのみ監視
| com.instana.plugin.host:
# 監視対象
filesystems:
- '/dev/sda1' # ルート
- '/dev/sdb1' # データ
- '/dev/sdc1' # ログ
- 'nfs-server:/export/data' # NFS
# 除外
exclude-filesystems:
- '/dev/loop*' # ループバックデバイス
- 'tmpfs:/run' # 一時ファイルシステム
- 'tmpfs:/sys'
- 'tmpfs:/dev/shm'
- 'overlay' # Dockerオーバーレイ
|
5. ネットワークインターフェース監視
物理インターフェースのみ監視
| com.instana.plugin.host:
# 物理インターフェース
interface-inclusive-regex: '^(eth|ens|enp|eno)[0-9]+$'
# 仮想インターフェースを除外
interface-exclusive-regex: '^(lo|docker|veth|br-|flannel|cni|tun|tap).*$'
|
トラブルシューティング
問題1: メトリクスが収集されない
症状:
- ホストメトリクスが表示されない
- CPUやメモリのグラフが空
原因:
- エージェントが起動していない
- 設定が間違っている
- 権限が不足している
解決方法:
| # 1. エージェントの状態確認
systemctl status instana-agent
# 2. エージェントログを確認
tail -f /opt/instana/agent/data/log/agent.log | grep -i host
# 3. 設定ファイルを確認
cat /opt/instana/agent/etc/instana/configuration.yaml | grep -A 20 "com.instana.plugin.host"
# 4. 権限を確認
ls -l /proc
ls -l /sys
# 5. エージェントを再起動
systemctl restart instana-agent
# 6. メトリクスを手動確認
curl http://localhost:42699/com.instana.plugin.host/metrics
|
問題2: ディスク使用率が正しく表示されない
症状:
- 一部のファイルシステムが表示されない
- ディスク使用率が0%と表示される
原因:
- ファイルシステムが除外されている
- マウントポイントが認識されていない
解決方法:
| # 1. マウントポイントを確認
df -h
mount | grep -v tmpfs
# 2. 設定を更新
cat > /opt/instana/agent/etc/instana/configuration.yaml <<EOF
com.instana.plugin.host:
filesystems:
- '/dev/sda1'
- '/dev/sdb1'
- 'nfs-server:/export/data'
exclude-filesystems:
- '/dev/loop*'
- 'tmpfs'
EOF
# 3. エージェントを再起動
systemctl restart instana-agent
# 4. メトリクスを確認
curl http://localhost:42699/com.instana.plugin.host/disk
|
問題3: ネットワークメトリクスが不完全
症状:
- 一部のネットワークインターフェースが表示されない
- ネットワークトラフィックが0
原因:
- インターフェースが除外されている
- 正規表現が間違っている
解決方法:
| # 1. ネットワークインターフェースを確認
ip addr
ifconfig -a
# 2. 設定を更新
cat > /opt/instana/agent/etc/instana/configuration.yaml <<EOF
com.instana.plugin.host:
interface-inclusive-regex: '^(eth|ens|enp)[0-9]+$'
interface-exclusive-regex: '^(lo|docker|veth).*$'
EOF
# 3. エージェントを再起動
systemctl restart instana-agent
# 4. メトリクスを確認
curl http://localhost:42699/com.instana.plugin.host/network
|
問題4: プロセス監視が動作しない
症状:
- プロセスが検出されない
- プロセスメトリクスが表示されない
原因:
- プロセス名が間違っている
- 正規表現が間違っている
- 権限が不足している
解決方法:
| # 1. プロセスを確認
ps aux | grep nginx
ps aux | grep postgres
# 2. プロセスのコマンドラインを確認
ps -eo pid,cmd | grep nginx
# 3. 設定を更新
cat > /opt/instana/agent/etc/instana/configuration.yaml <<EOF
# 4. エージェントを再起動
systemctl restart instana-agent
# 5. プロセスメトリクスを確認
curl http://localhost:42699/com.instana.plugin.host.process/processes
|
問題5: ファイル監視イベントが発生しない
症状:
- ログファイルのエラーが検出されない
- ファイル変更イベントが表示されない
原因:
- ファイルパスが間違っている
- 条件パターンが間違っている
- ファイルへのアクセス権限がない
解決方法:
| # 1. ファイルの存在を確認
ls -l /var/log/application.log
# 2. ファイルの権限を確認
ls -l /var/log/application.log
# 3. ファイル内容を確認
tail -f /var/log/application.log | grep ERROR
# 4. 設定を更新
cat > /opt/instana/agent/etc/instana/configuration.yaml <<EOF
com.instana.plugin.filemonitoring:
enabled: true
file_events:
- path: '/var/log/application.log'
conditions:
- 'ERROR'
- 'FATAL'
name: 'Application Error'
interval: 'interval_fast'
severity: 'high'
event_intervals:
- interval_fast: 60
EOF
# 5. エージェントを再起動
systemctl restart instana-agent
# 6. ログを確認
tail -f /opt/instana/agent/data/log/agent.log | grep -i filemonitoring
|
FAQ
Q1: 全てのファイルシステムを監視すべきですか?
A: いいえ、重要なファイルシステムのみを監視すべきです。
| # 推奨設定
com.instana.plugin.host:
filesystems:
- '/dev/sda1' # ルート
- '/dev/sdb1' # データ
exclude-filesystems:
- '/dev/loop*'
- 'tmpfs'
- 'overlay'
|
Q2: タグはいくつまで設定できますか?
A: 制限はありませんが、5-10個程度が管理しやすいです。
| com.instana.plugin.host:
tags:
- 'env:production'
- 'location:tokyo'
- 'role:web-server'
- 'app:myapp'
- 'team:platform'
|
Q3: メトリクス収集間隔を変更するとパフォーマンスに影響しますか?
A: はい、間隔を短くするとオーバーヘッドが増加します。
| 間隔 |
オーバーヘッド |
| 1秒 |
1-2% |
| 5秒 |
<1% |
| 10秒 |
<0.5% |
Q4: Windowsサービス監視で全サービスを監視すべきですか?
A: いいえ、重要なサービスのみを監視すべきです。
| com.instana.plugin.host:
winServiceRegex: '^(IIS|SQL Server|W3SVC).*'
|
Q5: ファイル監視でログファイルのローテーションに対応できますか?
A: はい、ワイルドカードを使用できます。
| com.instana.plugin.filemonitoring:
file_events:
- path: '/var/log/application*.log'
conditions:
- 'ERROR'
|
Q6: プロセス監視でコンテナ内のプロセスも監視できますか?
A: はい、ホストから見えるプロセスは全て監視できます。
| ### Q7: ネットワークインターフェースの除外パターンは?
**A:** 仮想インターフェースを除外することを推奨します。
```yaml
com.instana.plugin.host:
interface-exclusive-regex: '^(lo|docker|veth|br-|flannel|cni).*$'
|
参考リンク
公式ドキュメント