<picture>
<img src="https://circleci.com/gh/prometheus/jmx_exporter.svg?style=shield"/>
</picture>
JMX Exporter
=====
JMX to Prometheus exporter: a collector that can configurable scrape and
expose mBeans of a JMX target.
This exporter is intended to be run as a Java Agent, exposing a HTTP server
and serving metrics of the local JVM. It can be also run as a standalone
HTTP server and scrape remote JMX targets, but this has various
disadvantages, such as being harder to configure and being unable to expose
process metrics (e.g., memory and CPU usage). In particular all the
`jvm_*` metrics like `jvm_classes_loaded_total`, `jvm_threads_current`,
`jvm_threads_daemon` and `jvm_memory_bytes_used` won't be availabe if
using the standalone http server.
### **NOTES**
**- Metrics are no longer served on the root (`/`) path - use the `/metrics` path **
**- Some JVM metric names have changed to conform with the [OpenMetrics](https://openmetrics.io/) specification.**
**- Dashboards will need to be changed if referencing the changed JVM metrics.**
https://prometheus.github.io/client_java/migration/simpleclient/#jvm-metrics
## Running the Java Agent
**Running the exporter as a Java agent is strongly encouraged.**
- [jmx_prometheus_javaagent-1.0.1.jar](https://repo1.maven.org/maven2/io/prometheus/jmx/jmx_prometheus_javaagent/1.0.1/jmx_prometheus_javaagent-1.0.1.jar)
To run as a Java agent, download one of the JARs and run:
```
java -javaagent:./jmx_prometheus_javaagent-1.0.1.jar=12345:config.yaml -jar yourJar.jar
```
Metrics will now be accessible at [http://localhost:12345/metrics](http://localhost:12345/metrics).
To bind the java agent to a specific IP change the port number to `host:port`.
A minimal `config.yaml` looks like this:
```yaml
rules:
- pattern: ".*"
```
Example configurations can be found in the `example_configs/` directory.
## Running the Standalone HTTP Server
- [jmx_prometheus_httpserver-1.0.1.jar](https://repo1.maven.org/maven2/io/prometheus/jmx/jmx_prometheus_httpserver/1.0.1/jmx_prometheus_httpserver-1.0.1.jar)
To run the standalone HTTP server, download one of the JARs and run:
```
java -jar jmx_prometheus_httpserver-1.0.1.jar 12345 config.yaml
```
Metrics will now be accessible at [http://localhost:12345/metrics](http://localhost:12345/metrics).
To bind the java agent to a specific IP change the port number to `host:port`.
The standalone HTTP server will read JMX remotely over the network. Therefore, you need to specify
either `hostPort` or `jmxUrl` in `config.yaml` to tell the HTTP server where the JMX beans can be accessed.
A minimal `config.yaml` looks like this:
```yaml
hostPort: localhost:9999
rules:
- pattern: ".*"
```
As stated above, it is recommended to run JMX exporter as a Java agent and not as a standalone HTTP server.
**NOTES**
**- `jvm_*` metrics will not be available if running in standalone mode**
**- standard Java MBeans that provide JVM metrics will be available using the standard Java MBean ObjectNames**
## Building
`./mvnw clean package` to build.
## Configuration
The configuration is in YAML. An example with all possible options:
```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
includeObjectNames: ["org.apache.cassandra.metrics:*"]
excludeObjectNames: ["org.apache.cassandra.metrics:type=ColumnFamily,*"]
autoExcludeObjectNameAttributes: true
excludeObjectNameAttributes:
"java.lang:type=OperatingSystem":
- "ObjectName"
"java.lang:type=Runtime":
- "ClassPath"
- "SystemProperties"
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
```
Name | Description
---------|------------
startDelaySeconds | start delay before serving requests. Any requests within the delay period will result in an empty metrics set.
hostPort | The host and port to connect to via remote JMX. If neither this nor jmxUrl is specified, will talk to the local JVM.
username | The username to be used in remote JMX password authentication.
password | The password to be used in remote JMX password authentication.
jmxUrl | A full JMX URL to connect to. Should not be specified if hostPort is.
ssl | Whether JMX connection should be done over SSL. To configure certificates you have to set following system properties:<br/>`-Djavax.net.ssl.keyStore=/home/user/.keystore`<br/>`-Djavax.net.ssl.keyStorePassword=changeit`<br/>`-Djavax.net.ssl.trustStore=/home/user/.truststore`<br/>`-Djavax.net.ssl.trustStorePassword=changeit`
lowercaseOutputName | Lowercase the output metric name. Applies to default format and `name`. Defaults to false.
lowercaseOutputLabelNames | Lowercase the output metric label names. Applies to default format and `labels`. Defaults to false.
includeObjectNames | A list of [ObjectNames](http://docs.oracle.com/javase/6/docs/api/javax/management/ObjectName.html) to query. Defaults to all mBeans.
excludeObjectNames | A list of [ObjectNames](http://docs.oracle.com/javase/6/docs/api/javax/management/ObjectName.html) to not query. Takes precedence over `includeObjectNames`. Defaults to none.
autoExcludeObjectNameAttributes | Whether to auto exclude [ObjectName](http://docs.oracle.com/javase/6/docs/api/javax/management/ObjectName.html) attributes that can't be converted to standard metrics types. Defaults to `true`.
excludeObjectNameAttributes | A Map of [ObjectNames](http://docs.oracle.com/javase/6/docs/api/javax/management/ObjectName.html) with a list of attribute names to exclude. ObjectNames must be in canonical form. Both ObjectNames and attribute names are matched as a Strings (no regex.) Optional.
rules | A list of rules to apply in order, processing stops at the first matching rule. Attributes that aren't matched aren't collected. If not specified, defaults to collecting everything in the default format.
pattern | Regex pattern to match against each bean attribute. The pattern is not anchored. Capture groups can be used in other options. Defaults to matching everything.
attrNameSnakeCase | Converts the attribute name to snake case. This is seen in the names matched by the pattern and the default format. For example, anAttrName to an\_attr\_name. Defaults to false.
name | The metric name to set. Capture groups from the `pattern` can be used. If not specified, the default format will be used. If it evaluates to empty, processing of this attribute stops with no output.
value | Value for the metric. Static values and capture groups from the `pattern` can be used. If not specified the scraped mBean value will be used.
valueFactor | Optional number that `value` (or the scraped mBean value if `value` is not specified) is multiplied by, mainly used to convert mBean values from milliseconds to seconds.
labels | A map of label name to label value pairs. Capture groups from `pattern` can be used in each. `name` must be set to use this. Empty names and values are ignored. If not specified and the default format is not being used, no labels are set.
help | Help text for the metric. Capture groups from `pattern` can be used. `name` must be set to use this. Defaults to the mBean attribute description, domain, and name of the attribute.
cache | Whether to cache bean name expressions to rule computation (match and mismatch). Not recommended for rules matching on bean value, as only the value from the first scrape will be cached and re-used. This can increase performance when collecting a lot of mbeans. Defaults to `false`.
type | The type of the metric, can be `GAUGE`, `COUNTER` or `UNTYPED`. `name` must be set to use this. Defaults to `U
没有合适的资源?快使用搜索试试~ 我知道了~
jmx-exporter-1.0.1.tar.gz
需积分: 5 0 下载量 167 浏览量
2024-07-12
09:55:05
上传
评论
收藏 180KB GZ 举报
温馨提示
jmx_exporter-1.0.1.tar.gz
资源推荐
资源详情
资源评论
收起资源包目录
jmx-exporter-1.0.1.tar.gz (375个子文件)
jmxremote.access 19B
jmxremote.access 19B
mvnw.cmd 6KB
control 243B
.gitignore 317B
maven-wrapper.jar 61KB
HTTPServerFactory.java 32KB
JmxCollector.java 29KB
JmxCollectorTest.java 26KB
PBKDF2AuthenticatorTest.java 21KB
JmxScraper.java 21KB
SSLAndBasicAuthenticationPBKDF2WithHmacSHA512Test.java 12KB
AbstractTest.java 12KB
BasicAuthenticationPBKDF2WithHmacSHA256Test.java 12KB
BasicAuthenticationPBKDF2WithHmacSHA512Test.java 12KB
BasicAuthenticationPBKDF2WithHmacSHA1Test.java 12KB
BasicAuthenticationPlaintextTest.java 11KB
BasicAuthenticationSHA512Test.java 11KB
BasicAuthenticationSHA256Test.java 11KB
BasicAuthenticationSHA1Test.java 11KB
MetricsParser.java 11KB
CompleteHttpServerConfigurationTest.java 10KB
YamlMapAccessorTest.java 10KB
YamlMapAccessor.java 8KB
JmxMBeanPropertyCacheTest.java 8KB
TabularMBean.java 7KB
SSLWithPKCS12KeyStoreMultipleCertificatesTest.java 7KB
SSLWithPKCS12KeyStoreTest2.java 7KB
SSLWithPKCS12KeyStoreTest.java 7KB
MetricAssertion.java 6KB
RMIRegistrySSLDisabledTest.java 6KB
MinimalRMISSLTest.java 6KB
SSLWithJKSKeyStoreMultipleCertificatesTest.java 6KB
SSLWithJKSKeyStoreTest2.java 6KB
SSLWithJKSKeyStoreTest.java 6KB
MinimalTest.java 6KB
ObjectNameAttributeFilter.java 6KB
CredentialsCacheTest.java 5KB
MatchedRuleToMetricSnapshotsConverter.java 5KB
PBKDF2Authenticator.java 5KB
DockerImageNames.java 5KB
OptionalValueMBeanTest.java 5KB
ThreadsConfigurationTest.java 5KB
SSLContextFactory.java 5KB
AbstractBasicAuthenticationTest.java 5KB
MessageDigestAuthenticator.java 5KB
PrometheusRegistryUtils.java 5KB
JavaAgent.java 4KB
HttpClient.java 4KB
ExcludeObjectNameAttributesTest.java 4KB
TestContext.java 4KB
CredentialsCache.java 4KB
JmxMBeanPropertyCache.java 4KB
MatchedRule.java 4KB
WhitelistObjectNamesTest.java 4KB
IncludeObjectNamesTest.java 4KB
ExistDbMXBean.java 4KB
DisableAutoExcludeObjectNameAttributesTest.java 3KB
MatchedRulesCache.java 3KB
MessageDigestAuthenticatorTest.java 3KB
ExistDbMXBean.java 3KB
CompositeKeyDataTest.java 3KB
DuplicateLabels.java 3KB
WebServer.java 3KB
Metric.java 3KB
JavaAgentConfigurationRegexTest.java 3KB
LowerCaseOutputAndLabelNamesTest.java 3KB
TomcatPatternCheckTest.java 3KB
LowerCaseOutputLabelNamesTest.java 3KB
WhitelistAndBlacklistObjectNamesTest.java 3KB
IncludeAndExcludeObjectNamesTest.java 3KB
HttpRequest.java 3KB
BlacklistObjectNamesTest.java 3KB
ExcludeObjectNamesTest.java 3KB
LowerCaseOutputNamesTest.java 3KB
Precondition.java 3KB
AutoIncrementingMBeanTest.java 3KB
JmxExampleApplication.java 2KB
PreconditionTest.java 2KB
BuildInfoMetricsTest.java 2KB
BuildInfoMetrics.java 2KB
Logger.java 2KB
PlaintextAuthenticator.java 2KB
PerformanceMetricsMBean.java 2KB
SafeNameTest.java 2KB
Credentials.java 2KB
ConvertToMapAccessor.java 2KB
HttpResponseAssertions.java 2KB
HttpResponseBody.java 2KB
ValidateIntegerInRange.java 2KB
TestArgument.java 2KB
HexString.java 2KB
ValidateStringIsNotBlank.java 2KB
ConvertToInteger.java 2KB
HttpBasicAuthenticationCredentials.java 2KB
SnakeCaseAttrTest.java 2KB
ConvertToString.java 2KB
PerformanceMetricsMBean.java 1KB
PlaintextAuthenticatorTest.java 1KB
CredentialsTest.java 1KB
共 375 条
- 1
- 2
- 3
- 4
资源评论
XMYX-0
- 粉丝: 8937
- 资源: 19
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 5G SRM815模组原理框图.jpg
- T型3电平逆变器,lcl滤波器滤波器参数计算,半导体损耗计算,逆变电感参数设计损耗计算 mathcad格式输出,方便修改 同时支持plecs损耗仿真,基于plecs的闭环仿真,电压外环,电流内环
- 毒舌(解锁版).apk
- 显示HEX、S19、Bin、VBF等其他汽车制造商特定的文件格式
- 8bit逐次逼近型SAR ADC电路设计成品 入门时期的第三款sarADC,适合新手学习等 包括电路文件和详细设计文档 smic0.18工艺,单端结构,3.3V供电 整体采样率500k,可实现基
- 操作系统实验 ucorelab4内核线程管理
- 脉冲注入法,持续注入,启动低速运行过程中注入,电感法,ipd,力矩保持,无霍尔无感方案,媲美有霍尔效果 bldc控制器方案,无刷电机 提供源码,原理图
- Matlab Simulink#直驱永磁风电机组并网仿真模型 基于永磁直驱式风机并网仿真模型 采用背靠背双PWM变流器,先整流,再逆变 不仅实现电机侧的有功、无功功率的解耦控制和转速调节,而且能实
- 157389节奏盒子地狱模式第三阶段7.apk
- 操作系统实验ucore lab3
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功