概述
软件包下载地址:
Wget http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.11/bin/apache-tomcat-7.0.11.tar.gz
#安装jdk:
Mkdir /usr/lib/jvm
Tar xf jdk-7u45-linux-x64.gz -C /usr/lib/jvm
#在profile追加以下内容
Vim /etc/profile
JAVA_HOME="/usr/lib/jvm/jdk1.7.0_45"
CLASS_PATH="$JAVA_HOME/lib:$JAVA_HOME/jar/lib"
PATH=".:$PATH:$JAVA_HOME/bin"
#CATALINA_HOME="/usr/local/apache-tomcat-7.0.11"
export JAVA_HOME CATALINA_HOME
#检查是否安装成功
Source /etc/profile
java -version
#解压tomcat
tar xf apache-tomcat-7.0.11.tar.gz -C /usr/local/
Cd /usr/local/apache-tomcat-7.0.11/bin
./start.sh
#Tomcat 配置jmx
JAVA_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9999 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"
#下载cmdline-jmxclient-0.10.3.jar
/usr/local/apache-tomcat-7.0.11/lib/cmdline-jmxclient-0.10.3.jar
#本地测试
java -jar cmdline-jmxclient-0.10.3.jar - 10.10.31.20:10053 java.lang:type=Memory NonHeapMemoryUsage
报错信息:
java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.CommunicationException [Root exception is java.rmi.ConnectI
java.rmi.ConnectIOException: Exception creating connection to: 10.10.31.20; nested exception is:
java.net.NoRouteToHostExcepti
#编辑server.xml
/usr/local/apache-tomcat-7.0.11/conf/server.xml
#添加如下
<Listener className="org.apache.catalina.mbeans.JmxRemoteLifecycleListener"
rmiRegistryPortPlatform="10053" rmiServerPortPlatform="10054" />
创建tomcat/bin/setenv.sh
CATALINA_OPTS="${CATALINA_OPTS} -Djava.rmi.server.hostname=10.10.31.20"
CATALINA_OPTS="${CATALINA_OPTS} -Djavax.management.builder.initial="
CATALINA_OPTS="${CATALINA_OPTS} -Dcom.sun.management.jmxremote=true"
CATALINA_OPTS="${CATALINA_OPTS} -Dcom.sun.management.jmxremote.ssl=false"
CATALINA_OPTS="${CATALINA_OPTS} -Dcom.sun.management.jmxremote.authenticate=false"
Iptables开放端口
-A INPUT -p tcp -m state --state NEW -m tcp --dport 10053 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 10054 -j ACCEPT
java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.ServiceUnavailableException [Root exception is java.rmi.Con
转载于:https://blog.51cto.com/yxylinux/1688474
最后
以上就是羞涩鱼为你收集整理的zabbix通过JMX监控Tomcat及一些报错的全部内容,希望文章能够帮你解决zabbix通过JMX监控Tomcat及一些报错所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复