5 Replies Latest reply on Jul 3, 2009 4:21 AM by Wessel van Norel

    Strange results with twiddle.sh when Jboss is down

    Bruno Cosnefroy Newbie

      Hi,

      I use twiddle.sh to monitor some attributes of my jboss server.
      When the Jboss server is up, I can get without problem the attributes of the jmx-console.

      However, if the server I request is down, twiddle.sh still return values (for example for FreeMemory).
      I've tried to get the jboss.system:type=ServerInfo HostAddress attribute and I was surprised to see that the returned IP address is not the address of my server.

      The following command:
      .../twiddle.sh --server=MyServerIPAddress get "jboss.system:type=ServerInfo" HostAddress

      returns another IP address which is the Ip Address of another Jboss server.

      As I use twiddle.sh in the check_jmx script for Nagios, this is not really good to get values of another server when mine is down!


      I use Jboss 4.0.2.

      Is it a known bug of twiddle.sh?
      Does anyone know how twiddle.sh search for another Jboss server on the subnet and whether this is a desired behavior?


      Thanks,
      Bruno

        • 1. Re: Strange results with twiddle.sh when Jboss is down
          Dimitris Andreadis Master

          I think it has to do with how the naming service is looked up. If it can't find it, it multicasts to the network to find the server. There is some option to turn this off, so you can search for it.

          • 2. Re: Strange results with twiddle.sh when Jboss is down
            Bruno Cosnefroy Newbie

            Hi,

            Thanks Dimitris for your answer.
            I've search for the option but I can't find it.

            As you told me, in the org.jboss.console.twiddle.Twiddle.java, I can see:

            Properties props = new Properties(System.getProperties());
            props.put(Context.PROVIDER_URL, serverURL);
            ctx = new InitialContext(props);

            So It seems that I can set a system Property for the InitialContext.

            I've searched for an option to disable multicast in javax.naming.InitialContext but I was not able to find it.

            Does anyone know which property I have to set?


            Thanks,
            Bruno Cosnefroy

            • 3. Re: Strange results with twiddle.sh when Jboss is down
              Bruno Cosnefroy Newbie

              Hi,

              It seems that I have to use the jndi option:
              jnp.disableDiscovery=true
              to disable the multicast.

              I wonder how to set this option without changing the Twiddle.java code.

              Should I create a jndi.properties file in the twiddle.jar or should I add a parameter to my java command line in the twiddle.sh script?

              Thanks in advance,
              Bruno

              • 4. Re: Strange results with twiddle.sh when Jboss is down
                Bruno Cosnefroy Newbie

                Hi,

                Sorry to reply to my own topics...

                I've found how to solve my problem.
                There is a jndi.properties file in the twiddle.jar file.

                In the jndi.properties file, I've added the line:
                jnp.disableDiscovery=true

                Now when my Jboss server is down, twiddle.sh returns an Exception.
                I still have to modify the check_jbossjmx nagios script to deal with this exception.

                Thanks Dimitris for your answer.
                Bruno

                • 5. Re: Strange results with twiddle.sh when Jboss is down
                  Wessel van Norel Newbie

                   

                  "bcosnefroy" wrote:
                  Hi,

                  Sorry to reply to my own topics...

                  I've found how to solve my problem.
                  There is a jndi.properties file in the twiddle.jar file.

                  In the jndi.properties file, I've added the line:
                  jnp.disableDiscovery=true

                  Now when my Jboss server is down, twiddle.sh returns an Exception.
                  I still have to modify the check_jbossjmx nagios script to deal with this exception.

                  Thanks Dimitris for your answer.
                  Bruno


                  Thanks for pointing out what was the solution to this. You can also add the property on the commandline, if you don't want to modify the twiddle.jar

                  just add

                  -Djnp.disableDiscovery


                  to your commandline, at least that worked for me.