5 Replies Latest reply on Nov 12, 2014 12:53 PM by yangju

    How to enable jmx in wildfly so that datasource pool usage can be monitored

    yangju

      In eap 4&5 and other application server like tomcat, monitor tools can monitor app performance and stats through jmx.

      How do we do this in wildfly? We are particularly interested in monitor the datasource pool usages through jmx.

        • 1. Re: How to enable jmx in wildfly so that datasource pool usage can be monitored
          rituraj

          cli can help in getting values related to pool usage

          [domain@localhost:9990 statistics=pool] pwd

          /host=hostname/server=server-name/subsystem=datasources/data-source=dsname/statistics=pool

          [domain@localhost:9990 statistics=pool] :read-resource(include-runtime=true,recursive=true)

          {

              "outcome" => "success",

              "result" => {

                  "ActiveCount" => "0",

                  "AvailableCount" => "20",

                  "AverageBlockingTime" => "1",

                  "AverageCreationTime" => "15",

                  "AverageGetTime" => "4",

                  "BlockingFailureCount" => "0",

                  "CreatedCount" => "72",

                  "DestroyedCount" => "72",

                  "IdleCount" => "0",

                  "InUseCount" => "0",

                  "MaxCreationTime" => "265",

                  "MaxGetTime" => "270",

                  "MaxUsedCount" => "1",

                  "MaxWaitCount" => "0",

                  "MaxWaitTime" => "5",

                  "TimedOut" => "72",

                  "TotalBlockingTime" => "55",

                  "TotalCreationTime" => "1147",

                  "TotalGetTime" => "1381",

                  "WaitCount" => "0"

              }

          }

           

          -Rituraj

          • 2. Re: How to enable jmx in wildfly so that datasource pool usage can be monitored
            yangju

            I know CLI can get datasource stats. But our monitor team has to use jmx connector to retrieve these stats and they don't want to use cli.

            In eap 6, the datasource stats are showing in the jmx but in wildfly, this feature is removed for some reason.

            • 3. Re: How to enable jmx in wildfly so that datasource pool usage can be monitored
              jaysensharma

              Hi Richard,

               

                   I tested the same on WildFly 8 and 9 and i can see the Statistics of the DataSource form the MBean view as well using JConsole.  Did you check the following MBeans attribute

               

                   jboss.as:subsystem=datasources,data-source=ExampleDS,statistics=pool
              

               

                 Attaching the screen shot from Wildfly 9 Alpha2  "JConsole_DataSource_Stats.png".  Is this what you are looking for?

               

              **NOTE:** Make sure to enable the DataSource statistics first , as now it is by default Disabled.

               

               

              [standalone@localhost:9990 /] /subsystem=datasources/data-source=ExampleDS:write-attribute(name=statistics-enabled,value=true)
              

               

              JConsole_DataSource_Stats.png

              • 4. Re: How to enable jmx in wildfly so that datasource pool usage can be monitored
                yangju

                Thanks, Jay, for your help.

                I tried to enable datasource stats in wildfly 8.1.0.Final but got error:

                [standalone@localhost:9990 /] /subsystem=datasources/data-source=xxxxxx:write-attribute(name=statistics-enabled,value=true)

                {

                    "outcome" => "failed",

                    "failure-description" => "JBAS014792: Unknown attribute statistics-enabled",

                    "rolled-back" => true

                }

                 

                In my jconsole, I still don't see datasource stats. Can you try wildfly 8.1 instead of 9.0? 9.x is not released yet and we cannot use it in production.

                Is there a way to enable the DS stats in standalone.xml (versus cli)?

                • 5. Re: How to enable jmx in wildfly so that datasource pool usage can be monitored
                  yangju

                  Hi, Jay, I think wildfly 8.1 has datasource pool stats enabled by default.

                  I was not seem this because I was not connect to the remote server correctly. Now I use the correct connection string:

                  service:jmx:http-remoting-jmx://xxx.xxx.xxx.xxx:9990 and provides the user and password and I now see the stats under the jboss.as category.

                   

                  So I am marking your answer as correct.

                  If I do not user jconsole, instead, using other jmx tools, does the connection string is the same?

                  What if I want programmatically try to connect to the wildfly server and do jndi lookup, what the mbean server and port and protocol look like?

                   

                  Thanks again for the help.

                   

                  Richard