Open 172151295 opened 1 year ago
Indeed, this is a valuable suggestion. In Openjob, there are two different services: one is the openjob-server
service based on spring-boot
, and the other is a service dependent on openjob-worker-core
. For the Java language, it could be a regular Java service or a service based on spring-boot
. However, for Java, the most compatible method is using a javaagent.
For Java, I would recommend using the jmx_prometheus_javaagent
. Taking Openjob's agent as an example, add the following to the pom.xml
:
<dependency>
<groupId>io.prometheus.jmx</groupId>
<artifactId>jmx_prometheus_javaagent</artifactId>
<version>0.16.1</version>
</dependency>
Then, by using the maven-assembly-plugin
, a package with dependencies can be created and placed in the lib
directory. At this point, you only need to write a startup.sh
script for the project and add:
APP_HOME="$(cd `dirname $0`; pwd)"
JMX="-javaagent:$APP_HOME/lib/jmx_prometheus_javaagent-0.16.1.jar=9000:$APP_HOME/config/jmx/jmx_exporter_config.yaml"
Next, integrate the startup.sh
script into the Dockerfile. This way, with zero costs for the user, the metrics collection problem is resolved.
@stelin @172151295
加入监控器和管理中心所在机器的CPU、内存、硬盘、系统信息等监控、以及在对应时间段的任务执行情况的运行监控图