我不知道我的config.yaml有什么问题
我按照官方网站上的示例配置了我的config.yaml, 和当我完成配置时。我运行命令:
java -javaagent:./jmx_prometheus_javaagent-0.12.0.jar=8980:config.yaml -jar /usr/local/tomcat/apache-activemq/apache-activemq-5.8.0_56/bin/activemq.jar
但是我收到有关我的config.yaml的错误
这是我的配置文件
[root@sz-7-centos162 test]# cat config.yaml
{
startDelaySeconds: 0,
username: admin,
password: admin,
jmxUrl: service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi,
ssl: false,
lowercaseOutputName: false,
lowercaseOutputLabelNames: false
}
以下是错误日志:
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:497)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:386)
at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:401)
Caused by: while scanning a plain scalar
in 'reader', line 5, column 17:
jmxUrl: service:jmx:rmi:///jndi/rmi://lo ...
^
found unexpected ':'
in 'reader', line 5, column 24:
jmxUrl: service:jmx:rmi:///jndi/rmi://localhost ...
^
Please check http://pyyaml.org/wiki/YAMLColonInFlowContext for details.
at io.prometheus.jmx.shaded.org.yaml.snakeyaml.scanner.ScannerImpl.scanPlain(ScannerImpl.java:2013)
at io.prometheus.jmx.shaded.org.yaml.snakeyaml.scanner.ScannerImpl.fetchPlain(ScannerImpl.java:1046)
at io.prometheus.jmx.shaded.org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.java:401)
at io.prometheus.jmx.shaded.org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:226)
at io.prometheus.jmx.shaded.org.yaml.snakeyaml.parser.ParserImpl$ParseFlowMappingValue.produce(ParserImpl.java:762)
at io.prometheus.jmx.shaded.org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:158)
at io.prometheus.jmx.shaded.org.yaml.snakeyaml.parser.ParserImpl.checkEvent(ParserImpl.java:143)
at io.prometheus.jmx.shaded.org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:132)
at io.prometheus.jmx.shaded.org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:229)
at io.prometheus.jmx.shaded.org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:155)
at io.prometheus.jmx.shaded.org.yaml.snakeyaml.composer.Composer.composeDocument(Composer.java:122)
at io.prometheus.jmx.shaded.org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:105)
at io.prometheus.jmx.shaded.org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:120)
at io.prometheus.jmx.shaded.org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:450)
at io.prometheus.jmx.shaded.org.yaml.snakeyaml.Yaml.load(Yaml.java:393)
at io.prometheus.jmx.shaded.io.prometheus.jmx.JmxCollector.<init>(JmxCollector.java:74)
at io.prometheus.jmx.shaded.io.prometheus.jmx.JavaAgent.premain(JavaAgent.java:29)
... 6 more
FATAL ERROR in native method: processing of -javaagent failed
Aborted
将 URL 括在引号中,例如jmxUrl: "service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi"
您需要将值括在引号中,如下所示:
jmxUrl: "service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi",
有关详细信息,请参阅此处:如何在 YAML 中转义指示符(即 : 或 - (