Overview:
JMX (Java Management Extensions, or Java Management Extensions) is a framework for embedding management functions for applications, devices, systems, and so on. JMX can flexibly develop seamlessly integrated systems, network, and service management applications across a range of heterogeneous operating system platforms, system architectures, and network transport protocols.
使用zabbix监控weblogic是通过JMX agent(zabbix-java-gateway) 获取JVM MBean 信息。
Environment:
Centos7 + Zabbix 3.4 + Weblogic 10.3.6
I. Deployment of Zabbix-server, Zabbix-agent, Zabbix-java-gateway
1. Deploying a lamp or LNMP environment is omitted here, many 2 of the online deployment tutorials. Install Zabbix server, Zabbix agent, Zabbix-java-gateway yum install epel-release rpm--import Http://repo.zabbix.com/RP M-gpg-key-zabbix Rpm-uv http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm Yum in Stall Zabbix-server zabbix-agent Zabbix-java-gateway Zabbix-web-mysql can also be installed through the source code of reference Official document 3. Configuration zabbix-server Support jmx# grep ' ^[^#] '/etc/zabbix/zabbix_server.conf logfile=/var/log/zabbix/zabbix_server.log LogFile Size=0 pidfile=/var/run/zabbix/zabbix_server.pid Socketdir=/var/run/zabbix Dbname=zabbix DBUser=zabbix DBPa Ssword=zabbix dbport=3306 javagateway=192.168.154.130 javagatewayport=10052 startjavapollers=5 SNMPTrapperF Ile=/var/log/snmptrap/snmptrap.log timeout=4 alertscriptspath=/usr/lib/zabbix/alertscripts ExternalScripts=/usr/l Ib/zabbix/externalscripts logslowqueries=30004. Configure zabbix_java_gateway.conf # grep ' ^[^#] '/etc/zabbix/zabbix_java_gateway.conflisten_ip= "0.0.0.0" listen_port=10052pid_file= "/var/run/zabbix/zabbix_java.pid" start_pollers=5timeout= 3 Start Zabbix-server and Zabbix-java-gateway when the configuration is complete # systemctl start zabbix-server.service# systemctl start Zabbix-java-gateway.service
Ii. start of JMX
Before using JMX, you need to turn on JMX, which is off by default, and when starting a Java program, refer to the official documentation
Https://docs.oracle.com/javase/1.5.0/docs/guide/management/agent.html
Here are a few common Java containers for how to open JMX:
- Tomcat Edit tomcat_home/bin/catalina.sh Add the following lines at the beginning
Catalina_opts= "${catalina_opts}-djava.rmi.server.hostname=jmx_host" # Modify Jmx_host
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.port=jmx_port" # Modify the JMS port
Catalina_opts= "${catalina_opts}-dcom.sun.management.jmxremote.ssl=false"
Catalina_opts= "${catalina_opts}-dcom.sun.management.jmxremote.authenticate=false"
Restarting the Tomcat service is possible.
- Weblogic edit Wl_domain_home/bin/setdomainenv.cmd, add the following lines at the end of the file
Java_options= "${java_options}-djava.rmi.server.hostname=jmx_host"
Java_options= "${java_options}-djavax.management.builder.initial= Weblogic.management.jmx.mbeanserver.WLSMBeanServerBuilder "
Java_options= "${java_options}-dcom.sun.management.jmxremote=true"
Java_options= "${java_options}-dcom.sun.management.jmxremote.port=jmx_port"
Java_options= "${java_options}-dcom.sun.management.jmxremote.ssl=false"
Java_options= "${java_options}-dcom.sun.management.jmxremote.authenticate=false"
Restart the WebLogic service.
III. testing and viewing JMX configuration and status information
When JMX is turned on, we can see the status information within the JMX using the relevant tools, which can usually be viewed with the JDK's Jconsole program, and for WebLogic it comes with some tools that can be viewed with reference to the official documentation.
Http://docs.huihoo.com/oracle/middleware/fusion/11g/apirefs.1111/e13951/core/index.html
There is also a tool called Cmdline-jmxclient-0.10.3.jar that can be very convenient to view this information
This article uses the Cmdline-jmxclient-0.10.3.jar tool to view
Java-jar Jmxcmd.jar-jmx_host:jmx_port | grep jdbc looks at what Mbean the JDBC has, and below is a brief list of some Mbean
Com.bea:name=library,serverruntime=paic_app01,type=jdbcconnectionpoolruntime
Com.bea:name=paic_app01,serverruntime=paic_app01,type=jdbcserviceruntime
Java-jar Jmxcmd.jar-jmx_host:jmx_port com.bea:name=library,serverruntime=paic_app01,type= Jdbcconnectionpoolruntime
See what Attributes are under Jdbcconnectionpoolruntime
Iv. Configuring Zabbix Item
Configuring a JMX interface
- Configure a WebLogic Iteam
JMX Iteam configuration format: Jmx[object_name,attribute_name]
Here the object_name is Java-jar jmxcmd.jar-jmx_host:jmx_port query out of the Mbean such as COM.BEA:NAME=LIBRARY,SERVERRUNTIME=PAIC_APP01, Type=jdbcconnectionpoolruntime
Attribute_name is Java-jar jmxcmd.jar-jmx_host:jmx_port com.bea:name=library,serverruntime=paic_app01,type= Jdbcconnectionpoolruntime Query-out properties
Complete example: jmx["Com.bea:name=threadpoolruntime,serverruntime=app01,type=threadpoolruntime", "QueueLength"]
At this point Zabbix monitoring WebLogic configuration completed, this configuration is also a reference to a lot of documents, tossing a noon, so write a blog to record the configuration process.
Zabbix Monitoring Weblogic