Ad Widget

Collapse

JMX monitoring for Jboss 7

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dmltn84
    Junior Member
    • Jan 2012
    • 11

    #1

    JMX monitoring for Jboss 7

    Hello,

    I am trying to setup JMX monitoring with Zabbix 2.0.0 for Jboss 7 and Jboss server responds with message:

    12:56:18,478 ERROR [org.jboss.remoting.remote.connection] (Remoting "server:MANAGEMENT" read-1) JBREM000200: Remote connection failed: java.io.IOException: Received an invalid message length of 1246907721
    After some digging in source files I found that Zabbix Java has a different endpoint hardcoded in JMXItemChecker.java on line 60:

    url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://" + conn + ":" + port + "/jmxrmi");
    While proper endpoint for Jboss 7 would be (https://community.jboss.org/wiki/Usi...ctToJMXOnAS7):

    service:jmx:remoting-jmx://{host_name}:{port}
    I have double checked this with dedicated jboss jconsole for both endpoints and the one used in zabbix source results in ERROR message on the server.

    Is there a possibility to make this parameter configurable through GUI or configuration files?

    EDIT: Changing endpoint and recompilation makes it work with one modification of startup.sh, extra libs from jboss 7 should be imported:

    #!/bin/bash

    cd $(dirname $0)
    source settings.sh

    if [ -n "$PID_FILE" -a -e "$PID_FILE" ]; then
    echo "Zabbix Java Gateway is already running"
    exit 1
    fi

    JAVA=${JAVA:-java}

    JBOSS_HOME=/opt/jboss
    export JBOSS_HOME

    JAVA_OPTIONS="-server"
    if [ -z "$PID_FILE" ]; then
    JAVA_OPTIONS="$JAVA_OPTIONS -Dlogback.configurationFile=logback-console.xml"
    fi

    CLASSPATH="lib"
    for jar in {lib,bin}/*.jar; do
    if [[ $jar != *junit* ]]; then
    CLASSPATH="$CLASSPATH:$jar"
    fi
    done

    ZABBIX_OPTIONS=""
    if [ -n "$PID_FILE" ]; then
    ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dzabbix.pidFile=$PID_FILE"
    fi
    if [ -n "$LISTEN_IP" ]; then
    ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dzabbix.listenIP=$LISTEN_IP"
    fi
    if [ -n "$LISTEN_PORT" ]; then
    ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dzabbix.listenPort=$LISTEN_PORT"
    fi
    if [ -n "$START_POLLERS" ]; then
    ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dzabbix.startPollers=$START_POLLERS"
    fi

    CLASSPATH=$CLASSPATH:$JAVA_HOME/lib/jconsole.jar
    CLASSPATH=$CLASSPATH:$JAVA_HOME/lib/tools.jar

    if [ "x$JBOSS_MODULEPATH" = "x" ]; then
    JBOSS_MODULEPATH="$JBOSS_HOME/modules"
    fi


    MODULES="org/jboss/remoting3/remoting-jmx org/jboss/remoting3 org/jboss/logging org/jboss/xnio org/jboss/xnio/nio org/jboss/sasl org/jboss/marshalling org/jboss/marshalling/river"

    for MODULE in $MODULES
    do
    for JAR in `cd "$JBOSS_MODULEPATH/$MODULE/main/" && ls -1 *.jar`
    do
    CLASSPATH="$CLASSPATH:$JBOSS_MODULEPATH/$MODULE/main/$JAR"
    done
    done


    COMMAND_LINE="$JAVA $JAVA_OPTIONS -classpath $CLASSPATH $ZABBIX_OPTIONS com.zabbix.gateway.JavaGateway"

    if [ -n "$PID_FILE" ]; then
    PID=$(/bin/bash -c "$COMMAND_LINE > /dev/null 2>&1 & echo \$!")
    if ps -p $PID > /dev/null 2>&1; then
    echo $PID > $PID_FILE
    else
    echo "Zabbix Java Gateway did not start"
    exit 1
    fi
    else
    exec $COMMAND_LINE
    fi
    Last edited by dmltn84; 12-06-2012, 13:57.
  • richlv
    Senior Member
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Oct 2005
    • 3112

    #2
    could you please report this as a new issue in https://support.zabbix.com/browse/ZBXNEXT ?
    Zabbix 3.0 Network Monitoring book

    Comment

    • dmltn84
      Junior Member
      • Jan 2012
      • 11

      #3
      Done - https://support.zabbix.com/browse/ZBXNEXT-1274

      Comment

      • sneha.bhat
        Junior Member
        • Aug 2012
        • 8

        #4
        Weblogic mainitoring via zabbix 2.0

        Hello All,

        We want to monitor a Weblogic Server via Zabbix 2.0. For this we want to utilize the new jmx monitoring feature that has been added into zabbix. To configure this we have carried out the following steps:

        1. Created a host for the server
        2. Added a JMX interface which communicates on port 10052
        3. On the Weblogic front we have added the parameter to enable remote jmx in the SetDomainEnv.sh file which is called during start up.

        JAVA_OPTIONS="$JAVA_OPTIONS -Dcom.sun.management.jmxremote=true"
        JAVA_OPTIONS="$JAVA_OPTIONS -Dcom.sun.management.jmxremote.port=10052"
        JAVA_OPTIONS="$JAVA_OPTIONS -Dcom.sun.management.jmxremote.ssl=false"
        JAVA_OPTIONS="$JAVA_OPTIONS -Dcom.sun.management.jmxremote.authenticate=false"

        4. The Weblogic server is getting started after addition of these parameters and we are also able to telnet on port 10052

        But the JMX interface is not getting enabled on the ports. Its throws a "ZBX_TCP_READ() failed: [4] Interrupted system call" error. No value is coming for any parameter through zabbix_get. We have attached a JMX Generic template to the host as of now. But no items are collected any data.

        Would appreciate any kind of help of this and on keys of items to be monitored for the weblogic server.

        Comment

        • jdlyle
          Junior Member
          • Nov 2012
          • 13

          #5
          I see this thread was started in January of this year, so hopefully it isn't too dead...

          Anyways, I am trying to do the same thing as dmltn84. I have multiple servers with JBOSS AS 7, and I am trying to monitor the servers with the Zabbix Java Gateway. Zabbix Java Gateway works just fine for my servers that run JBOSS 4, but I am getting this message for my JBOSS 7 servers in the zabbix_java.log:

          Code:
          2012-12-31 12:43:01.274 [pool-1-thread-5] WARN  com.zabbix.gateway.SocketProcessor - error processing request
          com.zabbix.gateway.ZabbixException: java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: [10.150.0.61]; nested exception is:
          So after I ran into this issue, I decided to look through the Zabbix forums for any information regarding JBOSS AS 7 monitoring with the Zabbix Java Gateway -- which is how I came to this thread.

          Following dmltn84's advice (change JMXItemChecker.java, recompile project, and import modules in startup.sh), now the zabbix_java.log throws out the following:

          Code:
          2012-12-31 12:32:08.656 [pool-1-thread-1] WARN  com.zabbix.gateway.SocketProcessor - error processing request
          com.zabbix.gateway.ZabbixException: java.net.MalformedURLException: Unsupported protocol: remoting-jmx
          I assume that this error comes from when I changed the endpoint within the JMXItemChecker.java and recompiled. I changed the line in the JMXItemChecker.java to the following:

          Code:
          url = new JMXServiceURL("service:jmx:remoting-jmx://" + conn + ":" + port );
          I was hoping someone might be able to help me with my issue. Please let me know if you need any additional information.

          **NOTE: the zabbix_java.log does throw out a full stack trace. I just had to leave them out of the post because the forum would not allow me to submit a post that long. I can include the full stack traces in future posts if requested.**

          Comment

          • zychonatic
            Member
            • Jun 2010
            • 52

            #6
            hi,

            i did the same changes to the JMXItemChecker.java
            you also have to copy the remoting libs from jboss7 to the lib-directory of the Java Gateway:
            jboss-logging-3.1.0.GA.jar
            jboss-marshalling-1.3.11.GA.jar
            jboss-marshalling-river-1.3.11.GA.jar
            jboss-remoting-3.2.3.GA.jar
            jboss-sasl-1.0.0.Final.jar
            xnio-api-3.0.3.GA.jar
            xnio-nio-3.0.3.GA.jar

            i don´t know if all of them are required, but it works with them.

            br matthias

            Comment

            • jdlyle
              Junior Member
              • Nov 2012
              • 13

              #7
              Thank you for the timely response, zychonatic!

              I followed your advice, and I copied the remoting libs to the lib directory of the Zabbix Java Gateway. Unfortunately, the same error persists.

              Perhaps I changed the endpoint incorrectly within the JMXItemChecker.java? Would you mind posting your JMXItemChecker.java for me? That way I can at least make sure that I am compiling with the correct file.

              Not sure if it makes a difference, but I am doing all this on Red Hat Enterprise Linux 6.

              Comment

              • jdlyle
                Junior Member
                • Nov 2012
                • 13

                #8
                Okay, so I have made a little progress (I think).

                I made a typo when editing my startup.sh script, and I have sense fixed that. Now I am getting this error within the zabbix_java.log:

                Code:
                2013-01-02 14:51:02.850 [pool-1-thread-4] WARN  com.zabbix.gateway.SocketProcessor - error processing request
                com.zabbix.gateway.ZabbixException: java.lang.RuntimeException: Operation failed with status WAITING
                Also, the Zabbix Frontend gives out the following message when I click on the JMX status icon on the host (which is highlighted in red):

                Code:
                ZBX_TCP_READ() failed: [4] Interrupted system call
                I've looked around the forums in order to better understand the issue. Unfortunately, it seems to be rather ambiguous. Some people say it is a timeout, other say that you need to start more pollers.

                Any help with this problem?

                Comment

                • zychonatic
                  Member
                  • Jun 2010
                  • 52

                  #9
                  hi,

                  i haven´t touched the startup.sh.
                  Which jdk version are you using. i´m using jdk1.7.0_05

                  other things you can check:
                  is the firewall open?
                  which port is configured for JMX in Jboss7 (standard is 9999)?

                  br matthias

                  Comment

                  • dkanbier
                    Junior Member
                    Zabbix Certified Specialist
                    • Jul 2013
                    • 13

                    #10
                    For JBoss 7 monitoring I placed the following libs in zabbix_java/lib:

                    Code:
                    -rw-r--r--. 1 root root 206528 Jan 17 20:28 jboss-as-remoting-7.2.1.Final-redhat-10.jar
                    -rw-r--r--. 1 root root 55303 Jan 17 20:28 jboss-logging-3.1.2.GA-redhat-1.jar
                    -rw-r--r--. 1 root root 327477 Jan 17 20:28 jboss-logmanager-1.4.3.Final-redhat-1.jar
                    -rw-r--r--. 1 root root 257671 Jan 17 20:28 jboss-marshalling-1.3.18.GA-redhat-1.jar
                    -rw-r--r--. 1 root root 105633 Jan 17 20:28 jboss-marshalling-river-1.3.18.GA-redhat-1.jar
                    -rw-r--r--. 1 root root 238595 Jan 17 20:28 jboss-remoting-3.2.16.GA-redhat-1.jar
                    -rw-r--r--. 1 root root 89464 Jan 17 20:28 jboss-sasl-1.0.3.Final-redhat-1.jar
                    -rw-r--r--. 1 root root 17458 Jan 17 20:28 jcl-over-slf4j-1.7.2-redhat-1.jar
                    -rw-r--r--. 1 root root 4121 Jan 17 20:28 jul-to-slf4j-stub-1.0.1.Final-redhat-1.jar
                    -rw-r--r--. 1 root root 511692 Jan 17 20:28 log4j-jboss-logmanager-1.0.2.Final-redhat-1.jar
                    -rw-r--r--. 1 root root 304018 Jan 17 20:28 remoting-jmx-1.1.0.Final-redhat-1.jar
                    -rw-r--r--. 1 root root 25496 Jan 17 20:23 slf4j-api-1.6.1.jar
                    -rw-r--r--. 1 root root 27455 Jan 17 20:28 slf4j-api-1.7.2-redhat-1.jar
                    -rw-r--r--. 1 root root 43960 Jan 17 20:28 slf4j-ext-1.7.2-redhat-1.jar
                    -rw-r--r--. 1 root root 241671 Jan 17 20:28 xnio-api-3.0.7.GA-redhat-1.jar
                    -rw-r--r--. 1 root root 80214 Jan 17 20:28 xnio-nio-3.0.7.GA-redhat-1.jar
                    No need to modify the startup.sh script.

                    I also made a slightly different modification to the JMXItemChecker.java code to enable mixed JBoss 6 and 7 monitoring. Based on which port number you configure on the JMX interface it will use RMI or remoting-jmx. In this example it will use remoting-jmx if you use port 7777, if you use any other port it will default to RMI.

                    Code:
                    //Dirty solution for ZBXNEXT-1274
                    Integer remoting = new Integer("7777");
                    int retval = remoting.compareTo(port);
                     
                    if (retval == 0)
                    {
                            url = new JMXServiceURL("service:jmx:remoting-jmx://" + conn + ":" + port);
                    }
                    else
                    {
                            url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://" + conn + ":" + port + "/jmxrmi");
                    }
                    An example on how to recompile and use it in your installation can be found here.

                    Comment

                    • raddy
                      Junior Member
                      • Jan 2008
                      • 9

                      #11
                      Can anybody shed light on how to input the complex connection parameter in zabbix UI?

                      I am planning to connect to our remote application via SOCKS.
                      But i am not sure how to input the complex connection parameter for JMX interface.

                      Moreover before configuring the JMX connection parameter for SOCKS, Do i need to recompile the Zabbix Java Gateway?

                      Comment

                      Working...