How to monitor Tomcat? ZABBIX vs. cloud insight

Time:2020-10-27

There are many JVM monitoring tools, such as jstat, jmap, jstack, Jinfo, which can view different system information according to different requirements, and jconsole, a graphical interface, are very convenient tools. These can refer to the Java built-in monitoring tools.

However, modern monitoring tools are integrated, which can monitor the performance of the server, and monitor the operation of each component. It is not necessary to knock and knock on the command line every time to display the data in real time. This paper will talk about the experience of monitoring Tomcat with modern integrated monitoring tools ZABBIX and cloud insight based on personal practical experience.

ZABBIX monitors Tomcat

At the beginning, ZABBIX was only used to monitor the server, and did not expect to monitor Tomcat in the future. So you can simply install yum, configure host and templates after installation, and then you can directly see the performance data of the server from the chart.

Now I want to monitor Tomcat. The version 2.4.7 of ZABBIX I use already provides native monitoring of JMX applications, that is, ZABBIX Java gateway. It is a daemon process written in Java. When ZABBIX server wants to know the value of JMX counter, it will use JMX Management API to request remote application. Applications do not need to install additional software, only need to be specified on the command line at startup-Dcom.sun.management.jmxremoteOptions.

Java gateway accepts connections from ZABBIX server or proxy, so only one Java gateway can be configured in each ZABBIX server or agent. If a host has JMX agent and other types of monitoring items, only JMX agent type monitoring items can be monitored through Java gateway. When a monitor value on Java gateway is updated, ZABBIX server or proxy will connect to Java gateway to request the value, because Java gateway will not cache any value

ZABBIX server or agent can control the process of connecting to Java gateway through startjavapollers. Java gateway uses start internally_ The pollers control option uses multithreading to start. Startjavapollers should be less than or equal to start_ Pollers, otherwise, there may be no extra threads to process when connecting to the Java gateway. On the server side, if a connection request exceeds the seconds set by timeout, the connection will be terminated, but the Java gateway may still retrieve the value from the JMX counter at this time.

How to monitor Tomcat? ZABBIX vs. cloud insight

After the principle is finished, start to operate

  • Compile add--enable-javaParameter, refer to the official website Java gateway for compilation and installation, and download Catalina JMX- remote.jar Package, configuring ZABBIX_ java,zabbix_ server,zabbix_ Agent and other configuration files

  • Put PHP and other front-end files into the directory of Apache website, and visithttp://ip/zabbixIf 403 error is reported in the installation interface, consider closing the firewall

  • ZABBIX is configured on the interface. However, when checking the PHP environment, an error is reported. Nine modules are missing (~ ェ), and PHP needs to be compiled. Refer to the pictures and texts to explain the whole process of ZABBIX installation (5), and compile PHP again (I found how good this article was-_ -#), then proceed to ZABBIX configuration, and finally succeed!

After the server configuration is completed, the client is configured

  • By creating the host and referencing the template, you can monitor the CPU and other data of the system. If you want to monitor Tomcat data, you also need the corresponding module. However, the Tomcat template provided by ZABBIX is not easy to use (in fact, it is not found), so you need to add the template yourself

  • There are corresponding files on GitHub, which can be downloaded and used directly. In this way, the template is imported

  • Then refer to the official website JMX monitoring for configuration. To see which chart, you need to create the corresponding item graph.

Cloud insight monitors Tomcat

Compared with ZABBIX, which is a complex installation and compilation configuration, cloud insight is much simpler. One click Copy completes the installation (the required environment modules will be downloaded and installed in the shell script to form a black box environment, and other software is not required to be installed). After that, the relevant data of system CPU can be seen on the web.

Another is monitoring Tomcat. Cloud insight also monitors Tomcat through JMX remote monitoring service. In order to collect these indicators, cloud insight will call a lightweight Java plug-in jmxfetch to connect to the MBean server, and send these indicators to cloud insight agent through onestatsd server. For details, refer to the document JMX remote monitoring:

How to monitor Tomcat? ZABBIX vs. cloud insight

Cloud insight is easy to monitor Tomcat

  • Add JMX environment variable in Tomcat configuration file-Dcom.sun.management.jmxremote

  • Configure Tomcat configuration file in CItomcat.yaml

  • Restart the probe

summary

Comparison of ZABBIX and cloud insight installation steps:

Zabbix

  • ZABBIX needs to install both server and client, and users need to configure PHP as the front end

  • In addition, ZABBIX will check the front-end support of PHP, whether the required modules have been installed, and you need to set the PHP parameters according to the tutorial

  • Additional compilation is required to monitor applications such as Java

  • When monitoring components, the template support of ZABBIX itself is not enough, so you need to import the module by yourself (you can write it yourself)

Cloud Insight

  • Cloud insight only needs to install probes and configure services with one click. The environment modules required by the probes are all in one package

  • From the official website of oneapm, there are default crawling indicators, which generally do not need to be configured. If there are special requirements, they can be configured in the configuration file

Comparison of Tomcat indicators monitored by ZABBIX and cloud insight:

  • Indicators monitored by ZABBIX are related to the template used. Indicators such as JVM JMX Tomcat can be monitored

  • Cloud insight collects 20 + indicators such as JVM JMX Tomcat by default. If you want to add monitoring items, you can configure them by yourself. Refer to JMX monitoring. The default upper limit is 350 indicators

ZABBIX and cloud insight are suitable for:

  • ZABBIX has a long history, has related communities, and many people have used it

  • If you like to challenge new things and want to liberate operation and maintenance manpower, you can still use cloud insight (^^^^^)

Cloud insight integrates monitoring, management, computing, collaboration and visualization to help all IT companies reduce the human and time cost investment in system monitoring, and make the operation and maintenance work more efficient and simple. For more technical articles, please visit the oneapm official technology blog.
This article is transferred from oneapm official blog