{"id":23099678,"url":"https://github.com/hiwepy/jmxtrans-integration","last_synced_at":"2026-04-18T05:34:07.556Z","repository":{"id":105833994,"uuid":"86537362","full_name":"hiwepy/jmxtrans-integration","owner":"hiwepy","description":"embedded-jmxtrans 整合 Spring、Servlet、InfluxDB","archived":false,"fork":false,"pushed_at":"2019-11-03T14:09:16.000Z","size":83,"stargazers_count":0,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-24T06:27:47.420Z","etag":null,"topics":["influxdb","jmxtrans","spring"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hiwepy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2017-03-29T04:09:57.000Z","updated_at":"2019-11-03T14:08:58.000Z","dependencies_parsed_at":"2023-06-14T08:30:57.244Z","dependency_job_id":null,"html_url":"https://github.com/hiwepy/jmxtrans-integration","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hiwepy/jmxtrans-integration","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hiwepy%2Fjmxtrans-integration","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hiwepy%2Fjmxtrans-integration/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hiwepy%2Fjmxtrans-integration/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hiwepy%2Fjmxtrans-integration/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hiwepy","download_url":"https://codeload.github.com/hiwepy/jmxtrans-integration/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hiwepy%2Fjmxtrans-integration/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31957657,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T00:39:45.007Z","status":"online","status_checked_at":"2026-04-18T02:00:07.018Z","response_time":103,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["influxdb","jmxtrans","spring"],"created_at":"2024-12-16T23:20:10.100Z","updated_at":"2026-04-18T05:34:07.551Z","avatar_url":"https://github.com/hiwepy.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jmxtrans-integration\r\n\r\nembedded-jmxtrans 整合  Spring、Servlet、InfluxDB\r\n\r\n## 1、Servlet Integration\r\n\r\n参考EmbeddedJmxTransLoaderListener对象注解\r\n```xml\r\n\u003ccontext-param\u003e\r\n\t\u003cparam-name\u003ejmxtrans.config\u003c/param-name\u003e\r\n\t\u003cparam-value\u003e\r\n\t\tclasspath:jmxtrans.json\r\n\t\tclasspath:org/jmxtrans/embedded/config/jmxtrans-internals-servlet-container.json\r\n\t\tclasspath:org/jmxtrans/embedded/config/tomcat-7.json\r\n\t\tclasspath:org/jmxtrans/embedded/config/jvm-sun-hotspot.json\r\n\t\u003c/param-value\u003e\r\n\u003c/context-param\u003e\r\n\u003clistener\u003e\r\n\t\u003clistener-class\u003eorg.jmxtrans.embedded.servlet.EmbeddedJmxTransLoaderListener\u003c/listener-class\u003e\r\n\u003c/listener\u003e\r\n```\r\n## 2、Spring Integration\r\n\r\n本人参考 embedded-jmxtrans 的github地址 https://github.com/jmxtrans/embedded-jmxtrans/wiki 配置后，测试完全无效。\r\n阅读代码后采用另种方式：\r\n\r\n配置EmbeddedJmxTransFactory\r\n```xml\r\n\u003cbean id=\"jmxtrans\" class=\"org.jmxtrans.embedded.spring.EmbeddedJmxTransFactory\" destroy-method=\"destroy\" scope=\"singleton\"\u003e\r\n\t\u003c!-- JMX对象名称  --\u003e\r\n\t\u003cproperty name=\"beanName\" value=\"jmxtrans\"/\u003e\r\n\t\u003c!-- 监听配置文件变化: 每60秒检测一次  --\u003e\r\n\t\u003cproperty name=\"configurationScanPeriodInSeconds\" value=\"60\"/\u003e\r\n\t\u003c!-- 如果未发现指定的配置文件 ，是否忽略 --\u003e\r\n\t\u003cproperty name=\"ignoreConfigurationNotFound\" value=\"true\"/\u003e\r\n\t\u003c!-- 初始配置文件 --\u003e\r\n\t\u003cproperty name=\"configurationUrls\"\u003e\r\n\t\t\u003clist\u003e\r\n         \t\u003cvalue\u003eclasspath:jmxtrans.json\u003c/value\u003e  \r\n         \t\u003cvalue\u003eclasspath:org/jmxtrans/embedded/config/tomcat-7.json\u003c/value\u003e\r\n         \t\u003cvalue\u003eclasspath:org/jmxtrans/embedded/config/jmxtrans-internals.json\u003c/value\u003e \r\n         \t\u003cvalue\u003eclasspath:org/jmxtrans/embedded/config/jvm-sun-hotspot.json\u003c/value\u003e\r\n     \t\u003c/list\u003e\r\n\t\u003c/property\u003e\r\n\u003c/bean\u003e\r\n```\r\n使用EmbeddedJmxTransFactory；此处发现如果不引用上面的对象，则无法调用getObject方法实现对象初始化\r\n```xml\r\n\u003cbean class=\"org.jmxtrans.embedded.EmbeddedJmxTransLauncher\"\u003e\r\n\t\u003cproperty name=\"jmxtrans\" ref=\"jmxtrans\"/\u003e\r\n\u003c/bean\u003e\r\n```\r\n\r\n## 3、InfluxDB Integration\r\n\r\n在第二则中提到配置文件 jmxtrans.json；为了将数据自己输出到InfluxDB,我拷贝了jmxtrans-output-influxdb的代码，做了一些调整，配置如下：\r\n\r\n\r\n```json\r\n{\r\n    \"queries\": [\r\n    \t{\r\n            \"objectName\": \"Catalina:type=Manager,context=/,host=*\",\r\n            \"resultAlias\": \"application.activeSessions\",\r\n            \"attributes\": [\r\n                \"activeSessions\"\r\n            ]\r\n\r\n        }\r\n    ],\r\n    \"outputWriters\": [\r\n        {\r\n\t        \"@class\": \"org.jmxtrans.embedded.output.Slf4jWriter\",\r\n\t        \"settings\": {\r\n\t            \"enabled\": \"${jmxtrans.writer.slf4j.enabled:true}\"\r\n\t        }\r\n    \t},\r\n    \t{\r\n\t        \"@class\": \"org.jmxtrans.embedded.output.influxdb.InfluxDbOutputWriter\",\r\n\t        \"settings\": {\r\n\t            \"enabled\": \"${jmxtrans.writer.influxdb.enabled:true}\",\r\n\t            \"url\": \"${jmxtrans.writer.influxdb.url:http://localhost:8086}\",\r\n\t            \"database\": \"${jmxtrans.writer.influxdb.database:APP_Metrics}\",\r\n\t            \"user\": \"${jmxtrans.writer.influxdb.user:admin}\",\r\n\t            \"password\": \"${jmxtrans.writer.influxdb.password:admin}\",\r\n\t            \"tags\": \"${jmxtrans.writer.influxdb.tags:host=#hostname#}\"\r\n\t            \r\n\t        }\r\n    \t}\r\n    ]\r\n}\r\n```\r\n\r\n\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhiwepy%2Fjmxtrans-integration","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhiwepy%2Fjmxtrans-integration","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhiwepy%2Fjmxtrans-integration/lists"}