本文介绍了无法在Windows 10上为Cassandra运行prometheus的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在按照本教程在 Windows10 上运行 Prometheus .本教程适用于 linux .我想我唯一需要更改的命令是 powershell .但是,当我尝试访问指标时,应用程序无法连接.

I am following this tutorial to run Prometheus on Windows10. The tutorial is for linux. I suppose the only command I need to change is for powershell. However, when I try to access the metrics, the application doesn't connect.

https://www.robustperception.io/monitoring-cassandra-with-prometheus

代替 echo'JVM_OPTS =''$ JVM_OPTS -javaagent:'$ PWD/jmx_prometheus_javaagent-0.3.0.jar = 7070:$ PWD/cassandra.yml'''>>conf/cassandra-env.sh ,我在 cassandra-env.ps1

    # Default JMX setup, bound to local loopback address only
    $env:JVM_OPTS="$env:JVM_OPTS -Dcassandra.jmx.local.port=$JMX_PORT"
    $env:JVM_OPTS="$env:JVM_OPTS -javaagent:'$PWD/jmx_prometheus_javaagent-0.3.0.jar=7070:$PWD/cassandra.yml'"' <-- HERE

    $env:JVM_OPTS="$env:JVM_OPTS $env:JVM_EXTRA_OPTS"
}

但是 http://localhost:7070/metrics 不起作用

更新现在,我从 .sh 中删除了更改.和 ps1 并仅在 bin/cassanbra.bat 文件中添加 javaagent ,因为这似乎是Windows所需的

UPDATENow, I have removed the changes from .sh. and ps1 and add the javaagent only in bin/cassanbra.bat file as it seems that is what is required in Windows

https://docs.appdynamics.com/display/PRO45/Apache + Cassandra + Startup + Settings

但是现在我得到了错误

Exception in thread "main" java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:386)
        at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:401)
Caused by: java.lang.NumberFormatException: For input string: "C"
        at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
        at java.lang.Integer.parseInt(Integer.java:580)
        at java.lang.Integer.parseInt(Integer.java:615)
        at io.prometheus.jmx.shaded.io.prometheus.jmx.JavaAgent.premain(JavaAgent.java:38)
        ... 6 more
FATAL ERROR in native method: processing of -javaagent failed

推荐答案

代替此:

$env:JVM_OPTS="$env:JVM_OPTS -javaagent:'$PWD/jmx_prometheus_javaagent-0.3.0.jar=7070:$PWD/cassandra.yml'"'

尝试一下:

$env:JVM_OPTS="$env:JVM_OPTS -javaagent:'$PWD/jmx_prometheus_javaagent-0.3.0.jar=7070:$PWD/cassandra.yml'"

我从行尾删除了一个引号.

I removed a single quote from the end of the line.

这篇关于无法在Windows 10上为Cassandra运行prometheus的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-17 00:27