2017-11-28 60 views
1

jetty를 기반으로 배포 된 Java 응용 프로그램을 모니터링하기 위해 JMX 내보내기 도구를 사용했습니다.JMX_exporter가 Prometheus & Grafana에서 오류를 표시합니다.

나는 jmx_prometheus_javaagent-0.1.0.jar 파일

을 다운로드 배포 jmx_exporter 명령을 사용하여 자바 응용 프로그램

nohup java -javaagent:./jmx_prometheus_javaagent-0.1.0.jar=7101:config.yaml -Dorg.eclipse.jetty.server.Request.maxFormContentSize=10000000 -Xms256m -Xmx256m -Djava.io.tmpdir=epoch_temp_dir -jar jetty-runner-9.0.7.v20131107.jar --log yyyy_mm_dd-java-application-1-request.log --out yyyy_mm_dd-java-application-1-output.log --port 8091 --path /java-application-1 java-app1.war >> java-application-1.log 2>&1 & 

config.yaml

#cat config.yaml 
--- 
startDelaySeconds: 0 
jmxUrl: service:jmx:rmi:///jndi/rmi://127.0.0.1:7101/jmxrmi 
ssl: false 
lowercaseOutputName: true 
lowercaseOutputLabelNames: true 
rules: 
- pattern: ".*" 

프로 메테우스는 연결 상태 페이지에서 시간 초과 보여줍니다

출력 로그 : 자바 응용 프로그램의

io.prometheus.jmx.shaded.io.prometheus.jmx.JmxCollector collect 
SEVERE: JMX scrape failed: java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.CommunicationException [Root exception is java.rmi.ConnectIOException: error du 
ring JRMP connection establishment; nested exception is: 
     java.net.SocketTimeoutException: Read timed out] 
     at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:369) 
     at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:270) 
     at io.prometheus.jmx.shaded.io.prometheus.jmx.JmxScraper.doScrape(JmxScraper.java:106) 
     at io.prometheus.jmx.shaded.io.prometheus.jmx.JmxCollector.collect(JmxCollector.java:415) 
     at io.prometheus.jmx.shaded.io.prometheus.client.CollectorRegistry$MetricFamilySamplesEnumeration.findNextElement(CollectorRegistry.java:180) 
     at io.prometheus.jmx.shaded.io.prometheus.client.CollectorRegistry$MetricFamilySamplesEnumeration.nextElement(CollectorRegistry.java:213) 
     at io.prometheus.jmx.shaded.io.prometheus.client.CollectorRegistry$MetricFamilySamplesEnumeration.nextElement(CollectorRegistry.java:134) 
     at io.prometheus.jmx.shaded.io.prometheus.client.exporter.common.TextFormat.write004(TextFormat.java:22) 
     at io.prometheus.jmx.shaded.io.prometheus.client.exporter.HTTPServer$HTTPMetricHandler.handle(HTTPServer.java:59) 
     at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:79) 
     at sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:83) 
     at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:82) 
     at sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(ServerImpl.java:675) 
     at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:79) 
     at sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:647) 
     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 
     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 
     at java.lang.Thread.run(Thread.java:748) 
Caused by: javax.naming.CommunicationException [Root exception is java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is: 
     java.net.SocketTimeoutException: Read timed out] 
     at com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:136) 
     at com.sun.jndi.toolkit.url.GenericURLContext.lookup(GenericURLContext.java:205) 
     at javax.naming.InitialContext.lookup(InitialContext.java:417) 
     at javax.management.remote.rmi.RMIConnector.findRMIServerJNDI(RMIConnector.java:1955) 
     at javax.management.remote.rmi.RMIConnector.findRMIServer(RMIConnector.java:1922) 
     at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:287) 
     ... 17 more 
Caused by: java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is: 
     java.net.SocketTimeoutException: Read timed out 
     at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:304) 
     at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:202) 
     at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:342) 
     at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source) 

클라이언트 서버의 7101 개 포트를 오픈하고 프로 메테우스 서버에 대한 액세스 권한을 부여 배치했다.

프로 메테우스 서버 RAM 사용 :

# free -h 
       total  used  free  shared buff/cache available 
Mem:   4.8G  1.9G  118M  256M  2.8G  2.3G 
Swap:   0B   0B   0B 

클라이언트 서버 RAM :

# free -h 
       total  used  free  shared buff/cache available 
Mem:   9.8G  3.7G  435M   16M  5.6G  5.7G 
Swap:   0B   0B   0B 

Curl localhost:7101 클라이언트 서버의 설정에서 jmxUrl를 제거

답변

1

를 응답하지 않는, 즉이 필요 아니에요 에이전트 사용.