Closed tjiuming closed 2 years ago
Hi community,
I had run a Java process on my computer, and I want to monitor per-thread CPU usage of the process by using process-exporter.
process-exporter config file:
process_names: - name: "{{.Comm}}" cmdline: - '[.\n]*'
outputs by ps -ef
ps -ef
[root@iZwz9fvw6m5ezres364g9hZ process-exporter-0.7.10.linux-386]# ps -ef | grep java root 6074 5437 0 19:14 pts/0 00:00:53 /usr/bin/java -Dlog4j.shutdownHookEnabled=false -cp /root/apache-pulsar-2.11.0-SNAPSHOT/conf:::/root/apache-pulsar-2.11.0-SNAPSHOT/lib/*: -Dlog4j.configurationFile=log4j2.yaml -Djute.maxbuffer=10485760 -Djava.net.preferIPv4Stack=true -Dzookeeper.clientTcpKeepAlive=true -Dio.netty.tryReflectionSetAccessible=true --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/java.util.zip=ALL-UNNAMED --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/jdk.internal.misc=ALL-UNNAMED --add-opens java.base/sun.net=ALL-UNNAMED --add-opens java.management/sun.management=ALL-UNNAMED --add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED -Xms2g -Xmx2g -XX:MaxDirectMemorySize=4g -XX:+UseZGC -XX:+PerfDisableSharedMem -XX:+AlwaysPreTouch -Xlog:async -Xlog:gc*,safepoint:/root/apache-pulsar-2.11.0-SNAPSHOT/logs/pulsar_gc_%p.log:time,uptime,tags:filecount=10,filesize=20M -Dpulsar.allocator.exit_on_oom=true -Dio.netty.recycler.maxCapacityPerThread=4096 -Dpulsar.log.appender=RoutingAppender -Dpulsar.log.dir=/root/apache-pulsar-2.11.0-SNAPSHOT/logs -Dpulsar.log.level=info -Dpulsar.log.root.level=info -Dpulsar.log.immediateFlush=false -Dpulsar.routing.appender.default=Console -Dlog4j2.is.webapp=false -Dpulsar.functions.process.container.log.dir=/root/apache-pulsar-2.11.0-SNAPSHOT/logs -Dpulsar.functions.java.instance.jar=/root/apache-pulsar-2.11.0-SNAPSHOT/instances/java-instance.jar -Dpulsar.functions.python.instance.file=/root/apache-pulsar-2.11.0-SNAPSHOT/instances/python-instance/python_instance_main.py -Dpulsar.functions.extra.dependencies.dir=/root/apache-pulsar-2.11.0-SNAPSHOT/instances/deps -Dpulsar.functions.instance.classpath=/root/apache-pulsar-2.11.0-SNAPSHOT/conf:::/root/apache-pulsar-2.11.0-SNAPSHOT/lib/*: -Dpulsar.functions.log.conf=/root/apache-pulsar-2.11.0-SNAPSHOT/conf/functions_log4j2.xml -Dbookkeeper.metadata.bookie.drivers=org.apache.pulsar.metadata.bookkeeper.PulsarMetadataBookieDriver -Dbookkeeper.metadata.client.drivers=org.apache.pulsar.metadata.bookkeeper.PulsarMetadataClientDriver -Dzookeeper.4lw.commands.whitelist=* -Dzookeeper.snapshot.trust.empty=true -Dzookeeper.tcpKeepAlive=true -Dpulsar.log.file=pulsar-standalone.log -Dpulsar.config.file=/root/apache-pulsar-2.11.0-SNAPSHOT/conf/standalone.conf org.apache.pulsar.PulsarStandaloneStarter root 7498 6339 0 20:47 pts/1 00:00:00 grep --color=auto java
content of /proc/<pid>/cmdline
/proc/<pid>/cmdline
[root@iZwz9fvw6m5ezres364g9hZ process-exporter-0.7.10.linux-386]# cat /proc/6074/cmdline /usr/bin/java-Dlog4j.shutdownHookEnabled=false-cp/root/apache-pulsar-2.11.0-SNAPSHOT/conf:::/root/apache-pulsar-2.11.0-SNAPSHOT/lib/*:-Dlog4j.configurationFile=log4j2.yaml-Djute.maxbuffer=10485760-Djava.net.preferIPv4Stack=true-Dzookeeper.clientTcpKeepAlive=true-Dio.netty.tryReflectionSetAccessible=true--add-opensjava.base/java.io=ALL-UNNAMED--add-opensjava.base/java.util.zip=ALL-UNNAMED--add-opensjava.base/java.nio=ALL-UNNAMED--add-opensjava.base/jdk.internal.misc=ALL-UNNAMED--add-opensjava.base/sun.net=ALL-UNNAMED--add-opensjava.management/sun.management=ALL-UNNAMED--add-opensjdk.management/com.sun.management.internal=ALL-UNNAMED-Xms2g-Xmx2g-XX:MaxDirectMemorySize=4g-XX:+UseZGC-XX:+PerfDisableSharedMem-XX:+AlwaysPreTouch-Xlog:async-Xlog:gc*,safepoint:/root/apache-pulsar-2.11.0-SNAPSHOT/logs/pulsar_gc_%p.log:time,uptime,tags:filecount=10,filesize=20M-Dpulsar.allocator.exit_on_oom=true-Dio.netty.recycler.maxCapacityPerThread=4096-Dpulsar.log.appender=RoutingAppender-Dpulsar.log.dir=/root/apache-pulsar-2.11.0-SNAPSHOT/logs-Dpulsar.log.level=info-Dpulsar.log.root.level=info-Dpulsar.log.immediateFlush=false-Dpulsar.routing.appender.default=Console-Dlog4j2.is.webapp=false-Dpulsar.functions.process.container.log.dir=/root/apache-pulsar-2.11.0-SNAPSHOT/logs-Dpulsar.functions.java.instance.jar=/root/apache-pulsar-2.11.0-SNAPSHOT/instances/java-instance.jar-Dpulsar.functions.python.instance.file=/root/apache-pulsar-2.11.0-SNAPSHOT/instances/python-instance/python_instance_main.py-Dpulsar.functions.extra.dependencies.dir=/root/apache-pulsar-2.11.0-SNAPSHOT/instances/deps-Dpulsar.functions.instance.classpath=/root/apache-pulsar-2.11.0-SNAPSHOT/conf:::/root/apache-pulsar-2.11.0-SNAPSHOT/lib/*:-Dpulsar.functions.log.conf=/root/apache-pulsar-2.11.0-SNAPSHOT/conf/functions_log4j2.xml-Dbookkeeper.metadata.bookie.drivers=org.apache.pulsar.metadata.bookkeeper.PulsarMetadataBookieDriver-Dbookkeeper.metadata.client.drivers=org.apache.pulsar.metadata.bookkeeper.PulsarMetadataClientDriver-Dzookeeper.4lw.commands.whitelist=*-Dzookeeper.snapshot.trust.empty=true-Dzookeeper.tcpKeepAlive=true-Dpulsar.log.file=pulsar-standalone.log-Dpulsar.config.file=/root/apache-pulsar-2.11.0-SNAPSHOT/conf/standalone.conforg.apache.pulsar.PulsarStandaloneStarter
Linux version
Linux version 5.10.134-12.al8.x86_64 (mockbuild@kojid011139182114.na61) (gcc (GCC) 10.2.1 20200825 (Alibaba 10.2.1-3 2.32), GNU ld version 2.35-12.2.al8) #1 SMP Tue Sep 6 14:59:57 CST 2022
process-exporter version
process-exporter-0.7.10.linux-386
But I cannot see the Java process metrics, here is the content of curl localhost:9256/metrics, what do I need to do? a.txt
curl localhost:9256/metrics
Hi community,
I had run a Java process on my computer, and I want to monitor per-thread CPU usage of the process by using process-exporter.
process-exporter config file:
outputs by
ps -ef
content of
/proc/<pid>/cmdline
Linux version
process-exporter version
But I cannot see the Java process metrics, here is the content of
curl localhost:9256/metrics
, what do I need to do? a.txt