安装与配置可参考如下:jdk下载页面
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
http://download.oracle.com/otn-pub/java/jdk/8u91-b14/jdk-8u91-linux-x64.rpm?AuthParam=1462948138_871b75d4b1dd7155e8cbe4f23e5cd2cd
脚本
[root@NFS-WEB1 latest]# vim /etc/profile.d/java
export JAVA_HOME=/usr/java/latest
export PATH=$JAVA_HOME/bin/:$PATH
APache-tomcat安装下载tomcat
wget http://mirror.rise.ph/apache/tomcat/tomcat-7/v7.0.69/bin/apache-tomcat-7.0.69.tar.gz -C /usr/local/
cd /usr/local/
tar xf apache-tomcat-7.0.69.tar.gz
ln -sv apache-tomcat-7.0.69 tomcat
`tomcat' -> `apache-tomcat-7.0.67'
查看帮助:
[root@NFS-WEB1 tomcat]# bin/catalina.sh --help
启动:
[root@mysql-master local]# cd tomcat/
[root@mysql-master tomcat]# bin/catalina.sh start
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/java/latest
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Tomcat started.
[root@mysql-master tomcat]# ss -tlnp|grep java
LISTEN 0 1 ::ffff:127.0.0.1:8005 :::* users:(("java",7498,51))
LISTEN 0 100 :::8009 :::* users:(("java",7498,47))
LISTEN 0 100 :::8080 :::* users:(("java",7498,46))
[root@mysql-master tomcat]# jps
7794 Jps
7498 Bootstrap
[root@mysql-master tomcat]#
yum安装zabbix
yum install zabbix zabbix-server zabbix-web zabbix-agent zabbix-web-mysql zabbix-get zabbix-sender zabbix-java-gateway
编译安装zabbix需要 --enable=java
zabbix配置文件修改如下:
[root@localhost zabbix]# egrep -v "^$|^#|^%" zabbix_server.conf
LogFile=/var/log/zabbix/zabbix_server.log
LogFileSize=0
PidFile=/var/run/zabbix/zabbix_server.pid
DBName=zabbix
DBUser=zuser
DBPassword=password
JavaGateway=192.168.158.131
JavaGatewayPort=10052
StartJavaPollers=5
SNMPTrapperFile=/var/log/snmptt/snmptt.log
AlertScriptsPath=/usr/lib/zabbix/alertscripts
ExternalScripts=/usr/lib/zabbix/externalscripts
java_gateway
[root@localhost zabbix]# egrep -v "^$|^#|^%" zabbix_java_gateway.conf
LISTEN_IP="0.0.0.0"
LISTEN_PORT=10052
PID_FILE="/var/run/zabbix/zabbix_java.pid"
START_POLLERS=5
zabbix_agentd
[root@localhost zabbix]# egrep -v "^$|^#|^%" zabbix_agentd.conf
PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=0
Server=127.0.0.1
ServerActive=127.0.0.1
Hostname=Zabbix server
Include=/etc/zabbix/zabbix_agentd.d/
[root@localhost zabbix]#
修改catalina.sh,添加一条如下:
/usr/local/tomcat/bin/catalina.sh
CATALINA_OPTS="-Dcom.sun.management.jmxremote -Djava.rmi.server.hostname=192.168.158.131
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.port=12345"
启动所有服务
[root@localhost zabbix]# /etc/init.d/zabbix-server restart
Shutting down Zabbix server: [ OK ]
Starting Zabbix server: [ OK ]
[root@localhost zabbix]# /etc/init.d/zabbix-agent restart
Shutting down Zabbix agent: [ OK ]
Starting Zabbix agent: [ OK ]
[root@localhost zabbix]# /etc/init.d/zabbix-java-gateway restart
Shutting down zabbix java gateway: [ OK ]
Starting zabbix java gateway: [ OK ]
[ OK ]
[root@localhost zabbix]# /usr/local/tomcat/bin/shutdown.sh
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
[root@localhost zabbix]# /usr/local/tomcat/bin/startup.sh
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Tomcat started.
确保10052和12345端口成功启动
[root@localhost zabbix]# ss -tlnp|grep java
LISTEN 0 50 :::10052 :::* users:(("java",55501,11))
LISTEN 0 1 ::ffff:127.0.0.1:8005 :::* users:(("java",55572,57))
LISTEN 0 50 :::58855 :::* users:(("java",55572,21))
LISTEN 0 100 :::8009 :::* users:(("java",55572,50))
LISTEN 0 100 :::8080 :::* users:(("java",55572,49))
LISTEN 0 50 :::12345 :::* users:(("java",55572,20))
LISTEN 0 50 :::48922 :::* users:(("java",55572,19))
[root@localhost zabbix]#
下载cmdline-jmxclient-0.10.3.jar测试
wget http://crawler.archive.org/cmdline-jmxclient/cmdline-jmxclient-0.10.3.jar
[root@localhost local]# java -jar cmdline-jmxclient-0.10.3.jar - localhost:12345 java.lang:type=Memory NonHeapMemoryUsage
05/12/2016 06:51:21 -0700 org.archive.jmx.Client NonHeapMemoryUsage:
committed: 46137344
init: 2555904
max: -1
used: 44601840
[root@localhost local]#
wget -P /usr/local/tomcat/lib/ http://mirror.bit.edu.cn/apache/tomcat/tomcat-7/v7.0.69/bin/extras/catalina-jmx-remote.jar
展示效果如下:1,添加hosts即可,并确保你的jmx绿色,如下所示:
模板下载 密码:onyt