一、部署jpress项目
1.部署jpress
#上传tomcat、jdk、jpress 代码包 [root@tomcat ~]# ls -l total 201092 -rw-r--r-- 1 root root 9128610 Mar 27 2019 apache-tomcat-8.0.27.tar.gz -rw-r--r-- 1 root root 170023183 Aug 14 2018 jdk-8u181-linux-x64.rpm -rw-r--r-- 1 root root 26762907 Apr 1 13:20 Jpress-0.4.0.tar.gz #安装jdk [root@tomcat ~]# rpm -ivh jdk-8u181-linux-x64.rpm #创建站点项目目录 [root@tomcat ~]# mkdir /application #解压tomcat [root@tomcat ~]# tar xf apache-tomcat-8.0.27.tar.gz -C /application #创建软连接 [root@tomcat ~]# ln -s /application/apache-tomcat-8.0.27 /application/tomcat #启动tomcat [root@tomcat ~]# /application/tomcat/bin/startup.sh Using CATALINA_BASE: /application/tomcat Using CATALINA_HOME: /application/tomcat Using CATALINA_TMPDIR: /application/tomcat/temp Using JRE_HOME: /usr Using CLASSPATH: /application/tomcat/bin/bootstrap.jar:/application/tomcat/bin/tomcat-juli.jar Tomcat started. #查看是否有8080端口 [root@tomcat ~]# netstat -lntp tcp6 0 0 :::8080 :::* LISTEN 8817/java #移动jpress项目到站点目录 [root@tomcat ~]# mv Jpress-0.4.0.tar.gz /application/tomcat/webapps/ [root@tomcat ~]# cd /application/tomcat/webapps/ [root@tomcat /application/tomcat/webapps]# ls docs examples host-manager Jpress-0.4.0.tar.gz manager ROOT #解压jpress项目 [root@tomcat /application/tomcat/webapps]# tar xf Jpress-0.4.0.tar.gz #复制war包到站点目录 [root@tomcat /application/tomcat/webapps]# cp jpress/wars/jpress-web-newest.war ./ [root@tomcat /application/tomcat/webapps]# ll total 20288 drwxr-xr-x 14 root root 4096 May 22 08:55 docs drwxr-xr-x 6 root root 83 May 22 08:55 examples drwxr-xr-x 5 root root 87 May 22 08:55 host-manager drwxrwxr-x 4 root root 78 Sep 19 2016 jpress drwxr-xr-x 7 root root 102 May 22 09:00 jpress-web-newest -rw-r--r-- 1 root root 20764271 May 22 09:00 jpress-web-newest.war drwxr-xr-x 5 root root 103 May 22 08:55 manager drwxr-xr-x 3 root root 4096 May 22 08:55 ROOT
2.安装jpress
3.填写验证数据库信息
4.填写网站信息
5.登录jpress
6.手动重启tomcat服务
[root@tomcat ~]# /application/tomcat/bin/shutdown.sh Using CATALINA_BASE: /application/tomcat Using CATALINA_HOME: /application/tomcat Using CATALINA_TMPDIR: /application/tomcat/temp Using JRE_HOME: /usr Using CLASSPATH: /application/tomcat/bin/bootstrap.jar:/application/tomcat/bin/tomcat-juli.jar [root@tomcat ~]# /application/tomcat/bin/startup.sh Using CATALINA_BASE: /application/tomcat Using CATALINA_HOME: /application/tomcat Using CATALINA_TMPDIR: /application/tomcat/temp Using JRE_HOME: /usr Using CLASSPATH: /application/tomcat/bin/bootstrap.jar:/application/tomcat/bin/tomcat-juli.jar Tomcat started.
7.jpress系统后台面板
二、zabbix监控JMX
1.web服务器上编写catalina代码
在注释下面插入以下内容
注意:10.0.0.5是tomcat主机的ip地址
注意:10.0.0.5是tomcat主机的ip地址
[root@tomcat ~]# vim /application/tomcat/bin/catalina.sh CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote -Djava.rmi.server.hostname=10.0.0.5 -Dcom.sun.management.jmxremote.port=12345 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false" #解析tomcat [root@tomcat ~]# vim /etc/hosts 10.0.0.5 tomcat 172.16.1.5 tomcat
2.zabbix服务器安装部署java-gateway
#安装java-gateway [root@zabbix-server ~]# yum install -y https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/rhel/7/x86_64/zabbix-java-gateway-4.0.20-1.el7.x86_64.rpm #编写配置文件(插入五行代码,PID_FILE参数配置文件自带) [root@zabbix-server ~]# vim /etc/zabbix/zabbix_java_gateway.conf [root@zabbix-server ~]# grep -Ev '^#|^$' /etc/zabbix/zabbix_java_gateway.conf LISTEN_IP="0.0.0.0" LISTEN_PORT=10052 PID_FILE="/var/run/zabbix/zabbix_java.pid" START_POLLERS=5 TIMEOUT=10 #重启java-gateway [root@zabbix-server ~]# systemctl start zabbix-java-gateway.service [root@zabbix-server ~]# systemctl enable zabbix-java-gateway.service #编写zabbix服务配置文件(插入三行代码) [root@zabbix-server ~]# vim /etc/zabbix/zabbix_server.conf [root@zabbix-server ~]# grep -E '^Java|^Start' /etc/zabbix/zabbix_server.conf JavaGateway=127.0.0.1 JavaGatewayPort=10052 StartJavaPollers=5 #重启zabbix-server服务 [root@zabbix-server ~]# systemctl restart zabbix-server
3.web服务器安装zabbix客户端
[root@tomcat ~]# yum install -y https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/rhel/7/x86_64/zabbix-agent-4.0.20-1.el7.x86_64.rpm
4.zabbix页面创建主机
5.被控主机链接模板
6.实时数据监控tomcat数据
三、zabbix监控SNMP
1.被控端部署安装net-snmp
#安装net-snmp [root@db01 ~]# yum install -y net-snmp #编写配置文件(密码改成123456,并插入一行代码) [root@db01 ~]# vim /etc/snmp/snmpd.conf com2sec notConfigUser default 123456 view systemview included .1 #重启snmpd服务 [root@db01 ~]# systemctl restart snmpd.service [root@db01 ~]# systemctl enable snmpd.service #查看端口 [root@db01 ~]# netstat -lntup tcp 0 0 127.0.0.1:199 0.0.0.0:* LISTEN 9506/snmpd udp 0 0 0.0.0.0:161 0.0.0.0:* 9506/snmpd
2.zabbix服务端安装net-snmp-utils
#安装net-snmp-utils [root@zabbix-server ~]# yum install -y net-snmp-utils #测试 [root@zabbix-server ~]# snmpwalk -v 2c -c 123456 10.0.0.51 .1.3.6.1.2.1.1.5.0 SNMPv2-MIB::sysName.0 = STRING: db01 [root@zabbix-server ~]# snmpwalk -v 2c -c 123456 10.0.0.51 .1.3.6.1.2.1.1.4.0 SNMPv2-MIB::sysContact.0 = STRING: Root <root@localhost> (configure /etc/snmp/snmp.local.conf) [root@zabbix-server ~]# snmpwalk -v 2c -c 123456 10.0.0.51 .1.3.6.1.2.1.1.1.0 SNMPv2-MIB::sysDescr.0 = STRING: Linux db01 3.10.0-957.el7.x86_64 #1 SMP Thu Nov 8 23:39:32 UTC 2018 x86_64 [root@zabbix-server ~]# snmpwalk -v 2c -c 123456 10.0.0.51 1.3.6.1.4.1.2021.11.10.0 UCD-SNMP-MIB::ssCpuSystem.0 = INTEGER: 0 [root@zabbix-server ~]# snmpwalk -v 2c -c 123456 10.0.0.51 .1.3.6.1.2.1.25.2.2.0 HOST-RESOURCES-MIB::hrMemorySize.0 = INTEGER: 995896 KBytes