我根据this向lib文件夹添加了系统监控的依赖项
wget https://repo1.maven.org/maven2/com/github/oshi/oshi-core/3.4.0/oshi-core-3.4.0.jar
wget https://repo1.maven.org/maven2/net/java/dev/jna/jna-platform/4.2.2/jna-platform-4.2.2.jar
wget https://repo1.maven.org/maven2/net/java/dev/jna/jna/4.2.2/jna-4.2.2.jar
但是为我展示这个例外:
WARN org.apache.flink.runtime.metrics.MetricRegistryImpl - Error while reporting metrics
java.lang.NoSuchMethodError: org.apache.flink.metrics.influxdb.shaded.okio.BufferedSource.getBuffer()Lorg/apache/flink/metrics/influxdb/shaded/okio/Buffer;
at org.apache.flink.metrics.influxdb.shaded.com.squareup.moshi.JsonUtf8Reader.<init>(JsonUtf8Reader.java:97)
at org.apache.flink.metrics.influxdb.shaded.com.squareup.moshi.JsonReader.of(JsonReader.java:196)
at org.apache.flink.metrics.influxdb.shaded.com.squareup.moshi.JsonAdapter.fromJson(JsonAdapter.java:40)
at org.apache.flink.metrics.influxdb.shaded.org.influxdb.InfluxDBException.buildExceptionForErrorState(InfluxDBException.java:172)
at org.apache.flink.metrics.influxdb.shaded.org.influxdb.impl.InfluxDBImpl.execute(InfluxDBImpl.java:821)
at org.apache.flink.metrics.influxdb.shaded.org.influxdb.impl.InfluxDBImpl.write(InfluxDBImpl.java:460)
at org.apache.flink.metrics.influxdb.InfluxdbReporter.report(InfluxdbReporter.java:118)
at org.apache.flink.runtime.metrics.MetricRegistryImpl$ReporterTask.run(MetricRegistryImpl.java:441)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)