10 Replies Latest reply on May 14, 2013 11:47 AM by rhusar

    How to programatically enable/disable contextxts and more ?

    simplex-software

      Greetings,

       

      We have a production system running a JBoss domain with mod_cluster configured. For monitoring purposes, I need to access to the mod_cluster meta-data. For example, I would need to be able to get the list of contexts, to modify their status, for example to enable/disable them or to drain them, to have access to the active sessions for these contexts, to monitor wheather there are active sessions, how many, etc.

       

      How could I do that ? Shall I use MCMP for that ? If yes, how ? Is there any API or examples ?

       

      Also, looking in the documentation I see that CLI is supposed to be able to get some of the above described functinality. The documentation for the Jboss mod_cluster (https://docs.jboss.org/author/display/AS71/mod_cluster+in+AS7) is stating the following:

       

      The modcluster subsystem supports several operations:

      [standalone@localhost:9999 subsystem=modcluster] :read-operation-names

      {

        "outcome" => "success",

        "result" =>

        [

          "add",

          "add-custom-metric",

          "add-metric",

          "add-proxy",

          "disable",

          "disable-context",

          "enable",

          "enable-context",

          "list-proxies",

          "read-attribute",

          "read-children-names",

          "read-children-resources",

          "read-children-types",

          "read-operation-description",

          "read-operation-names",

          "read-proxies-configuration",

          "read-proxies-info",

          "read-resource",

          "read-resource-description",

          "refresh",

          "remove-custom-metric",

          "remove-metric",

          "remove-proxy",

          "reset",

          "stop",

          "stop-context",

          "validate-address",

          "write-attribute" ]

      }

       

      However, on our system, doing the same the output is:

      [domain@10.20.71.107:9999 /] /profile=customer-full-ha/subsystem=modcluster:read-operation-names

      {

        "outcome" => "success",

        "result" => [ "add",

        "read-attribute",

        "read-children-names",

        "read-children-resources",

        "read-children-types",

        "read-operation-description",

        "read-operation-names",

        "read-resource",

        "read-resource-description",

        "remove",

        "undefine-attribute",

        "whoami",

        "write-attribute" ]

      }

       

      Is that normal ?

       

      Kind regards,

       

      Nicolas

        • 1. Re: How to programatically enable/disable contextxts and more ?
          rhusar

          In a domain, look at where are you trying to call the operation: on a profile. This makes no sense, profile is like a template which is applied to hosts.

           

          You need to call the operations on the runtime. IIRC the path is /host=master/server=server-one/subsystem=modcluster

          1 of 1 people found this helpful
          • 2. Re: How to programatically enable/disable contextxts and more ?
            simplex-software

            Thanks Radovan for you reply. Yes, that's right. My domain consists in a domai controller running on a separate host without any servers on it. Hence, /host=master/server doesn't exist. Instead, I get the following:

             

            [domain@10.20.71.107:9999 /] /host=ftse2/server=b/subsystem=modcluster:read-operation-names

            {

                "outcome" => "success",

                "result" => [

                    "list-proxies",

                    "read-attribute",

                    "read-children-names",

                    "read-children-resources",

                    "read-children-types",

                    "read-operation-description",

                    "read-operation-names",

                    "read-proxies-configuration",

                    "read-proxies-info",

                    "read-resource",

                    "read-resource-description",

                    "refresh",

                    "reset"

                ]

            }

             

            So, still no enable/disable operation.

             

            And since there were several questions in my post (I appologize for that), do you have an idea about a Java API for MCMP or something like that ?

             

            Many thanks in advance,

             

            Nicolas

            • 3. Re: How to programatically enable/disable contextxts and more ?
              jfclere

              yopu can use a small HTTP client that makes resquest like the links of the manager (See http://docs.jboss.org/mod_cluster/1.2.0/html/native.config.html#SetHandlermod_cluster-manager).

              1 of 1 people found this helpful
              • 4. Re: How to programatically enable/disable contextxts and more ?
                simplex-software

                Hi JF,

                 

                Many thanks for the info. After having had a look at this web-app, I think that, while it gives the oportunity to perform a couple of basic things, it doesn't allow one to really deal with all the mod_cluster subtilities, like draining sessions, etc. So, I would be rather interested in using the class org.jboss.modcluster.ModClusterService. I guess you're the good person to talk about as you're the author :-). But I lack of clear and practical samples of how to instantiate it and use it. Would you have anything which could help me ?

                 

                Also, connecting my jconsole to the domain controller, I don't see the associated MBean. This is probably because the domain controller runs on a separate hosts on which there are no servers. So, in order to have access to this MBean my understanding is that I need to connect to one of the managed hosts. Is that correct ? My Apche HTTPD server runs on a separate server as well and, besides the mod_cluster plugin, there is no JBoss installation on this server.

                 

                Many thanks in advance for your help,

                 

                Nicolas DUMINIL

                • 5. Re: How to programatically enable/disable contextxts and more ?
                  jfclere

                  In fact you can't do that with mbeans :-(

                  With the jboss-cli you should be able to script all the commands available for mod_cluster.

                  • 6. Re: How to programatically enable/disable contextxts and more ?
                    simplex-software

                    Thanks again for your reply. But is there any particular reason that I cannot use MBeans ? After all, this is what MBeans arre for. Otherwise why exposing functionality through MBean interfaces if they cannoy be used ?

                     

                    Many thanks in advance,

                     

                    Nicolas

                    • 7. Re: How to programatically enable/disable contextxts and more ?
                      jfclere

                      The MBeans you would need are not (yet) existing.

                      • 8. Re: How to programatically enable/disable contextxts and more ?
                        kclair-rei

                        I'm still confused about how to do this from the CLI.  (I'm using EAP 6.0.1).  I tried from what I think is the runtime.

                         

                        On the domain controller:

                         

                        [domain@localhost:9999 subsystem=modcluster] pwd

                        /host=uhqtsia01/server=boomerang-1/subsystem=modcluster

                        [domain@localhost:9999 subsystem=modcluster] :read-operation-names

                        {

                            "outcome" => "success",

                            "result" => [

                                "list-proxies",

                                "read-attribute",

                                "read-children-names",

                                "read-children-resources",

                                "read-children-types",

                                "read-operation-description",

                                "read-operation-names",

                                "read-proxies-configuration",

                                "read-proxies-info",

                                "read-resource",

                                "read-resource-description",

                                "refresh",

                                "reset"

                            ]

                        }

                        [domain@localhost:9999 subsystem=modcluster]

                         

                        On the application server:

                         

                        [domain@localhost:9999 subsystem=modcluster] pwd

                        /host=uhqtsia01/server=boomerang-1/subsystem=modcluster

                        [domain@localhost:9999 subsystem=modcluster] :read-operation-names

                        {

                            "outcome" => "success",

                            "result" => [

                                "list-proxies",

                                "read-attribute",

                                "read-children-names",

                                "read-children-resources",

                                "read-children-types",

                                "read-operation-description",

                                "read-operation-names",

                                "read-proxies-configuration",

                                "read-proxies-info",

                                "read-resource",

                                "read-resource-description",

                                "refresh",

                                "reset"

                            ]

                        }

                        [domain@localhost:9999 subsystem=modcluster]

                        • 9. Re: How to programatically enable/disable contextxts and more ?
                          jfclere

                          Hm I would also expect to see more proxy command on the host level. I think you should open a JIRA.

                          • 10. Re: How to programatically enable/disable contextxts and more ?
                            rhusar