Akira's Tech Notes

Java/JVM | GNU/Linux | Emacs/Lisp | 知的好奇心駆動

header-icon
ネイティブでない日本語で思い付くことや気になることをダラダラ書く、体裁とかは気にしない。読みづらいと感じた時に随時更新する。

[メモ]JBossAS稼働情報収取得方法

コマンドインタフェースから JBossAS 7.x アプリケーションサーバの稼働情報収取得方法に ついて検証してみた。主に以下の方法が存在する。

  1. jboss-cli.sh コマンドでサーバの設定情報やRuntime情報を取得する。
  2. RESTful Management Interfaces HTTP通信でJSON形式で情報ヲ取得する。
  3. remoting-jmx インタフェースでMBeanサーバから情報を取得する。

1と2の情報源が一緒です。取れる情報が次のようなイメージ、用途に応じて選ぶことになると思 います。

+-------------+
| jboss-cli   |
|   +---------+-----+
|   |         |     |
|   |         | JMX |
|   |         |     |
|   +---------+-----+
+-------------+

1 jboss-cli.sh 方式

1.1 JBoss管理インスタンスへ接続する

$ jboss-cli.sh -c controller=<hostname:port>

1.2 JVMスレッドプール情報取得

[standalone@localhost:9999 /] /core-service=platform-mbean/type=threading:read-resource(recursive=true, include-runtime=true)
{
    "outcome" => "success",
    "result" => {
        "all-thread-ids" => [
            137L,
            .......
            2L
        ],
        "thread-contention-monitoring-supported" => true,
        "thread-cpu-time-supported" => true,
        "current-thread-cpu-time-supported" => true,
        "object-monitor-usage-supported" => true,
        "synchronizer-usage-supported" => true,
        "thread-contention-monitoring-enabled" => false,
        "thread-cpu-time-enabled" => true,
        "thread-count" => 36,
        "peak-thread-count" => 78,
        "total-started-thread-count" => 130L,
        "daemon-thread-count" => 14,
        "current-thread-cpu-time" => 5399864L,
        "current-thread-user-time" => 0L,
        "object-name" => "java.lang:type=Threading"
    }
}
[standalone@localhost:9999 /]

1.3 JVMメモリ情報取得

メモリ概要情報

[standalone@localhost:9999 /] /core-service=platform-mbean/type=memory:read-resource(recursive=true, include-runtime=true)
{
    "outcome" => "success",
    "result" => {
        "heap-memory-usage" => {
            "init" => 1366294528L,
            "used" => 253812744L,
            "committed" => 1320878080L,
            "max" => 1321795584L
        },
        "non-heap-memory-usage" => {
            "init" => 24313856L,
            "used" => 62715312L,
            "committed" => 63045632L,
            "max" => 318767104L
        },
        "object-name" => "java.lang:type=Memory",
        "object-pending-finalization-count" => 0,
        "verbose" => false
    }
}
[standalone@localhost:9999 /]

メモリ詳細情報

[standalone@localhost:9999 /] /core-service=platform-mbean/type=memory-pool:read-resource(recursive=true, include-runtime=true)
{
    "outcome" => "success",
    "result" => {"name" => {
        "Eden_Space" => {
            "name" => "Eden_Space",
            "type" => "HEAP",
            "valid" => true,
            "memory-manager-names" => [
                "MarkSweepCompact",
                "Copy"
            ],
            "usage-threshold-supported" => false,
            "collection-usage-threshold-supported" => true,
            "usage-threshold" => undefined,
            "collection-usage-threshold" => 0L,
            "usage" => {
                "init" => 364445696L,
                "used" => 227453064L,
                "committed" => 364445696L,
                "max" => 364642304L
            },
            "peak-usage" => {
                "init" => 364445696L,
                "used" => 364445696L,
                "committed" => 364642304L,
                "max" => 364642304L
            },
            "usage-threshold-exceeded" => undefined,
            "usage-threshold-count" => undefined,
            "collection-usage-threshold-exceeded" => false,
            "collection-usage-threshold-count" => 0L,
            "collection-usage" => {
                "init" => 364445696L,
                "used" => 0L,
                "committed" => 364445696L,
                "max" => 364642304L
            },
            "object-name" => "java.lang:type=MemoryPool,name=\"Eden Space\""
        },
        "Survivor_Space" => {
            "name" => "Survivor_Space",
            "type" => "HEAP",
            "valid" => true,
            "memory-manager-names" => [
                "MarkSweepCompact",
                "Copy"
            ],
            "usage-threshold-supported" => false,
            "collection-usage-threshold-supported" => true,
            "usage-threshold" => undefined,
            "collection-usage-threshold" => 0L,
            "usage" => {
                "init" => 45481984L,
                "used" => 970896L,
                "committed" => 45547520L,
                "max" => 45547520L
            },
            "peak-usage" => {
                "init" => 45481984L,
                "used" => 24101280L,
                "committed" => 45547520L,
                "max" => 45547520L
            },
            "usage-threshold-exceeded" => undefined,
            "usage-threshold-count" => undefined,
            "collection-usage-threshold-exceeded" => false,
            "collection-usage-threshold-count" => 0L,
            "collection-usage" => {
                "init" => 45481984L,
                "used" => 970896L,
                "committed" => 45547520L,
                "max" => 45547520L
            },
            "object-name" => "java.lang:type=MemoryPool,name=\"Survivor Space\""
        },
        "Perm_Gen" => {
            "name" => "Perm_Gen",
            "type" => "NON_HEAP",
            "valid" => true,
            "memory-manager-names" => ["MarkSweepCompact"],
            "usage-threshold-supported" => true,
            "collection-usage-threshold-supported" => true,
            "usage-threshold" => 0L,
            "collection-usage-threshold" => 0L,
            "usage" => {
                "init" => 21757952L,
                "used" => 57597424L,
                "committed" => 57802752L,
                "max" => 268435456L
            },
            "peak-usage" => {
                "init" => 21757952L,
                "used" => 57597424L,
                "committed" => 57802752L,
                "max" => 268435456L
            },
            "usage-threshold-exceeded" => false,
            "usage-threshold-count" => 0L,
            "collection-usage-threshold-exceeded" => false,
            "collection-usage-threshold-count" => 0L,
            "collection-usage" => {
                "init" => 21757952L,
                "used" => 55181008L,
                "committed" => 55181312L,
                "max" => 268435456L
            },
            "object-name" => "java.lang:type=MemoryPool,name=\"Perm Gen\""
        },
        "Code_Cache" => {
            "name" => "Code_Cache",
            "type" => "NON_HEAP",
            "valid" => true,
            "memory-manager-names" => ["CodeCacheManager"],
            "usage-threshold-supported" => true,
            "collection-usage-threshold-supported" => false,
            "usage-threshold" => 0L,
            "collection-usage-threshold" => undefined,
            "usage" => {
                "init" => 2555904L,
                "used" => 5117888L,
                "committed" => 5242880L,
                "max" => 50331648L
            },
            "peak-usage" => {
                "init" => 2555904L,
                "used" => 5123264L,
                "committed" => 5242880L,
                "max" => 50331648L
            },
            "usage-threshold-exceeded" => false,
            "usage-threshold-count" => 0L,
            "collection-usage-threshold-exceeded" => undefined,
            "collection-usage-threshold-count" => undefined,
            "collection-usage" => undefined,
            "object-name" => "java.lang:type=MemoryPool,name=\"Code Cache\""
        },
        "Tenured_Gen" => {
            "name" => "Tenured_Gen",
            "type" => "HEAP",
            "valid" => true,
            "memory-manager-names" => ["MarkSweepCompact"],
            "usage-threshold-supported" => true,
            "collection-usage-threshold-supported" => true,
            "usage-threshold" => 0L,
            "collection-usage-threshold" => 0L,
            "usage" => {
                "init" => 910884864L,
                "used" => 36957616L,
                "committed" => 910884864L,
                "max" => 911605760L
            },
            "peak-usage" => {
                "init" => 910884864L,
                "used" => 36957616L,
                "committed" => 910884864L,
                "max" => 911605760L
            },
            "usage-threshold-exceeded" => false,
            "usage-threshold-count" => 0L,
            "collection-usage-threshold-exceeded" => false,
            "collection-usage-threshold-count" => 0L,
            "collection-usage" => {
                "init" => 910884864L,
                "used" => 36957616L,
                "committed" => 910884864L,
                "max" => 911605760L
            },
            "object-name" => "java.lang:type=MemoryPool,name=\"Tenured Gen\""
        }
    }}
}
[standalone@localhost:9999 /]

GCの実行状況

[standalone@localhost:9999 /] /core-service=platform-mbean/type=garbage-collector:read-resource(recursive=true, include-runtime=true)
{
    "outcome" => "success",
    "result" => {"name" => {
        "MarkSweepCompact" => {
            "collection-count" => 6L,
            "collection-time" => 1183L,
            "memory-pool-names" => [
                "Eden_Space",
                "Survivor_Space",
                "Tenured_Gen",
                "Perm_Gen"
            ],
            "name" => "MarkSweepCompact",
            "object-name" => "java.lang:type=GarbageCollector,name=MarkSweepCompact",
            "valid" => true
        },
        "Copy" => {
            "collection-count" => 13L,
            "collection-time" => 3003L,
            "memory-pool-names" => [
                "Eden_Space",
                "Survivor_Space"
            ],
            "name" => "Copy",
            "object-name" => "java.lang:type=GarbageCollector,name=Copy",
            "valid" => true
        }
    }}
}
[standalone@localhost:9999 /]

1.4 データベース接続プール情報取得

[standalone@localhost:9999 /] /subsystem=datasources/data-source=ExampleDS/statistics=pool:read-resource(include-runtime=true, recursive=true)
{
    "outcome" => "success",
    "result" => {
        "ActiveCount" => "0",
        "AvailableCount" => "20",
        "AverageBlockingTime" => "0",
        "AverageCreationTime" => "0",
        "CreatedCount" => "0",
        "DestroyedCount" => "0",
        "InUseCount" => "0",
        "MaxCreationTime" => "0",
        "MaxUsedCount" => "0",
        "MaxWaitCount" => "0",
        "MaxWaitTime" => "0",
        "TimedOut" => "0",
        "TotalBlockingTime" => "0",
        "TotalCreationTime" => "0"
    }
}
[standalone@localhost:9999 /]

1.5 JDBCステートメントキャッシュ情報

[standalone@localhost:9999 /] /subsystem=datasources/data-source=ExampleDS/statistics=jdbc:read-resource(include-runtime=true, recursive=true)
{
    "outcome" => "success",
    "result" => {
        "PreparedStatementCacheAccessCount" => "0",
        "PreparedStatementCacheAddCount" => "0",
        "PreparedStatementCacheCurrentSize" => "0",
        "PreparedStatementCacheDeleteCount" => "0",
        "PreparedStatementCacheHitCount" => "0",
        "PreparedStatementCacheMissCount" => "0"
    }
}
[standalone@localhost:9999 /]

1.6 起動オプション、システム属性などの確認

[standalone@localhost:9999 /] /core-service=platform-mbean/type=runtime:read-resource(recursive=true, include-runtime=true)
{
    "outcome" => "success",
    "result" => {
        "name" => "2147@localhost",
        "vm-name" => "OpenJDK 64-Bit Server VM",
        "vm-vendor" => "Oracle Corporation",
        "vm-version" => "24.65-b04",
        "spec-name" => "Java Virtual Machine Specification",
        "spec-vendor" => "Oracle Corporation",
        "spec-version" => "1.7",
        "management-spec-version" => "1.2",
        "class-path" => "/opt/jboss-eap-6.2/jboss-modules.jar",
        "library-path" => "/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib",
        "boot-class-path-supported" => true,
        "boot-class-path" => "/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65.x86_64/jre/lib/resources.jar:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65.x86_64/jre/lib/rt.jar:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65.x86_64/jre/lib/sunrsasign.jar:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65.x86_64/jre/lib/jsse.jar:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65.x86_64/jre/lib/jce.jar:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65.x86_64/jre/lib/charsets.jar:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65.x86_64/jre/lib/rhino.jar:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65.x86_64/jre/lib/jfr.jar:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65.x86_64/jre/classes",
        "input-arguments" => [
            "-D[Standalone]",
            "-XX:+UseCompressedOops",
            "-Xms1303m",
            "-Xmx1303m",
            "-XX:MaxPermSize=256m",
            "-Djava.net.preferIPv4Stack=true",
            "-Djboss.modules.system.pkgs=org.jboss.byteman",
            "-Djava.awt.headless=true",
            "-Djboss.modules.metrics=true",
            "-Dorg.apache.tomcat.util.ENABLE_MODELER=true",
            "-Dorg.jboss.boot.log.file=/opt/jboss-eap-6.2/standalone/log/server.log",
            "-Dlogging.configuration=file:/opt/jboss-eap-6.2/standalone/configuration/logging.properties"
        ],
        "start-time" => 1412040330424L,
        "system-properties" => {
            "[Standalone]" => "",
            "awt.toolkit" => "sun.awt.X11.XToolkit",
            "catalina.home" => "/opt/jboss-eap-6.2/standalone/tmp",
            "file.encoding" => "UTF-8",
            "file.encoding.pkg" => "sun.io",
            "file.separator" => "/",
            "java.awt.graphicsenv" => "sun.awt.X11GraphicsEnvironment",
            "java.awt.headless" => "true",
            "java.awt.printerjob" => "sun.print.PSPrinterJob",
            "java.class.path" => "/opt/jboss-eap-6.2/jboss-modules.jar",
            "java.class.version" => "51.0",
            "java.endorsed.dirs" => "/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65.x86_64/jre/lib/endorsed",
            "java.ext.dirs" => "/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65.x86_64/jre/lib/ext:/usr/java/packages/lib/ext",
            "java.home" => "/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65.x86_64/jre",
            "java.io.tmpdir" => "/tmp",
            "java.library.path" => "/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib",
            "java.naming.factory.url.pkgs" => "org.jboss.as.naming.interfaces:org.jboss.ejb.client.naming",
            "java.net.preferIPv4Stack" => "true",
            "java.protocol.handler.pkgs" => "org.jboss.net.protocol|org.jboss.vfs.protocol",
            "java.runtime.name" => "OpenJDK Runtime Environment",
            "java.runtime.version" => "1.7.0_65-mockbuild_2014_07_16_06_06-b00",
            "java.specification.name" => "Java Platform API Specification",
            "java.specification.vendor" => "Oracle Corporation",
            "java.specification.version" => "1.7",
            "java.util.logging.manager" => "org.jboss.logmanager.LogManager",
            "java.vendor" => "Oracle Corporation",
            "java.vendor.url" => "http://java.oracle.com/",
            "java.vendor.url.bug" => "http://bugreport.sun.com/bugreport/",
            "java.version" => "1.7.0_65",
            "java.vm.info" => "mixed mode",
            "java.vm.name" => "OpenJDK 64-Bit Server VM",
            "java.vm.specification.name" => "Java Virtual Machine Specification",
            "java.vm.specification.vendor" => "Oracle Corporation",
            "java.vm.specification.version" => "1.7",
            "java.vm.vendor" => "Oracle Corporation",
            "java.vm.version" => "24.65-b04",
            "javax.management.builder.initial" => "org.jboss.as.jmx.PluggableMBeanServerBuilder",
            "javax.xml.datatype.DatatypeFactory" => "__redirected.__DatatypeFactory",
            "javax.xml.parsers.DocumentBuilderFactory" => "__redirected.__DocumentBuilderFactory",
            "javax.xml.parsers.SAXParserFactory" => "__redirected.__SAXParserFactory",
            "javax.xml.stream.XMLEventFactory" => "__redirected.__XMLEventFactory",
            "javax.xml.stream.XMLInputFactory" => "__redirected.__XMLInputFactory",
            "javax.xml.stream.XMLOutputFactory" => "__redirected.__XMLOutputFactory",
            "javax.xml.transform.TransformerFactory" => "__redirected.__TransformerFactory",
            "javax.xml.validation.SchemaFactory:http://www.w3.org/2001/XMLSchema" => "__redirected.__SchemaFactory",
            "javax.xml.xpath.XPathFactory:http://java.sun.com/jaxp/xpath/dom" => "__redirected.__XPathFactory",
            "jboss.home.dir" => "/opt/jboss-eap-6.2",
            "jboss.host.name" => "localhost",
            "jboss.modules.dir" => "/opt/jboss-eap-6.2/modules",
            "jboss.modules.metrics" => "true",
            "jboss.modules.system.pkgs" => "org.jboss.byteman",
            "jboss.node.name" => "localhost",
            "jboss.qualified.host.name" => "localhost",
            "jboss.server.base.dir" => "/opt/jboss-eap-6.2/standalone",
            "jboss.server.config.dir" => "/opt/jboss-eap-6.2/standalone/configuration",
            "jboss.server.data.dir" => "/opt/jboss-eap-6.2/standalone/data",
            "jboss.server.deploy.dir" => "/opt/jboss-eap-6.2/standalone/data/content",
            "jboss.server.log.dir" => "/opt/jboss-eap-6.2/standalone/log",
            "jboss.server.name" => "localhost",
            "jboss.server.persist.config" => "true",
            "jboss.server.temp.dir" => "/opt/jboss-eap-6.2/standalone/tmp",
            "line.separator" => "
",
            "logging.configuration" => "file:/opt/jboss-eap-6.2/standalone/configuration/logging.properties",
            "module.path" => "/opt/jboss-eap-6.2/modules",
            "org.apache.tomcat.util.ENABLE_MODELER" => "true",
            "org.apache.xml.security.ignoreLineBreaks" => "true",
            "org.jboss.boot.log.file" => "/opt/jboss-eap-6.2/standalone/log/server.log",
            "org.jboss.resolver.warning" => "true",
            "org.jboss.security.context.ThreadLocal" => "true",
            "org.xml.sax.driver" => "__redirected.__XMLReaderFactory",
            "os.arch" => "amd64",
            "os.name" => "Linux",
            "os.version" => "2.6.32-358.el6.x86_64",
            "path.separator" => ":",
            "sun.arch.data.model" => "64",
            "sun.boot.class.path" => "/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65.x86_64/jre/lib/resources.jar:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65.x86_64/jre/lib/rt.jar:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65.x86_64/jre/lib/sunrsasign.jar:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65.x86_64/jre/lib/jsse.jar:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65.x86_64/jre/lib/jce.jar:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65.x86_64/jre/lib/charsets.jar:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65.x86_64/jre/lib/rhino.jar:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65.x86_64/jre/lib/jfr.jar:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65.x86_64/jre/classes",
            "sun.boot.library.path" => "/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65.x86_64/jre/lib/amd64",
            "sun.cpu.endian" => "little",
            "sun.cpu.isalist" => "",
            "sun.io.unicode.encoding" => "UnicodeLittle",
            "sun.java.command" => "/opt/jboss-eap-6.2/jboss-modules.jar -mp /opt/jboss-eap-6.2/modules -jaxpmodule javax.xml.jaxp-provider org.jboss.as.standalone -Djboss.home.dir=/opt/jboss-eap-6.2 -Djboss.server.base.dir=/opt/jboss-eap-6.2/standalone",
            "sun.java.launcher" => "SUN_STANDARD",
            "sun.jnu.encoding" => "UTF-8",
            "sun.management.compiler" => "HotSpot 64-Bit Tiered Compilers",
            "sun.os.patch.level" => "unknown",
            "user.country" => "JP",
            "user.dir" => "/root",
            "user.home" => "/root",
            "user.language" => "ja",
            "user.name" => "root",
            "user.timezone" => "Asia/Tokyo"
        },
        "uptime" => 11324677L,
        "object-name" => "java.lang:type=Runtime"
    }
}
[standalone@localhost:9999 /]

1.7 EJBスレッドプールの確認

[standalone@localhost:9999 /] /subsystem=ejb3/thread-pool=default:read-resource(include-runtime=true, recursive=true)
{
    "outcome" => "success",
    "result" => {
        "active-count" => 0,
        "completed-task-count" => 0L,
        "current-thread-count" => 0,
        "keepalive-time" => {
            "time" => 100L,
            "unit" => "MILLISECONDS"
        },
        "largest-thread-count" => 0,
        "max-threads" => 10,
        "name" => "default",
        "queue-size" => 0,
        "rejected-count" => 0,
        "task-count" => 0L,
        "thread-factory" => undefined
    }
}
[standalone@localhost:9999 /]

1.8 トランザクション情報の確認

[standalone@localhost:9999 /] /subsystem=transactions:read-resource(include-runtime=true, recursive=true)
{
    "outcome" => "success",
    "result" => {
        "default-timeout" => 300,
        "enable-statistics" => false,
        "enable-tsm-status" => false,
        "hornetq-store-enable-async-io" => false,
        "jdbc-action-store-drop-table" => false,
        "jdbc-action-store-table-prefix" => undefined,
        "jdbc-communication-store-drop-table" => false,
        "jdbc-communication-store-table-prefix" => undefined,
        "jdbc-state-store-drop-table" => false,
        "jdbc-state-store-table-prefix" => undefined,
        "jdbc-store-datasource" => undefined,
        "jts" => false,
        "node-identifier" => "1",
        "number-of-aborted-transactions" => 0L,
        "number-of-application-rollbacks" => 0L,
        "number-of-committed-transactions" => 0L,
        "number-of-heuristics" => 0L,
        "number-of-inflight-transactions" => 0L,
        "number-of-nested-transactions" => 0L,
        "number-of-resource-rollbacks" => 0L,
        "number-of-timed-out-transactions" => 0L,
        "number-of-transactions" => 0L,
        "object-store-path" => "tx-object-store",
        "object-store-relative-to" => "jboss.server.data.dir",
        "path" => "var",
        "process-id-socket-binding" => undefined,
        "process-id-socket-max-ports" => 10,
        "process-id-uuid" => true,
        "recovery-listener" => false,
        "relative-to" => "jboss.server.data.dir",
        "socket-binding" => "txn-recovery-environment",
        "status-socket-binding" => "txn-status-manager",
        "use-hornetq-store" => false,
        "use-jdbc-store" => false,
        "log-store" => {"log-store" => {
            "type" => "default",
            "transactions" => undefined
        }}
    }
}
[standalone@localhost:9999 /]

2 remoting-jmx 方式

JBossAS 7.x のJMX情報を参照するには $JBOSS_HOME/bin/jconsole.sh のGUIツールを利用す るのが一般的だと思います。コマンドから参照するにはJDKのJMX APIを用いて自前のコードで 頑張るか。 jmxterm といゆツールを使うかです。ここでは後者について検証しました。 jmxterm でlocalhostのJBossASのJMX情報参照はOKで、リモートからは認証処理で失敗した。

2.1 JBossAS接続用のjmxterm起動スクリプト

jmxtermここ からダウンロードできる。

#!/bin/sh

EAP_HOME=/opt/jboss-eap-6.2
HOST_URL=service:jmx:remoting-jmx://localhost:9999

java -classpath `dirname $0`/jmxterm-1.0-alpha-4-uber.jar:$EAP_HOME/bin/client/jboss-cli-client.jar org.codehaus.classworlds.uberjar.boot.Bootstrapper -l "$HOST_URL"

起動時のイメージ

# ./jmxterm.sh
9 30, 2014 12:42:18 午後 org.xnio.Xnio <clinit>
INFO: XNIO Version 3.0.7.GA-redhat-1
9 30, 2014 12:42:18 午後 org.xnio.nio.NioXnio <clinit>
INFO: XNIO NIO Implementation Version 3.0.7.GA-redhat-1
9 30, 2014 12:42:18 午後 org.jboss.remoting3.EndpointImpl <clinit>
INFO: JBoss Remoting version 3.2.18.GA-redhat-1
Welcome to JMX terminal. Type "help" for available commands.
$>

リモートから接続する場合、認証でエラー

$ ./jmxterm.sh
9 30, 2014 12:43:31 午後 org.xnio.Xnio <clinit>
INFO: XNIO Version 3.0.7.GA-redhat-1
9 30, 2014 12:43:31 午後 org.xnio.nio.NioXnio <clinit>
INFO: XNIO NIO Implementation Version 3.0.7.GA-redhat-1
9 30, 2014 12:43:31 午後 org.jboss.remoting3.EndpointImpl <clinit>
INFO: JBoss Remoting version 3.2.18.GA-redhat-1
9 30, 2014 12:43:34 午後 org.jboss.remoting3.remote.RemoteConnection handleException
ERROR: JBREM000200: Remote connection failed: javax.security.sasl.SaslException: Authentication failed: all available authentication mechanisms failed
---------------------------------------------------
constituent[0]: jar:file:/opt/jmxterm/jmxterm-1.0-alpha-4-uber.jar!/WORLDS-INF/lib/jmxterm.jar
constituent[1]: jar:file:/opt/jmxterm/jmxterm-1.0-alpha-4-uber.jar!/WORLDS-INF/lib/commons-beanutils.jar
constituent[2]: jar:file:/opt/jmxterm/jmxterm-1.0-alpha-4-uber.jar!/WORLDS-INF/lib/commons-cli.jar
constituent[3]: jar:file:/opt/jmxterm/jmxterm-1.0-alpha-4-uber.jar!/WORLDS-INF/lib/commons-collections.jar
constituent[4]: jar:file:/opt/jmxterm/jmxterm-1.0-alpha-4-uber.jar!/WORLDS-INF/lib/commons-lang.jar
constituent[5]: jar:file:/opt/jmxterm/jmxterm-1.0-alpha-4-uber.jar!/WORLDS-INF/lib/commons-logging.jar
constituent[6]: jar:file:/opt/jmxterm/jmxterm-1.0-alpha-4-uber.jar!/WORLDS-INF/lib/commons-io.jar
constituent[7]: jar:file:/opt/jmxterm/jmxterm-1.0-alpha-4-uber.jar!/WORLDS-INF/lib/jcli.jar
constituent[8]: jar:file:/opt/jmxterm/jmxterm-1.0-alpha-4-uber.jar!/WORLDS-INF/lib/jline.jar
---------------------------------------------------
javax.security.sasl.SaslException: Authentication failed: all available authentication mechanisms failed
	at org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities.handleEvent(ClientConnectionOpenListener.java:367)
	at org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities.handleEvent(ClientConnectionOpenListener.java:229)
	at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:72)
	at org.xnio.channels.TranslatingSuspendableChannel.handleReadable(TranslatingSuspendableChannel.java:189)
	at org.xnio.channels.TranslatingSuspendableChannel$1.handleEvent(TranslatingSuspendableChannel.java:103)
	at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:72)
	at org.xnio.channels.TranslatingSuspendableChannel.handleReadable(TranslatingSuspendableChannel.java:189)
	at org.xnio.ssl.JsseConnectedSslStreamChannel.handleReadable(JsseConnectedSslStreamChannel.java:180)
	at org.xnio.channels.TranslatingSuspendableChannel$1.handleEvent(TranslatingSuspendableChannel.java:103)
	at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:72)
	at org.xnio.nio.NioHandle.run(NioHandle.java:90)
	at org.xnio.nio.WorkerThread.run(WorkerThread.java:187)
	at ...asynchronous invocation...(Unknown Source)
	at org.jboss.remoting3.EndpointImpl.doConnect(EndpointImpl.java:270)
	at org.jboss.remoting3.EndpointImpl.doConnect(EndpointImpl.java:251)
	at org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:349)
	at org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:333)
	at org.jboss.remotingjmx.RemotingConnector.internalRemotingConnect(RemotingConnector.java:227)
	at org.jboss.remotingjmx.RemotingConnector.internalConnect(RemotingConnector.java:148)
	at org.jboss.remotingjmx.RemotingConnector.connect(RemotingConnector.java:99)
	at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:270)
	at org.cyclopsgroup.jmxterm.cc.SessionImpl.doConnect(SessionImpl.java:85)
	at org.cyclopsgroup.jmxterm.cc.SessionImpl.connect(SessionImpl.java:49)
	at org.cyclopsgroup.jmxterm.cc.CommandCenter.connect(CommandCenter.java:110)
	at org.cyclopsgroup.jmxterm.boot.CliMain.execute(CliMain.java:139)
	at org.cyclopsgroup.jmxterm.boot.CliMain.main(CliMain.java:48)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:483)
	at org.codehaus.classworlds.Launcher.launchStandard(Launcher.java:353)
	at org.codehaus.classworlds.Launcher.launch(Launcher.java:264)
	at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
	at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:483)
	at org.codehaus.classworlds.uberjar.boot.Bootstrapper.bootstrap(Bootstrapper.java:209)
	at org.codehaus.classworlds.uberjar.boot.Bootstrapper.main(Bootstrapper.java:116)
$

2.2 jmxterm基本的な使い方

★ドメインリストの取得
$>domains
#following domains are available
Catalina
JMImplementation
com.sun.management
java.lang
java.nio
java.util.logging
jboss.as
jboss.as.expr
jboss.jta
jboss.modules
jboss.msc
jboss.remoting.handler
jboss.web
jboss.ws

★特定ドメインのbeanリストの取得
$>beans -d jboss.web
#domain = jboss.web:
jboss.web:J2EEApplication=none,J2EEServer=none,WebModule=//default-host/,j2eeType=Servlet,name=WelcomeContextConsoleServlet
jboss.web:J2EEApplication=none,J2EEServer=none,j2eeType=WebModule,name=//default-host/
jboss.web:J2EEApplication=none,J2EEServer=none,j2eeType=WebModule,name=//default-host/sss
jboss.web:address="/0.0.0.0",port=8080,type=Connector
jboss.web:address="/0.0.0.0",port=8080,type=ProtocolHandler
jboss.web:host=default-host,name=ErrorReportValve,type=Valve
jboss.web:host=default-host,name=SecurityContextAssociationValve,path=/sss,type=Valve
jboss.web:host=default-host,name=StandardContextValve,path=/,type=Valve
jboss.web:host=default-host,name=StandardContextValve,path=/sss,type=Valve
jboss.web:host=default-host,name=StandardHostValve,type=Valve
jboss.web:host=default-host,path=/,type=Cache
jboss.web:host=default-host,path=/,type=Manager
jboss.web:host=default-host,path=/sss,realmPath=/realm0,type=Realm
jboss.web:host=default-host,path=/sss,type=Cache
jboss.web:host=default-host,path=/sss,type=Manager
jboss.web:host=default-host,type=Host
jboss.web:name=StandardEngineValve,type=Valve
jboss.web:name=http--0.0.0.0-8080,type=GlobalRequestProcessor
jboss.web:name=http--0.0.0.0-8080,type=ThreadPool
jboss.web:serviceName=jboss.web,type=Service
jboss.web:type=Engine

★beanの中身を参照する
★ -b の後ろはbeansコマンドで出力した文字列を指定する。
★ *  全部の属性とメソッドを出力する
★ bean所属のドメインを指定する
$>get -b jboss.web:address="/0.0.0.0",port=8080,type=Connector * -d jboss.web
#mbean = jboss.web:address="/0.0.0.0",port=8080,type=Connector:
port = 8080;

protocol = HTTP/1.1;

useIPVHosts = false;

objectName = jboss.web:type=Connector,port=8080,address="/0.0.0.0";

redirectPort = 443;

........

2.3 Web系ワーカスレッドの情報取得

これはJMX方式しか取れないぽい。

Web系ワーカスレッドの実装はtomcatそのものが取り入れられているぽいで、JBossASに -Dorg.apache.tomcat.util.ENABLE_MODELER=true オプションを付けて起動する必要がある。

$>get -b jboss.web:address="/0.0.0.0",port=8080,type=Connector * -d jboss.web
#mbean = jboss.web:address="/0.0.0.0",port=8080,type=Connector:
port = 8080;

protocol = HTTP/1.1;

useIPVHosts = false;

objectName = jboss.web:type=Connector,port=8080,address="/0.0.0.0";

redirectPort = 443;

secure = false;

proxyName = null;

enableLookups = false;

maxPostSize = 2097152;

proxyPort = 0;

available = true;

modelerType = org.apache.catalina.connector.Connector;

info = org.apache.catalina.connector.Connector/2.1;

bufferSize = 2048;

scheme = http;

xpoweredBy = false;

allowTrace = false;

domain = jboss.web;

useBodyEncodingForURI = false;

controller = jboss.web:type=Connector,port=8080,address="/0.0.0.0";

uRIEncoding = null;

maxSavePostSize = 4096;

protocolHandlerClassName = org.apache.coyote.http11.Http11Protocol;

$>

2.4 リクエストプロセッサーの稼働状況

$>get -b jboss.web:name=http--0.0.0.0-8080,type=GlobalRequestProcessor *
#mbean = jboss.web:name=http--0.0.0.0-8080,type=GlobalRequestProcessor:
bytesSent = 0;

bytesReceived = 0;

processingTime = 0;

errorCount = 0;

maxTime = 0;

requestCount = 0;

modelerType = org.apache.coyote.RequestGroupInfo;

$>

3 RESTful 方式

$ curl --digest http://localhost:9990/management?json.pretty -u admin
Enter host password for user 'admin':
{
    "management-major-version" : 1,
    "management-micro-version" : 0,
    "management-minor-version" : 5,
    "name" : "localhost",
    "namespaces" : [],
    "product-name" : "EAP",
    "product-version" : "6.2.4.GA",
    "profile-name" : null,
    "release-codename" : "Janus",
    "release-version" : "7.3.4.Final-redhat-1",
    "schema-locations" : [],
    "core-service" : {
        "management" : null,
        "service-container" : null,
        "module-loading" : null,
        "server-environment" : null,
        "platform-mbean" : null,
        "patching" : null
    },

Comments