prometheus / jmx_exporter

A process for exposing JMX Beans via HTTP for Prometheus consumption

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

jmx exporter on an old AIX, v6.1.

stratanic opened this issue · comments

Hello,
I try use the jmx exporter on an old AIX, v6.1, and java 8

It start but nothing to scrape with HTTP version jmx_exporter

Important : I just want Cpu and memory metrics.

config:
JAVA_HOME=/usr/java8_64/jre;export JAVA_HOME
export PATH=/usr/java8_64/jre/bin:$PATH.
export CLASSPATH=/opt/jmx_exporter/jmx_prometheus_httpserver.jar

-----file /opt/jmx_exporter/config.yaml ----
hostPort: localhost:19999
rules:

  • pattern: ".*"

command line:
/usr/java8_64/jre/bin/java
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.port=19998
-jar /opt/jmx_exporter/jmx_prometheus_httpserver.jar 19999 /opt/jmx_exporter/config.yaml

error msg:

(/opt/jmx_exporter)$ /usr/java8_64/jre/bin/java   -Dcom.sun.management.jmxremote.ssl=false   -Dcom.sun.management.jmxremote.authenticate=false   -Dcom.sun.management.jmxremote.port=19998   -jar /opt/jmx_exporter/jmx_prometheus_httpserver.jar 19999 /opt/jmx_exporter/config.yaml
2023-12-08 | 09:30:42.084 | main | INFO | io.prometheus.jmx.WebServer | Running
Dec 08, 2023 9:31:47 AM io.prometheus.jmx.logger.Logger log
SEVERE: JMX scrape failed: java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.CommunicationException [Root exception is java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is:
        java.net.SocketTimeoutException: Read timed out]
        at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:380)
        at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:281)
        at io.prometheus.jmx.JmxScraper.doScrape(JmxScraper.java:126)
        at io.prometheus.jmx.JmxCollector.collect(JmxCollector.java:771)
        at io.prometheus.client.Collector.collect(Collector.java:45)
        at io.prometheus.client.CollectorRegistry$MetricFamilySamplesEnumeration.findNextElement(CollectorRegistry.java:204)
        at io.prometheus.client.CollectorRegistry$MetricFamilySamplesEnumeration.<init>(CollectorRegistry.java:162)
        at io.prometheus.client.CollectorRegistry$MetricFamilySamplesEnumeration.<init>(CollectorRegistry.java:190)
        at io.prometheus.client.CollectorRegistry.metricFamilySamples(CollectorRegistry.java:129)
        at io.prometheus.client.exporter.HTTPServer$HTTPMetricHandler.handle(HTTPServer.java:100)
        at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:91)
        at sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:95)
        at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:94)
        at sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(ServerImpl.java:687)
        at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:91)
        at sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:659)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1160)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.lang.Thread.run(Thread.java:818)
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:148)
        at com.sun.jndi.toolkit.url.GenericURLContext.lookup(GenericURLContext.java:217)
        at javax.naming.InitialContext.lookup(InitialContext.java:428)
        at javax.management.remote.rmi.RMIConnector.findRMIServerJNDI(RMIConnector.java:1966)
        at javax.management.remote.rmi.RMIConnector.findRMIServer(RMIConnector.java:1933)
        at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:298)
        ... 18 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:319)
        at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:214)
        at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:351)
        at sun.rmi.registry.RegistryImpl_Stub.lookup(RegistryImpl_Stub.java:112)
        at com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:144)
        ... 23 more
Caused by: java.net.SocketTimeoutException: Read timed out
        at java.net.SocketInputStream.socketRead0(Native Method)
        at java.net.SocketInputStream.socketRead(SocketInputStream.java:127)
        at java.net.SocketInputStream.read(SocketInputStream.java:182)
        at java.net.SocketInputStream.read(SocketInputStream.java:152)
        at java.io.BufferedInputStream.fill(BufferedInputStream.java:257)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:276)
        at java.io.DataInputStream.readByte(DataInputStream.java:276)
        at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:258)
        ... 27 more

metrics : on http://x.xx.x.x:19999

# HELP jmx_scrape_duration_seconds Time this JMX scrape took, in seconds.
# TYPE jmx_scrape_duration_seconds gauge
jmx_scrape_duration_seconds 60.038281106
# HELP jmx_scrape_error Non-zero if this scrape failed.
# TYPE jmx_scrape_error gauge
jmx_scrape_error 1.0
# HELP jmx_scrape_cached_beans Number of beans with their matching rule cached
# TYPE jmx_scrape_cached_beans gauge
jmx_scrape_cached_beans 0.0
# HELP jmx_config_reload_failure_total Number of times configuration have failed to be reloaded.
# TYPE jmx_config_reload_failure_total counter
jmx_config_reload_failure_total 0.0
# HELP jmx_exporter_build_info A metric with a constant '1' value labeled with the version of the JMX exporter.
# TYPE jmx_exporter_build_info gauge
jmx_exporter_build_info{version="0.20.0",name="jmx_prometheus_httpserver",} 1.0
# HELP jmx_config_reload_success_total Number of times configuration have successfully been reloaded.
# TYPE jmx_config_reload_success_total counter
jmx_config_reload_success_total 0.0
# HELP jmx_config_reload_failure_created Number of times configuration have failed to be reloaded.
# TYPE jmx_config_reload_failure_created gauge
jmx_config_reload_failure_created 1.70202424196E9
# HELP jmx_config_reload_success_created Number of times configuration have successfully been reloaded.
# TYPE jmx_config_reload_success_created gauge
jmx_config_reload_success_created 1.702024241959E9

Your exporter YAML configuration looks incorrect...

hostPort: localhost:19999

hostPort should be the remote applications JMX port.

The standalone JMX Exporter HTTP endpoint listening on port 19999...

-jar /opt/jmx_exporter/jmx_prometheus_httpserver.jar 19999 /opt/jmx_exporter/config.yaml

While the standalone JMX Exporter works, it's discouraged. The standalone JMX Exporter can't get JVM metrics of the remote application.

Thanks, it's working after the change 👍 hostPort: localhost:19998
Awesome, its so hard with old Aix to have some metrics...

Another question: the smaller agent is the http agent? any suggestion if I just want operating system metrics?

I would look at node_exporter_aix https://github.com/thorhs/node_exporter_aix

Not compatible with old aix, lower than 7.1.
Already try...I post an issue.

On a old aix you can just make script and scrapt it with ssh