Appserver
アプリケーションサーバー
📚 情報ソース
このドキュメントは以下の情報源を基に作成されています:
主要ソース
補足ソース
- 各アプリケーションサーバー公式ドキュメント: JMX設定とメトリクス仕様
- 実運用環境の設定例: ロードバランサー構成とパフォーマンスチューニング
Oracle WebLogic
📚 公式ドキュメント: Oracle WebLogic
| com.instana.plugin.weblogic:
poll_rate: 1 # 秒単位(デフォルト1秒)
|
自動検出:
- WebLogicサーバーは自動的に検出されます
- JMX経由でメトリクスを収集
Glassfish
📚 公式ドキュメント: Glassfish
| com.instana.plugin.glassfish:
poll_rate: 1 # 秒単位(デフォルト1秒)
|
対応バージョン:
- GlassFish 4.x以降
- Payara Server
Mule ESB
📚 公式ドキュメント: Mule ESB
| com.instana.plugin.mule:
enabled: true
poll_rate: 1 # 秒単位(デフォルト1秒)
|
Spring Boot
📚 公式ドキュメント: Spring Boot
| com.instana.plugin.springboot:
metrics-interval: 1 # メトリクス収集間隔(秒)
health-interval: 30 # ヘルスチェック間隔(秒)
|
Spring Boot Actuator連携:
- Actuatorエンドポイントから自動収集
- /actuator/metrics
- /actuator/health
Liferay
📚 公式ドキュメント: Liferay
| com.instana.plugin.liferay:
poll_rate: 1 # 秒単位(デフォルト1秒)
|
Dropwizard
📚 公式ドキュメント: Dropwizard
| com.instana.plugin.dropwizard:
metricsRegex: '.*' # 監視対象メトリクスの正規表現
poll_rate: 1 # 秒単位(デフォルト1秒)
|
メトリクスフィルタリング:
| # 特定のメトリクスのみ監視
metricsRegex: 'com\.example\..*'
|
Finagle
📚 公式ドキュメント: Finagle
| com.instana.plugin.finagle:
poll_rate: 1 # 秒単位(デフォルト1秒)
|
Microsoft SQL Server
📚 公式ドキュメント: Microsoft SQL Server
| com.instana.plugin.mssql:
local:
- instance: 'MSSQLSERVER'
user: 'monitoring_user'
password: 'sql_password'
port: '1433'
poll_rate: 10
|
監視ユーザーの作成:
| -- SQL Serverで実行
CREATE LOGIN monitoring_user WITH PASSWORD = 'sql_password';
CREATE USER monitoring_user FOR LOGIN monitoring_user;
-- VIEW SERVER STATE権限を付与
GRANT VIEW SERVER STATE TO monitoring_user;
GRANT VIEW ANY DEFINITION TO monitoring_user;
-- 各データベースへのアクセス権限
USE [YourDatabase];
CREATE USER monitoring_user FOR LOGIN monitoring_user;
GRANT SELECT TO monitoring_user;
|
SAP HANA
📚 公式ドキュメント: SAP HANA
| com.instana.plugin.saphana:
local:
singleContainer:
user: 'SYSTEM'
password: 'hana_password'
|
設定項目の説明:
- local: ローカルSAP HANAインスタンスの設定
- singleContainer: シングルコンテナデータベースの設定
- user: SAP HANAデータベースユーザー名(デフォルト: SYSTEM)
- password: データベースユーザーのパスワード
監視ユーザーの作成:
| -- SAP HANA Studio または hdbsql で実行
CREATE USER monitoring_user PASSWORD "hana_password" NO FORCE_FIRST_PASSWORD_CHANGE;
-- 必要な権限を付与
GRANT CATALOG READ TO monitoring_user;
GRANT MONITORING TO monitoring_user;
GRANT SELECT ON SCHEMA _SYS_STATISTICS TO monitoring_user;
|
マルチテナント環境の設定:
| com.instana.plugin.saphana:
local:
multiContainer:
systemDB:
user: 'SYSTEM'
password: 'systemdb_password'
tenantDBs:
- name: 'TENANT1'
user: 'monitoring_user'
password: 'tenant1_password'
- name: 'TENANT2'
user: 'monitoring_user'
password: 'tenant2_password'
|
取得方法:
- user/password: SAP HANA管理者から取得、または新規作成
- テナント名: SAP HANA Cockpitまたは SELECT DATABASE_NAME FROM SYS.M_DATABASES; で確認
Redis
📚 公式ドキュメント: Redis
| com.instana.plugin.redis:
username: 'redis_user'
password: 'redis_password'
enabled: true
poll_rate: 10
monitor:
- db: 0
key: 'important_key'
|
設定項目の説明:
- username: Redis 6.0以降のACL認証用ユーザー名(オプション)
- password: Redis認証パスワード(requirepass設定時)
- enabled: Redisセンサーの有効化(デフォルト: true)
- poll_rate: メトリクス収集間隔(秒単位、デフォルト: 10秒)
- monitor: 特定のキーを監視する設定
- db: データベース番号(0-15)
- key: 監視対象のキー名
Redis認証の設定:
| # redis.conf で設定
requirepass your_redis_password
# Redis 6.0以降のACL設定
ACL SETUSER monitoring_user on >redis_password ~* +@read +@dangerous +info +config|get
|
複数Redisインスタンスの監視:
| com.instana.plugin.redis:
enabled: true
instances:
- host: 'redis-master.example.com'
port: 6379
password: 'master_password'
poll_rate: 10
- host: 'redis-replica.example.com'
port: 6379
password: 'replica_password'
poll_rate: 30
|
取得方法:
- password: redis.confのrequirepass設定値、またはRedis管理者から取得
- username: Redis 6.0以降でACL使用時に設定
Elasticsearch
📚 公式ドキュメント: Elasticsearch
| com.instana.plugin.elasticsearch:
enabled: true
indicesRegex: '.*'
poll_rate: 1
|
設定項目の説明:
- enabled: Elasticsearchセンサーの有効化(デフォルト: true)
- indicesRegex: 監視対象インデックスの正規表現パターン(デフォルト: '.*' = 全て)
- poll_rate: メトリクス収集間隔(秒単位、デフォルト: 1秒)
認証が必要な場合:
| com.instana.plugin.elasticsearch:
enabled: true
indicesRegex: '.*'
poll_rate: 1
username: 'elastic'
password: 'elastic_password'
ssl:
enabled: true
verify: true
ca_cert: '/path/to/ca.crt'
|
特定インデックスのみ監視:
| com.instana.plugin.elasticsearch:
enabled: true
indicesRegex: '^(logs-.*|metrics-.*|apm-.*)$' # logsとmetricsとapmで始まるインデックスのみ
poll_rate: 5
|
システムインデックスを除外:
| com.instana.plugin.elasticsearch:
enabled: true
indicesRegex: '^(?!\.).+$' # ドットで始まるシステムインデックスを除外
poll_rate: 1
|
取得方法:
- username/password: Elasticsearch Security設定から取得、またはKibanaで作成
- indicesRegex: 監視要件に応じて設定(全インデックス監視は負荷が高い場合あり)
Cassandra
📚 公式ドキュメント: Cassandra
| com.instana.plugin.cassandra:
poll_rate: 1
tags:
- 'production'
- 'state_storage'
|
設定項目の説明:
- poll_rate: メトリクス収集間隔(秒単位、デフォルト: 1秒)
- tags: カスタムタグ(分類・フィルタリング用)
JMX認証が必要な場合:
| com.instana.plugin.cassandra:
poll_rate: 1
jmx:
host: 'localhost'
port: 7199
username: 'cassandra_jmx_user'
password: 'jmx_password'
tags:
- 'production'
- 'state_storage'
|
複数Cassandraノードの監視:
| com.instana.plugin.cassandra:
poll_rate: 5
nodes:
- host: 'cassandra-node1.example.com'
jmx_port: 7199
tags:
- 'datacenter1'
- 'rack1'
- host: 'cassandra-node2.example.com'
jmx_port: 7199
tags:
- 'datacenter1'
- 'rack2'
|
監視ユーザーの作成(JMX認証):
| # cassandra-env.sh で設定
JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.authenticate=true"
JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.password.file=/etc/cassandra/jmxremote.password"
JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.access.file=/etc/cassandra/jmxremote.access"
# jmxremote.password
monitoring_user jmx_password
# jmxremote.access
monitoring_user readonly
|
取得方法:
- JMX設定: cassandra-env.shまたはcassandra.yamlから確認
- ポート番号: デフォルト7199、設定ファイルで確認
ClickHouse
📚 公式ドキュメント: ClickHouse
| com.instana.plugin.clickhouse:
enabled: true
user: 'default'
password: 'clickhouse_password'
protocol: 'http'
host: 'localhost'
httpPort: 8123
poll_rate: 5
monitorTables:
- 'database.table1'
- 'database.table2'
|
設定項目の説明:
- enabled: ClickHouseセンサーの有効化(デフォルト: true)
- user: ClickHouseユーザー名(デフォルト: default)
- password: ユーザーのパスワード
- protocol: 接続プロトコル(http または https)
- host: ClickHouseサーバーのホスト名またはIPアドレス
- httpPort: HTTPインターフェースのポート番号(デフォルト: 8123)
- poll_rate: メトリクス収集間隔(秒単位、デフォルト: 5秒)
- monitorTables: 監視対象テーブルのリスト(database.table形式)
監視ユーザーの作成:
| -- ClickHouseで実行
CREATE USER monitoring_user IDENTIFIED BY 'clickhouse_password';
-- 必要な権限を付与
GRANT SELECT ON system.* TO monitoring_user;
GRANT SELECT ON information_schema.* TO monitoring_user;
GRANT SHOW TABLES ON *.* TO monitoring_user;
GRANT SHOW DATABASES ON *.* TO monitoring_user;
-- 特定のデータベースへのアクセス権限
GRANT SELECT ON database.* TO monitoring_user;
|
HTTPS接続の設定:
| com.instana.plugin.clickhouse:
enabled: true
user: 'monitoring_user'
password: 'clickhouse_password'
protocol: 'https'
host: 'clickhouse.example.com'
httpPort: 8443
ssl:
verify: true
ca_cert: '/path/to/ca.crt'
poll_rate: 5
|
複数ClickHouseサーバーの監視:
| com.instana.plugin.clickhouse:
enabled: true
instances:
- name: 'clickhouse-prod-1'
host: 'ch-prod-1.example.com'
httpPort: 8123
user: 'monitoring_user'
password: 'ch_password'
monitorTables:
- 'analytics.events'
- 'analytics.users'
- name: 'clickhouse-prod-2'
host: 'ch-prod-2.example.com'
httpPort: 8123
user: 'monitoring_user'
password: 'ch_password'
monitorTables:
- 'analytics.events'
- 'analytics.users'
|
取得方法:
- user/password: ClickHouse管理者から取得、または新規作成
- httpPort: config.xmlの<http_port>設定値(デフォルト: 8123)
- monitorTables: 監視が必要なテーブルをデータベース管理者と相談して決定
Apache Tomcat
📚 公式ドキュメント: Apache Tomcat
基本設定
| com.instana.plugin.tomcat:
enabled: true
poll_rate: 5 # 秒単位
|
設定項目の詳細
| 設定項目 |
説明 |
デフォルト値 |
推奨値 |
enabled |
Tomcatセンサーの有効化 |
true |
true |
poll_rate |
メトリクス収集間隔(秒) |
5 |
5-15秒 |
jmx_host |
JMXホスト |
localhost |
環境に応じて |
jmx_port |
JMXポート |
9012 |
環境に応じて |
JMX設定
| # Tomcat起動スクリプト(catalina.sh)に追加
CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote"
CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote.port=9012"
CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote.ssl=false"
CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote.authenticate=false"
|
高度な設定
| com.instana.plugin.tomcat:
enabled: true
poll_rate: 10
# JMX接続
jmx:
host: "localhost"
port: 9012
username: "monitoring"
password: "${vault:secret/tomcat#jmx_password}"
ssl: false
# アプリケーション監視
applications:
include:
- "/myapp"
- "/api"
exclude:
- "/test"
# スレッドプール監視
thread_pools:
- "http-nio-8080"
- "http-nio-8443"
|
Nginx
📚 公式ドキュメント: Nginx
基本設定
| com.instana.plugin.nginx:
enabled: true
poll_rate: 5
|
Nginx Status Module設定
| # nginx.conf
server {
listen 8080;
server_name localhost;
location /nginx_status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}
}
|
設定項目の詳細
| 設定項目 |
説明 |
デフォルト値 |
推奨値 |
enabled |
Nginxセンサーの有効化 |
true |
true |
poll_rate |
メトリクス収集間隔(秒) |
5 |
5-15秒 |
status_url |
Statusエンドポイント |
http://localhost/nginx_status |
環境に応じて |
高度な設定
| com.instana.plugin.nginx:
enabled: true
poll_rate: 10
# Status URL設定
status_url: "http://localhost:8080/nginx_status"
# 複数インスタンス
instances:
- name: "nginx-frontend"
status_url: "http://localhost:8080/nginx_status"
tags:
- "frontend"
- "production"
- name: "nginx-api"
status_url: "http://localhost:8081/nginx_status"
tags:
- "api"
- "production"
|
Apache HTTP Server
📚 公式ドキュメント: Apache HTTP Server
基本設定
| #### Apache Status Module設定
```apache
# httpd.conf
<Location "/server-status">
SetHandler server-status
Require ip 127.0.0.1
</Location>
# mod_statusを有効化
LoadModule status_module modules/mod_status.so
ExtendedStatus On
|
設定項目の詳細
| 設定項目 |
説明 |
デフォルト値 |
推奨値 |
enabled |
Apacheセンサーの有効化 |
true |
true |
poll_rate |
メトリクス収集間隔(秒) |
5 |
5-15秒 |
status_url |
Statusエンドポイント |
http://localhost/server-status?auto |
環境に応じて |
高度な設定
| ### JBoss/WildFly
📚 **公式ドキュメント:** [JBoss/WildFly](https://www.ibm.com/docs/en/instana-observability/jboss)
#### 基本設定
```yaml
#### 設定項目の詳細
| 設定項目 | 説明 | デフォルト値 | 推奨値 |
|---------|------|------------|--------|
| `enabled` | JBossセンサーの有効化 | `true` | `true` |
| `poll_rate` | メトリクス収集間隔(秒) | `5` | 5-15秒 |
| `management_host` | 管理インターフェースホスト | `localhost` | 環境に応じて |
| `management_port` | 管理インターフェースポート | `9990` | 環境に応じて |
#### 高度な設定
```yaml
### IBM WebSphere
📚 **公式ドキュメント:** [IBM WebSphere](https://www.ibm.com/docs/en/instana-observability)
#### 基本設定
```yaml
com.instana.plugin.websphere:
enabled: true
poll_rate: 10
|
設定項目の詳細
| 設定項目 |
説明 |
デフォルト値 |
推奨値 |
enabled |
WebSphereセンサーの有効化 |
true |
true |
poll_rate |
メトリクス収集間隔(秒) |
10 |
10-30秒 |
soap_host |
SOAPコネクタホスト |
localhost |
環境に応じて |
soap_port |
SOAPコネクタポート |
8880 |
環境に応じて |
高度な設定
| com.instana.plugin.websphere:
enabled: true
poll_rate: 15
# SOAP接続
soap:
host: "localhost"
port: 8880
username: "wasadmin"
password: "${vault:secret/websphere#password}"
ssl: true
truststore: "/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/etc/trust.p12"
truststore_password: "${vault:secret/websphere#truststore_password}"
# セル、ノード、サーバー
cell: "Cell01"
node: "Node01"
server: "server1"
|
実践的な使用例
1. 本番環境のTomcatクラスタ監視
シナリオ: ロードバランサー配下の3台のTomcatサーバーを監視
| com.instana.plugin.tomcat:
enabled: true
poll_rate: 10
# JMX接続(認証あり)
jmx:
host: "localhost"
port: 9012
username: "monitoring"
password: "${vault:secret/tomcat#jmx_password}"
ssl: true
truststore: "/opt/tomcat/conf/truststore.jks"
truststore_password: "${vault:secret/tomcat#truststore_password}"
# アプリケーション監視
applications:
include:
- "/myapp"
- "/api"
- "/admin"
exclude:
- "/test"
- "/dev"
# スレッドプール監視
thread_pools:
- "http-nio-8080"
- "http-nio-8443"
# アラート閾値
thresholds:
busy_threads: 150 # 150スレッド以上で警告
max_threads: 200
# コネクタ監視
connectors:
- name: "http-8080"
max_connections: 10000
- name: "https-8443"
max_connections: 5000
# タグ設定
com.instana.plugin.host:
tags:
environment: "production"
cluster: "tomcat-web"
role: "application-server"
|
JMX認証設定(Tomcat):
| # setenv.sh
CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote"
CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote.port=9012"
CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote.ssl=true"
CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote.authenticate=true"
CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote.password.file=/opt/tomcat/conf/jmxremote.password"
CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote.access.file=/opt/tomcat/conf/jmxremote.access"
CATALINA_OPTS="$CATALINA_OPTS -Djavax.net.ssl.keyStore=/opt/tomcat/conf/keystore.jks"
CATALINA_OPTS="$CATALINA_OPTS -Djavax.net.ssl.keyStorePassword=keystorepass"
# jmxremote.password
monitoring monitoringpass
# jmxremote.access
monitoring readonly
|
2. Nginxリバースプロキシの監視
シナリオ: 複数のバックエンドサービスへのリバースプロキシとして動作するNginxを監視
| com.instana.plugin.nginx:
enabled: true
poll_rate: 5
# メインインスタンス
status_url: "http://localhost:8080/nginx_status"
# 複数のバーチャルホスト監視
virtual_hosts:
- name: "web-frontend"
status_url: "http://localhost:8080/nginx_status"
upstream: "web-backend"
tags:
- "frontend"
- "production"
- name: "api-gateway"
status_url: "http://localhost:8081/nginx_status"
upstream: "api-backend"
tags:
- "api"
- "production"
- name: "admin-portal"
status_url: "http://localhost:8082/nginx_status"
upstream: "admin-backend"
tags:
- "admin"
- "production"
# アップストリーム監視
upstreams:
- name: "web-backend"
servers:
- "web1.example.com:8080"
- "web2.example.com:8080"
- "web3.example.com:8080"
- name: "api-backend"
servers:
- "api1.example.com:8080"
- "api2.example.com:8080"
# タグ設定
com.instana.plugin.host:
tags:
environment: "production"
role: "reverse-proxy"
tier: "edge"
|
Nginx設定(nginx.conf):
| # メインサーバー
server {
listen 8080;
server_name localhost;
location /nginx_status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}
}
# Webフロントエンド
upstream web-backend {
server web1.example.com:8080;
server web2.example.com:8080;
server web3.example.com:8080;
}
server {
listen 80;
server_name www.example.com;
location / {
proxy_pass http://web-backend;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
# APIゲートウェイ
upstream api-backend {
server api1.example.com:8080;
server api2.example.com:8080;
}
server {
listen 443 ssl;
server_name api.example.com;
ssl_certificate /etc/nginx/ssl/cert.pem;
ssl_certificate_key /etc/nginx/ssl/key.pem;
location / {
proxy_pass http://api-backend;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
|
3. Apache HTTP Serverのマルチサイト監視
シナリオ: 複数のバーチャルホストを持つApache HTTP Serverを監視
| # タグ設定
com.instana.plugin.host:
tags:
environment: "production"
role: "web-server"
server_type: "apache"
|
Apache設定(httpd.conf):
| # mod_statusを有効化
LoadModule status_module modules/mod_status.so
ExtendedStatus On
# メインサーバーのステータス
<Location "/server-status">
SetHandler server-status
Require ip 127.0.0.1
# 認証が必要な場合
AuthType Basic
AuthName "Server Status"
AuthUserFile /etc/apache2/.htpasswd
Require valid-user
</Location>
# バーチャルホスト
<VirtualHost *:80>
ServerName www.example.com
DocumentRoot /var/www/html/example
<Location "/server-status">
SetHandler server-status
Require ip 127.0.0.1
</Location>
</VirtualHost>
<VirtualHost *:80>
ServerName blog.example.com
DocumentRoot /var/www/html/blog
<Location "/server-status">
SetHandler server-status
Require ip 127.0.0.1
</Location>
</VirtualHost>
|
4. Spring Bootマイクロサービスの監視
シナリオ: 複数のSpring Bootマイクロサービスを統合監視
| com.instana.plugin.springboot:
enabled: true
# メトリクス収集間隔
metrics-interval: 5
health-interval: 30
# Actuatorエンドポイント
actuator:
base-path: "/actuator"
endpoints:
- "health"
- "metrics"
- "info"
- "env"
- "beans"
- "mappings"
# サービス別設定
services:
- name: "user-service"
port: 8081
actuator-port: 8081
tags:
- "core-service"
- "production"
# カスタムメトリクス
custom-metrics:
- "user.registrations"
- "user.logins"
- "user.active.sessions"
- name: "order-service"
port: 8082
actuator-port: 8082
tags:
- "core-service"
- "production"
custom-metrics:
- "order.created"
- "order.completed"
- "order.cancelled"
- name: "payment-service"
port: 8083
actuator-port: 8083
tags:
- "critical-service"
- "production"
custom-metrics:
- "payment.processed"
- "payment.failed"
- "payment.refunded"
# ヘルスチェック設定
health:
indicators:
- "db"
- "redis"
- "kafka"
- "diskSpace"
# アラート閾値
thresholds:
response_time_ms: 1000
error_rate: 0.01 # 1%
# 分散トレーシング
# タグ設定
com.instana.plugin.host:
tags:
environment: "production"
architecture: "microservices"
framework: "spring-boot"
|
Spring Boot設定(application.yml):
| # Actuator設定
management:
endpoints:
web:
exposure:
include: health,metrics,info,env,beans,mappings
base-path: /actuator
endpoint:
health:
show-details: always
metrics:
export:
simple:
enabled: true
tags:
application: ${spring.application.name}
environment: production
# カスタムメトリクス
spring:
application:
name: user-service
|
5. JBoss/WildFlyクラスタの監視
シナリオ: ドメインモードで動作するJBoss/WildFlyクラスタを監視
| # タグ設定
com.instana.plugin.host:
tags:
environment: "production"
cluster: "jboss-main"
mode: "domain"
|
ベストプラクティス
1. パフォーマンス最適化
ポーリング間隔の最適化
| アプリケーションサーバー |
推奨ポーリング間隔 |
理由 |
| Tomcat |
5-15秒 |
JMXメトリクスは軽量 |
| Nginx |
5-10秒 |
stub_statusは高速 |
| Apache HTTP |
5-15秒 |
mod_statusは軽量 |
| JBoss/WildFly |
10-30秒 |
管理APIは重い |
| WebSphere |
15-60秒 |
SOAPコネクタは重い |
| Spring Boot |
5-15秒 |
Actuatorは軽量 |
JMX接続の最適化
| # Tomcat - 効率的なJMX設定
com.instana.plugin.tomcat:
poll_rate: 10
jmx:
# 接続プール
connection_pool:
size: 5
timeout: 30
# キャッシュ設定
cache:
enabled: true
ttl: 60 # 60秒
# 収集するMBean
mbeans:
include:
- "Catalina:type=ThreadPool,*"
- "Catalina:type=GlobalRequestProcessor,*"
- "Catalina:type=Manager,*"
exclude:
- "Catalina:type=Valve,*"
|
2. セキュリティ
JMX認証の設定
| # Tomcat - JMX認証
# jmxremote.password
monitoring readonly_password
# jmxremote.access
monitoring readonly
# ファイル権限
chmod 600 /opt/tomcat/conf/jmxremote.password
chown tomcat:tomcat /opt/tomcat/conf/jmxremote.password
|
SSL/TLS設定
| # Tomcat - SSL/TLS JMX
com.instana.plugin.tomcat:
jmx:
ssl: true
truststore: "/opt/tomcat/conf/truststore.jks"
truststore_password: "${vault:secret/tomcat#truststore_password}"
hostname_verification: true
|
最小権限の原則
Tomcat JMX:
| # jmxremote.access
monitoring readonly # 読み取り専用
|
JBoss/WildFly:
| # 監視用ユーザーの作成
./add-user.sh -a -u monitoring -p password -g Monitor
|
3. 高可用性構成
ロードバランサー配下の監視
| # 各Tomcatインスタンスに個別のタグ
com.instana.plugin.tomcat:
enabled: true
com.instana.plugin.host:
tags:
environment: "production"
cluster: "tomcat-web"
instance: "tomcat-1" # インスタンスごとに変更
lb_pool: "web-pool"
|
フェイルオーバー監視
| # プライマリとセカンダリの監視
### 4. アラート設定
#### スレッドプールアラート
```yaml
com.instana.plugin.tomcat:
thread_pools:
- "http-nio-8080"
thresholds:
busy_threads:
warning: 100
critical: 150
queue_size:
warning: 50
critical: 100
|
レスポンスタイムアラート
| com.instana.plugin.springboot:
health:
thresholds:
response_time_ms:
warning: 500
critical: 1000
error_rate:
warning: 0.01 # 1%
critical: 0.05 # 5%
|
5. ログ統合
Tomcatログ収集
| com.instana.plugin.tomcat:
enabled: true
# ログ収集
logs:
enabled: true
paths:
- "/opt/tomcat/logs/catalina.out"
- "/opt/tomcat/logs/localhost_access_log.*.txt"
# ログパース
patterns:
- type: "catalina"
pattern: "^(\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}) (\\w+) (.*)$"
- type: "access"
pattern: "^(\\S+) (\\S+) (\\S+) \\[([^\\]]+)\\] \"([^\"]+)\" (\\d+) (\\d+)$"
|
トラブルシューティング
問題1: Tomcat JMX接続エラー
症状:
| ERROR: Cannot connect to Tomcat JMX
Connection refused
|
原因:
- JMXが有効化されていない
- ポート番号が間違っている
- ファイアウォールでブロックされている
解決方法:
| # 1. JMX設定を確認
cat /opt/tomcat/bin/setenv.sh | grep jmxremote
# 2. Tomcatプロセスを確認
ps aux | grep tomcat | grep jmxremote
# 3. ポートが開いているか確認
netstat -an | grep 9012
# 4. JMX接続テスト
jconsole localhost:9012
# 5. 設定を修正
cat > /opt/tomcat/bin/setenv.sh <<EOF
CATALINA_OPTS="\$CATALINA_OPTS -Dcom.sun.management.jmxremote"
CATALINA_OPTS="\$CATALINA_OPTS -Dcom.sun.management.jmxremote.port=9012"
CATALINA_OPTS="\$CATALINA_OPTS -Dcom.sun.management.jmxremote.ssl=false"
CATALINA_OPTS="\$CATALINA_OPTS -Dcom.sun.management.jmxremote.authenticate=false"
CATALINA_OPTS="\$CATALINA_OPTS -Djava.rmi.server.hostname=localhost"
EOF
# 6. Tomcatを再起動
/opt/tomcat/bin/shutdown.sh
/opt/tomcat/bin/startup.sh
|
問題2: Nginx Status Moduleが有効でない
症状:
| ERROR: Cannot access Nginx status page
404 Not Found
|
原因:
- stub_status moduleが有効化されていない
- 設定が間違っている
解決方法:
| # 1. stub_statusモジュールが含まれているか確認
nginx -V 2>&1 | grep -o with-http_stub_status_module
# 2. 設定ファイルを確認
cat /etc/nginx/nginx.conf | grep stub_status
# 3. 設定を追加
cat >> /etc/nginx/nginx.conf <<EOF
server {
listen 8080;
server_name localhost;
location /nginx_status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}
}
EOF
# 4. 設定をテスト
nginx -t
# 5. Nginxをリロード
nginx -s reload
# 6. ステータスページにアクセス
curl http://localhost:8080/nginx_status
|
問題3: Apache mod_statusが動作しない
症状:
| ERROR: Cannot access Apache status page
403 Forbidden
|
原因:
- mod_statusが有効化されていない
- アクセス制限が厳しすぎる
解決方法:
| # 1. mod_statusが有効か確認
apachectl -M | grep status
# 2. モジュールを有効化(Debian/Ubuntu)
a2enmod status
# 3. モジュールを有効化(RHEL/CentOS)
# httpd.confで以下を確認
LoadModule status_module modules/mod_status.so
# 4. 設定を追加
cat >> /etc/apache2/conf-available/status.conf <<EOF
<Location "/server-status">
SetHandler server-status
Require ip 127.0.0.1
Require ip ::1
</Location>
ExtendedStatus On
EOF
# 5. 設定を有効化(Debian/Ubuntu)
a2enconf status
# 6. 設定をテスト
apachectl configtest
# 7. Apacheを再起動
systemctl restart apache2
# 8. ステータスページにアクセス
curl http://localhost/server-status?auto
|
問題4: Spring Boot Actuatorエンドポイントにアクセスできない
症状:
| ERROR: Cannot access Spring Boot Actuator endpoints
401 Unauthorized
|
原因:
- Actuatorエンドポイントが公開されていない
- Spring Securityで保護されている
解決方法:
| # application.yml
management:
endpoints:
web:
exposure:
include: "*" # 全エンドポイントを公開
base-path: /actuator
endpoint:
health:
show-details: always
# セキュリティ設定
security:
enabled: false # 開発環境のみ
# または特定のエンドポイントのみ公開
management:
endpoints:
web:
exposure:
include: health,metrics,info
|
Spring Security設定:
| @Configuration
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers("/actuator/**").permitAll()
.anyRequest().authenticated();
}
}
|
問題5: JBoss管理インターフェースに接続できない
症状:
| ERROR: Cannot connect to JBoss management interface
Authentication failed
|
原因:
- 管理ユーザーが作成されていない
- パスワードが間違っている
解決方法:
| # 1. 管理ユーザーを作成
cd /opt/jboss/wildfly/bin
./add-user.sh
# 対話式で以下を入力:
# - Type of user: Management User (a)
# - Username: admin
# - Password: your_password
# - Groups: (空白でEnter)
# - Is this correct: yes
# 2. 管理インターフェースの設定を確認
cat /opt/jboss/wildfly/standalone/configuration/standalone.xml | grep management-interfaces
# 3. 管理ポートが開いているか確認
netstat -an | grep 9990
# 4. 接続テスト
curl -u admin:your_password http://localhost:9990/management
# 5. Instana設定を更新
cat > /opt/instana/agent/etc/instana/configuration.yaml <<EOF
# 6. エージェントを再起動
systemctl restart instana-agent
|
問題6: WebSphere SOAP接続エラー
症状:
| ERROR: Cannot connect to WebSphere via SOAP
SOAP-ENV:Client
|
原因:
- SOAPコネクタが有効化されていない
- SSL証明書の問題
解決方法:
| # 1. SOAPポートを確認
cat /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/config/cells/*/nodes/*/serverindex.xml | grep SOAP
# 2. SSL証明書をエクスポート
cd /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/bin
./wsadmin.sh -lang jython -c "AdminTask.extractCertificate('[-keyStoreName NodeDefaultTrustStore -certificateAlias default -outputFile /tmp/was-cert.pem]')"
# 3. Javaトラストストアにインポート
keytool -import -alias was-server -file /tmp/was-cert.pem -keystore /opt/instana/agent/jre/lib/security/cacerts -storepass changeit
# 4. Instana設定を更新
cat > /opt/instana/agent/etc/instana/configuration.yaml <<EOF
com.instana.plugin.websphere:
enabled: true
soap:
host: "localhost"
port: 8880
username: "wasadmin"
password: "wasadmin_password"
ssl: true
truststore: "/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/etc/trust.p12"
truststore_password: "WebAS"
EOF
# 5. エージェントを再起動
systemctl restart instana-agent
|
FAQ
Q1: Tomcatの全アプリケーションを監視すべきですか?
A: いいえ、重要なアプリケーションのみを監視することを推奨します。
| com.instana.plugin.tomcat:
applications:
include:
- "/myapp"
- "/api"
exclude:
- "/test"
- "/dev"
- "/examples" # デフォルトアプリは除外
|
Q2: NginxとApacheのどちらを使うべきですか?
A: 用途によります:
| 用途 |
推奨 |
理由 |
| 静的コンテンツ配信 |
Nginx |
高速、低メモリ |
| リバースプロキシ |
Nginx |
高性能、非同期処理 |
| 動的コンテンツ(PHP) |
Apache |
mod_phpが成熟 |
| .htaccess使用 |
Apache |
ネイティブサポート |
| WebSocket |
Nginx |
優れたサポート |
Q3: JMX認証は必須ですか?
A: 本番環境では必須です。
| # 開発環境(認証なし)
com.instana.plugin.tomcat:
jmx:
host: "localhost"
port: 9012
ssl: false
authenticate: false
# 本番環境(認証あり)
com.instana.plugin.tomcat:
jmx:
host: "localhost"
port: 9012
username: "monitoring"
password: "${vault:secret/tomcat#jmx_password}"
ssl: true
authenticate: true
|
Q4: Spring Boot Actuatorのセキュリティ設定は?
A: 本番環境では必ずセキュリティを設定してください。
| # application.yml
management:
endpoints:
web:
exposure:
include: health,metrics,info # 必要最小限
endpoint:
health:
show-details: when-authorized # 認証時のみ詳細表示
spring:
security:
user:
name: monitoring
password: ${ACTUATOR_PASSWORD}
|
Q5: アプリケーションサーバーのメトリクス収集にどれくらいのオーバーヘッドがありますか?
A: 一般的に1-3%のCPUオーバーヘッドです。
| サーバー |
CPU |
メモリ |
理由 |
| Tomcat (JMX) |
1-2% |
50MB |
JMXは軽量 |
| Nginx |
<1% |
10MB |
stub_statusは高速 |
| Apache |
<1% |
20MB |
mod_statusは軽量 |
| JBoss/WildFly |
2-3% |
100MB |
管理APIは重い |
| WebSphere |
3-5% |
150MB |
SOAPは重い |
Q6: 複数のアプリケーションサーバーを同時に監視できますか?
A: はい、可能です。
| # Tomcat
com.instana.plugin.tomcat:
enabled: true
poll_rate: 10
# Nginx
com.instana.plugin.nginx:
enabled: true
poll_rate: 5
# Apache
### Q7: アプリケーションサーバーのログも収集すべきですか?
**A:** はい、エラー分析に重要です。
```yaml
com.instana.plugin.tomcat:
enabled: true
logs:
enabled: true
paths:
- "/opt/tomcat/logs/catalina.out"
- "/opt/tomcat/logs/localhost.*.log"
# ログレベルフィルタ
filter:
min_level: "WARN" # WARN以上のみ収集
|
参考リンク
公式ドキュメント