티스토리 뷰
JMX Beans 정보를 prometheus에서 보기 위해서 설정 중 오류입니다.
github.com/prometheus/jmx_exporter
config.yaml 생성
---
startDelaySeconds: 0
hostPort: 127.0.0.1:1234
username:
password:
jmxUrl: service:jmx:rmi:///jndi/rmi://127.0.0.1:1234/jmxrmi
ssl: false
lowercaseOutputName: false
lowercaseOutputLabelNames: false
whitelistObjectNames: ["org.apache.cassandra.metrics:*"]
blacklistObjectNames: ["org.apache.cassandra.metrics:type=ColumnFamily,*"]
rules:
- pattern: 'org.apache.cassandra.metrics<type=(\w+), name=(\w+)><>Value: (\d+)'
name: cassandra_$1_$2
value: $3
valueFactor: 0.001
labels: {}
help: "Cassandra metric $1 $2"
cache: false
type: GAUGE
attrNameSnakeCase: false
아래와 같이 실행
java -javaagent:./jmx_prometheus_javaagent-0.14.0.jar=8080:config.yaml -jar yourJar.jar
오류
At most one of hostPort and jmxUrl must be provided
if (yamlConfig.containsKey("hostPort")) {
if (yamlConfig.containsKey("jmxUrl")) {
throw new IllegalArgumentException("At most one of hostPort and jmxUrl must be provided");
}
cfg.jmxUrl ="service:jmx:rmi:///jndi/rmi://" + (String)yamlConfig.get("hostPort") + "/jmxrmi";
} else if (yamlConfig.containsKey("jmxUrl")) {
cfg.jmxUrl = (String)yamlConfig.get("jmxUrl");
}
해결
위의 config.yaml 파일 중 hostPort를 설정했으면 jmxUrl을 주석처리 합니다.
반응형
댓글