open falcon java_open-falcon监控java详细配置
时间: 2024-05-13 17:19:08 浏览: 187
open-falcon 小米监控
Java应用程序的监控可以通过Open-Falcon进行配置和实现。下面是一些详细的配置步骤:
1. 下载和安装Open-Falcon Agent
在Java应用程序所在服务器上下载和安装Open-Falcon Agent。
2. 配置Open-Falcon Agent
修改Open-Falcon Agent配置文件,添加如下配置项:
```
{
"plugin": {
"enabled": true,
"dir": "/usr/local/open-falcon/agent/plugin"
},
"heartbeat": {
"enabled": true,
"addr": "127.0.0.1:6030",
"interval": 60,
"timeout": 1000
},
"transfer": {
"enabled": true,
"addrs": [
"127.0.0.1:8433"
],
"interval": 60,
"timeout": 1000
}
}
```
其中,`plugin.enabled`设置为`true`表示启用插件,`plugin.dir`设置插件所在目录。
3. 下载和安装Java插件
在Open-Falcon Agent所在服务器上下载和安装Java插件。
4. 配置Java插件
修改Java插件配置文件,添加如下配置项:
```
{
"debug": true,
"metric": {
"step": 60,
"prefix": "java."
},
"plugin": {
"jvm": {
"enabled": true,
"bin": "/usr/local/java/bin/java",
"option": "-classpath ${plugin_dir}/java-plugin.jar",
"jmx_url": "service:jmx:rmi:///jndi/rmi://127.0.0.1:1099/jmxrmi",
"metrics": [
{
"name": "jvm.mem.heap_used",
"type": "GAUGE",
"mbean": "java.lang:type=Memory",
"attribute": "HeapMemoryUsage.used"
},
{
"name": "jvm.mem.heap_committed",
"type": "GAUGE",
"mbean": "java.lang:type=Memory",
"attribute": "HeapMemoryUsage.committed"
},
{
"name": "jvm.mem.heap_max",
"type": "GAUGE",
"mbean": "java.lang:type=Memory",
"attribute": "HeapMemoryUsage.max"
},
{
"name": "jvm.mem.non_heap_used",
"type": "GAUGE",
"mbean": "java.lang:type=Memory",
"attribute": "NonHeapMemoryUsage.used"
},
{
"name": "jvm.mem.non_heap_committed",
"type": "GAUGE",
"mbean": "java.lang:type=Memory",
"attribute": "NonHeapMemoryUsage.committed"
},
{
"name": "jvm.threads.count",
"type": "GAUGE",
"mbean": "java.lang:type=Threading",
"attribute": "ThreadCount"
},
{
"name": "jvm.threads.daemon_count",
"type": "GAUGE",
"mbean": "java.lang:type=Threading",
"attribute": "DaemonThreadCount"
},
{
"name": "jvm.threads.peak_count",
"type": "GAUGE",
"mbean": "java.lang:type=Threading",
"attribute": "PeakThreadCount"
},
{
"name": "jvm.gc.young_count",
"type": "COUNTER",
"mbean": "java.lang:type=GarbageCollector,name=PS Scavenge",
"attribute": "CollectionCount"
},
{
"name": "jvm.gc.young_time",
"type": "COUNTER",
"mbean": "java.lang:type=GarbageCollector,name=PS Scavenge",
"attribute": "CollectionTime"
},
{
"name": "jvm.gc.old_count",
"type": "COUNTER",
"mbean": "java.lang:type=GarbageCollector,name=PS MarkSweep",
"attribute": "CollectionCount"
},
{
"name": "jvm.gc.old_time",
"type": "COUNTER",
"mbean": "java.lang:type=GarbageCollector,name=PS MarkSweep",
"attribute": "CollectionTime"
}
]
}
}
}
```
其中,`plugin.jvm.enabled`设置为`true`表示启用Java插件,`plugin.jvm.bin`设置Java程序所在路径,`plugin.jvm.option`设置Java插件所在路径,`plugin.jvm.jmx_url`设置JMX URL,`plugin.jvm.metrics`设置监控指标。
5. 重启Open-Falcon Agent
修改完Open-Falcon Agent和Java插件的配置文件后,需要重启Open-Falcon Agent。
6. 查看监控数据
在Open-Falcon Web界面上查看Java应用程序的监控数据。
阅读全文