JMX Zabbix: различия между версиями
Материал из noname.com.ua
Перейти к навигацииПерейти к поискуSirmax (обсуждение | вклад) |
Sirmax (обсуждение | вклад) |
||
Строка 73: | Строка 73: | ||
https://zabbix.org/wiki/ConfigureJMX |
https://zabbix.org/wiki/ConfigureJMX |
||
https://jolokia.org/features-nb.html |
https://jolokia.org/features-nb.html |
||
+ | |||
+ | |||
+ | https://habr.com/company/zabbix/blog/342226/ |
Версия 17:44, 17 сентября 2018
JMX в Zabbix
Задача - мониторить абстрактное приложение написанное на Java в Zabbix
Запуск Java с поддержкой JMX
Для удобства чтениея разбито на строки, так это одна строка JAVA_OPTIONS=" -Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.net.preferIPv4Stack=true -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.port=8004 -Dcom.sun.management.jmxremote.rmi.port=8004 -Djava.rmi.server.hostname=ec2-XX-XX-XX-XX.eu-west-1.compute.amazonaws.com" "
Пример для AWS EC2
JVM_OPTS="$JVM_OPTS -Djava.rmi.server.hostname=$(curl http://169.254.169.254/latest/meta-data/public-hostname)"
WARN com.zabbix.gateway.SocketProcessor - error processing request com.zabbix.gateway.ZabbixException: java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is: java.net.ConnectException: Connection refused at com.zabbix.gateway.JMXItemChecker.getValues(JMXItemChecker.java:98) ~[zabbix-java-gateway-3.4.13.jar:na] at com.zabbix.gateway.SocketProcessor.run(SocketProcessor.java:63) ~[zabbix-java-gateway-3.4.13.jar:na] at java.util.concurrent.ThreadPoolExecutor.runWorker(java.base@9-internal/ThreadPoolExecutor.java:1158) [na:na] at java.util.concurrent.ThreadPoolExecutor$Worker.run(java.base@9-internal/ThreadPoolExecutor.java:632) [na:na] at java.lang.Thread.run(java.base@9-internal/Thread.java:804) [na:na] Caused by: java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is: java.net.ConnectException: Connection refused at sun.rmi.transport.tcp.TCPEndpoint.newSocket(java.rmi@9-internal/TCPEndpoint.java:619) ~[na:na] at sun.rmi.transport.tcp.TCPChannel.createConnection(java.rmi@9-internal/TCPChannel.java:214) ~[na:na] at sun.rmi.transport.tcp.TCPChannel.newConnection(java.rmi@9-internal/TCPChannel.java:200) ~[na:na] at sun.rmi.server.UnicastRef.invoke(java.rmi@9-internal/UnicastRef.java:130) ~[na:na] at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(java.rmi@9-internal/RemoteObjectInvocationHandler.java:209) ~[na:na] at java.rmi.server.RemoteObjectInvocationHandler.invoke(java.rmi@9-internal/RemoteObjectInvocationHandler.java:161) ~[na:na] at com.sun.proxy.$Proxy2.newClient(Unknown Source) ~[na:na] at javax.management.remote.rmi.RMIConnector.getConnection(java.management@9-internal/RMIConnector.java:2072) ~[na:na] at javax.management.remote.rmi.RMIConnector.connect(java.management@9-internal/RMIConnector.java:300) ~[na:na] at javax.management.remote.JMXConnectorFactory.connect(java.management@9-internal/JMXConnectorFactory.java:268) ~[na:na] at com.zabbix.gateway.ZabbixJMXConnectorFactory$1.run(ZabbixJMXConnectorFactory.java:76) ~[zabbix-java-gateway-3.4.13.jar:na] at java.util.concurrent.Executors$RunnableAdapter.call(java.base@9-internal/Executors.java:514) ~[na:na] at java.util.concurrent.FutureTask.run(java.base@9-internal/FutureTask.java:266) ~[na:na] ... 3 common frames omitted Caused by: java.net.ConnectException: Connection refused at java.net.PlainSocketImpl.socketConnect(java.base@9-internal/Native Method) ~[na:na] at java.net.AbstractPlainSocketImpl.doConnect(java.base@9-internal/AbstractPlainSocketImpl.java:405) ~[na:na] at java.net.AbstractPlainSocketImpl.connectToAddress(java.base@9-internal/AbstractPlainSocketImpl.java:248) ~[na:na] at java.net.AbstractPlainSocketImpl.connect(java.base@9-internal/AbstractPlainSocketImpl.java:230) ~[na:na] at java.net.SocksSocketImpl.connect(java.base@9-internal/SocksSocketImpl.java:402) ~[na:na] at java.net.Socket.connect(java.base@9-internal/Socket.java:591) ~[na:na] at java.net.Socket.connect(java.base@9-internal/Socket.java:540) ~[na:na] at java.net.Socket.<init>(java.base@9-internal/Socket.java:436) ~[na:na] at java.net.Socket.<init>(java.base@9-internal/Socket.java:213) ~[na:na] at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(java.rmi@9-internal/RMIDirectSocketFactory.java:40) ~[na:na] at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(java.rmi@9-internal/RMIMasterSocketFactory.java:144) ~[na:na] at sun.rmi.transport.tcp.TCPEndpoint.newSocket(java.rmi@9-internal/TCPEndpoint.java:613) ~[na:na] ... 15 common frames omitted 2018-09-03 19:54:55.449 [pool-1-thread-3] DEBUG c.z.gateway.BinaryProtocolSpeaker - sending the following data in response: {"response":"failed","error":"java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is: \n\tjava.net.ConnectException: Connection refused"}
https://www.zabbix.com/documentation/3.4/ru/manual/discovery/low_level_discovery/jmx#поддерживаемые_макросы https://github.com/RiotGamesMinions/zabbix_jmxdiscovery https://zabbix.org/wiki/ConfigureJMX https://jolokia.org/features-nb.html