Ad Widget

Collapse

Java Gateway for GlassFish

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • authex
    Member
    • Jan 2014
    • 32

    #1

    Java Gateway for GlassFish

    Hi there,
    I have configured my zabbix server as a Java Gateway accepting connections on 10053.

    I can't find any kind of configuration online as far as to how to set up GlassFish as an agent; can someone please link me in the right direction?



    Thanks!
  • wdijkerman
    Junior Member
    • Jan 2015
    • 18

    #2
    Hi,

    You'll have to update your ${GLASSFISH_HOME}/domains/<DOMAIN>/config/domain.xml configuration fileand add the following into the jvm options (Or do it via the admin console if you don't want to manually edit this file):

    <jvm-options>-Dcom.sun.management.jmxremote</jvm-options>
    <jvm-options>-Dcom.sun.management.jmxremote.port=9010</jvm-options>
    <jvm-options>-Dcom.sun.management.jmxremote.local.only=false</jvm-options>
    <jvm-options>-Dcom.sun.management.jmxremote.authenticate=false</jvm-options>
    <jvm-options>-Dcom.sun.management.jmxremote.ssl=false</jvm-options>
    <jvm-options>-Djava.rmi.server.hostname=YOUR_IP YOUR_APP</jvm-options>

    You need to choose the correct port and need to change the hostname option to either your hostname (Should be resolvable) or ip address. I don't know if I have used the correct </jvm-options> syntax, so please double check before copy and paste it. :-)

    When this is done, start the glassfish domain and after it is started configure your host in the zabbix web interface and add JMX connection and use the same port as you used in the domain.xml. Also add the correct template or add some jmx items.

    Good luck!

    Comment

    • authex
      Member
      • Jan 2014
      • 32

      #3
      Thanks!

      I am now receiving this error message:


      Code:
      "request":"java gateway jmx",
              "keys":["jmx[java.lang:type=Runtime,Uptime]"]}]
        2241:20150401:103308.071 query [txnlev:1] [update hosts set jmx_disable_until=1427898798,jmx_error='java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.ServiceUnavailableException [Root exception is java.rmi.Con' where hostid=10144]
        2241:20150401:103318.074 In substitute_key_macros() data:'jmx[java.lang:type=Runtime,Uptime]'
        2241:20150401:103318.074 End of substitute_key_macros():SUCCEED data:'jmx[java.lang:type=Runtime,Uptime]'

      Comment

      • wdijkerman
        Junior Member
        • Jan 2015
        • 18

        #4
        Hi,

        It could be that another jvm option needs to be added to your domain configuration file:
        <jvm-options>-Dcom.sun.management.jmxremote.rmi.port=9010</jvm-options>

        (Or the 9010 needs to be something else than the <jvm-options>-Dcom.sun.management.jmxremote.port=9010</jvm-options> configuration.) Make sure that your firewall is open to on these ports.

        Comment

        • authex
          Member
          • Jan 2014
          • 32

          #5
          This is my JMX configuration:


          Code:
          <jvm-options>-Dcom.sun.management.jmxremote</jvm-options>
          <jvm-options>-Dcom.sun.management.jmxremote.local.only=false</jvm-options>
          <jvm-options>-Dcom.sun.management.jmxremote.authenticate=false</jvm-options>
          <jvm-options>-Dcom.sun.management.jmxremote.ssl=false</jvm-options>
          <jvm-options>-Dcom.sun.management.jmxremote.port=10051</jvm-options>
          <jvm-options>-Dcom.sun.management.jmxremote.ssl=false</jvm-options>
          <jvm-options>-Djava.rmi.server.hostname=xxx.xxx.xxx.xxx</jvm-options>

          Comment

          • wdijkerman
            Junior Member
            • Jan 2015
            • 18

            #6
            Originally posted by authex
            This is my JMX configuration:


            Code:
            <jvm-options>-Dcom.sun.management.jmxremote</jvm-options>
            <jvm-options>-Dcom.sun.management.jmxremote.local.only=false</jvm-options>
            <jvm-options>-Dcom.sun.management.jmxremote.authenticate=false</jvm-options>
            <jvm-options>-Dcom.sun.management.jmxremote.ssl=false</jvm-options>
            <jvm-options>-Dcom.sun.management.jmxremote.port=10051</jvm-options>
            <jvm-options>-Dcom.sun.management.jmxremote.ssl=false</jvm-options>
            <jvm-options>-Djava.rmi.server.hostname=xxx.xxx.xxx.xxx</jvm-options>
            You don't have an zabbix agent running on the same host as your glassfish server? I noticed you used the 10051 port for JMX which normally is used by the Zabbix Agent. I personnally would use an other port in close range of the ports for your domain, like 8880.

            Comment

            • authex
              Member
              • Jan 2014
              • 32

              #7
              wdijkerman,
              I have my Zabbix Agent running on 10050, I have my JMX monitor set to 10051.

              Comment

              • wdijkerman
                Junior Member
                • Jan 2015
                • 18

                #8
                Hi,

                What if you add the following option to?
                <jvm-options>-Dcom.sun.management.jmxremote.rmi.port=7091</jvm-options>

                Please update the port to something your needs. (Firewall needs to be open to)

                Comment

                • authex
                  Member
                  • Jan 2014
                  • 32

                  #9
                  tried that, same result.

                  just to be sure, this particular value should have the Zabbix server IP is that correct?

                  Comment

                  • wdijkerman
                    Junior Member
                    • Jan 2015
                    • 18

                    #10
                    Hi,

                    What do you mean exactly?

                    The ports configuration in the domain.xml are the ports that Glassfish will open to accept the connections. So, if you use for example:

                    <jvm-options>-Dcom.sun.management.jmxremote.port=10051</jvm-options>

                    Glassfish will open an process on the host and will listen on port 10051. In your zabbix frontend configuration you'll have to add an "JMX" agent and use the ip address/hostname of your glassfish server and use the 10051 as JMX port.

                    I don't know if this works though:
                    <jvm-options>-Djava.rmi.server.hostname=xxx.xxx.xxx.xxx</jvm-options>

                    I always use the hostname instead of ip address, but I might have seen in examples that ip addresses works to. This is the hostname/ip address of the server running the Glassfish domain, not the Zabbix Server.

                    Comment

                    Working...