zabbix Server 4.0 监控JMX监控详解
作者:尹正杰
版权声明:原创作品,谢绝转载!否则将追究法律责任。
大家都知道,zabbix server效率高是使用C语言编写的,有很多应用程序是使用Java写的,zabbix如何去监控呢?官方有一个组件叫做Zabbix Java Gateway。Zabbix在监控Java 程序时首先会去找Zabbix Java Gateway,然后Zabbix Java Gateway再去找JMX取数据。
一.安装Zabbix Java Gateway
1>.安装JDK环境(https://www.cnblogs.com/yinzhengjie/p/10739218.html)
[root@node102.yinzhengjie.org.cn ~]# java -version java version "1.8.0_201" Java(TM) SE Runtime Environment (build 1.8.0_201-b09) Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode) [root@node102.yinzhengjie.org.cn ~]#
2>.查看zabbix java gateway程序包并安装
[root@node102.yinzhengjie.org.cn ~]# yum list | grep zabbix-java-gateway zabbix-java-gateway.x86_64 4.0.7-1.el7 zabbix [root@node102.yinzhengjie.org.cn ~]#
[root@node102.yinzhengjie.org.cn ~]# yum -y install zabbix-java-gateway.x86_64 Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * epel: mirrors.njupt.edu.cn * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com Resolving Dependencies --> Running transaction check ---> Package zabbix-java-gateway.x86_64 0:4.0.7-1.el7 will be installed --> Processing Dependency: java-headless >= 1.6.0 for package: zabbix-java-gateway-4.0.7-1.el7.x86_64 --> Running transaction check ---> Package java-1.8.0-openjdk-headless.x86_64 1:1.8.0.212.b04-0.el7_6 will be installed --> Processing Dependency: tzdata-java >= 2015d for package: 1:java-1.8.0-openjdk-headless-1.8.0.212.b04-0.el7_6.x86_64 --> Processing Dependency: copy-jdk-configs >= 3.3 for package: 1:java-1.8.0-openjdk-headless-1.8.0.212.b04-0.el7_6.x86_64 --> Processing Dependency: pcsc-lite-libs(x86-64) for package: 1:java-1.8.0-openjdk-headless-1.8.0.212.b04-0.el7_6.x86_64 --> Processing Dependency: lksctp-tools(x86-64) for package: 1:java-1.8.0-openjdk-headless-1.8.0.212.b04-0.el7_6.x86_64 --> Processing Dependency: jpackage-utils for package: 1:java-1.8.0-openjdk-headless-1.8.0.212.b04-0.el7_6.x86_64 --> Processing Dependency: cups-libs(x86-64) for package: 1:java-1.8.0-openjdk-headless-1.8.0.212.b04-0.el7_6.x86_64 --> Running transaction check ---> Package copy-jdk-configs.noarch 0:3.3-10.el7_5 will be installed ---> Package cups-libs.x86_64 1:1.6.3-35.el7 will be installed --> Processing Dependency: libavahi-common.so.3()(64bit) for package: 1:cups-libs-1.6.3-35.el7.x86_64 --> Processing Dependency: libavahi-client.so.3()(64bit) for package: 1:cups-libs-1.6.3-35.el7.x86_64 ---> Package javapackages-tools.noarch 0:3.4.1-11.el7 will be installed --> Processing Dependency: python-javapackages = 3.4.1-11.el7 for package: javapackages-tools-3.4.1-11.el7.noarch ---> Package lksctp-tools.x86_64 0:1.0.17-2.el7 will be installed ---> Package pcsc-lite-libs.x86_64 0:1.8.8-8.el7 will be installed ---> Package tzdata-java.noarch 0:2019a-1.el7 will be installed --> Running transaction check ---> Package avahi-libs.x86_64 0:0.6.31-19.el7 will be installed ---> Package python-javapackages.noarch 0:3.4.1-11.el7 will be installed --> Processing Dependency: python-lxml for package: python-javapackages-3.4.1-11.el7.noarch --> Running transaction check ---> Package python-lxml.x86_64 0:3.2.1-4.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ================================================================================================================================================================================================================================== Package Arch Version Repository Size ================================================================================================================================================================================================================================== Installing: zabbix-java-gateway x86_64 4.0.7-1.el7 zabbix 757 k Installing for dependencies: avahi-libs x86_64 0.6.31-19.el7 base 61 k copy-jdk-configs noarch 3.3-10.el7_5 base 21 k cups-libs x86_64 1:1.6.3-35.el7 base 357 k java-1.8.0-openjdk-headless x86_64 1:1.8.0.212.b04-0.el7_6 updates 32 M javapackages-tools noarch 3.4.1-11.el7 base 73 k lksctp-tools x86_64 1.0.17-2.el7 base 88 k pcsc-lite-libs x86_64 1.8.8-8.el7 base 34 k python-javapackages noarch 3.4.1-11.el7 base 31 k python-lxml x86_64 3.2.1-4.el7 base 758 k tzdata-java noarch 2019a-1.el7 updates 187 k Transaction Summary ================================================================================================================================================================================================================================== Install 1 Package (+10 Dependent packages) Total download size: 34 M Installed size: 109 M Downloading packages: (1/11): copy-jdk-configs-3.3-10.el7_5.noarch.rpm | 21 kB 00:00:02 (2/11): cups-libs-1.6.3-35.el7.x86_64.rpm | 357 kB 00:00:00 (3/11): javapackages-tools-3.4.1-11.el7.noarch.rpm | 73 kB 00:00:00 (4/11): lksctp-tools-1.0.17-2.el7.x86_64.rpm | 88 kB 00:00:00 (5/11): pcsc-lite-libs-1.8.8-8.el7.x86_64.rpm | 34 kB 00:00:00 (6/11): python-javapackages-3.4.1-11.el7.noarch.rpm | 31 kB 00:00:00 (7/11): python-lxml-3.2.1-4.el7.x86_64.rpm | 758 kB 00:00:00 (8/11): tzdata-java-2019a-1.el7.noarch.rpm | 187 kB 00:00:00 (9/11): avahi-libs-0.6.31-19.el7.x86_64.rpm | 61 kB 00:00:04 (10/11): zabbix-java-gateway-4.0.7-1.el7.x86_64.rpm | 757 kB 00:00:02 (11/11): java-1.8.0-openjdk-headless-1.8.0.212.b04-0.el7_6.x86_64.rpm | 32 MB 00:00:09 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Total 2.9 MB/s | 34 MB 00:00:11 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : lksctp-tools-1.0.17-2.el7.x86_64 1/11 Installing : pcsc-lite-libs-1.8.8-8.el7.x86_64 2/11 Installing : tzdata-java-2019a-1.el7.noarch 3/11 Installing : python-lxml-3.2.1-4.el7.x86_64 4/11 Installing : python-javapackages-3.4.1-11.el7.noarch 5/11 Installing : javapackages-tools-3.4.1-11.el7.noarch 6/11 Installing : copy-jdk-configs-3.3-10.el7_5.noarch 7/11 Installing : avahi-libs-0.6.31-19.el7.x86_64 8/11 Installing : 1:cups-libs-1.6.3-35.el7.x86_64 9/11 Installing : 1:java-1.8.0-openjdk-headless-1.8.0.212.b04-0.el7_6.x86_64 10/11 Installing : zabbix-java-gateway-4.0.7-1.el7.x86_64 11/11 Verifying : 1:cups-libs-1.6.3-35.el7.x86_64 1/11 Verifying : avahi-libs-0.6.31-19.el7.x86_64 2/11 Verifying : copy-jdk-configs-3.3-10.el7_5.noarch 3/11 Verifying : python-javapackages-3.4.1-11.el7.noarch 4/11 Verifying : python-lxml-3.2.1-4.el7.x86_64 5/11 Verifying : tzdata-java-2019a-1.el7.noarch 6/11 Verifying : pcsc-lite-libs-1.8.8-8.el7.x86_64 7/11 Verifying : javapackages-tools-3.4.1-11.el7.noarch 8/11 Verifying : zabbix-java-gateway-4.0.7-1.el7.x86_64 9/11 Verifying : 1:java-1.8.0-openjdk-headless-1.8.0.212.b04-0.el7_6.x86_64 10/11 Verifying : lksctp-tools-1.0.17-2.el7.x86_64 11/11 Installed: zabbix-java-gateway.x86_64 0:4.0.7-1.el7 Dependency Installed: avahi-libs.x86_64 0:0.6.31-19.el7 copy-jdk-configs.noarch 0:3.3-10.el7_5 cups-libs.x86_64 1:1.6.3-35.el7 java-1.8.0-openjdk-headless.x86_64 1:1.8.0.212.b04-0.el7_6 javapackages-tools.noarch 0:3.4.1-11.el7 lksctp-tools.x86_64 0:1.0.17-2.el7 pcsc-lite-libs.x86_64 0:1.8.8-8.el7 python-javapackages.noarch 0:3.4.1-11.el7 python-lxml.x86_64 0:3.2.1-4.el7 tzdata-java.noarch 0:2019a-1.el7 Complete! [root@node102.yinzhengjie.org.cn ~]#
3>.开启Java的jmx端口
例如开启tomcat的参数如下:
二.
三.