class SystemMonitorMeasurementProvider extends StaticMeasurementProvider {

    private final SystemMonitorService monitorService = new SystemMonitorServiceImpl();

    private final Duration collectInterval = TimeUtils.parse(System.getProperty("monitor.system.collector.interval", "1m"));

    private final Scheduler scheduler;

    private final TimeSeriesManager timeSeriesManager;

    static final TimeSeriesMetric metric = TimeSeriesMetric.of(System.getProperty("monitor.system.collector.metric", "system_monitor"));

    private final Disposable.Composite disposable = Disposables.composite();


    public SystemMonitorMeasurementProvider(TimeSeriesManager timeSeriesManager) {
        super(DefaultDashboardDefinition.systemMonitor, MonitorObjectDefinition.stats);
        this.timeSeriesManager = timeSeriesManager;

        addMeasurement(new StaticMeasurement(CommonMeasurementDefinition.info)
            .addDimension(new RealTimeDimension())
            .addDimension(new HistoryDimension())
        );

        this.scheduler = Schedulers.newSingle("system-monitor-collector");

        disposable.add(this.scheduler);
    }

    @PreDestroy
    public void destroy() {
        disposable.dispose();
    }

    @PostConstruct
    public void init() {
        //注册监控信息
        timeSeriesManager
            .registerMetadata(
                TimeSeriesMetadata.of(metric)
            )
            .block(Duration.ofSeconds(10));

        //定时收集监控信息
        disposable.add(Flux
            .interval(collectInterval, scheduler)
            .flatMap(ignore -> monitorService
                .system()
                .map(this::systemInfoToMap)
                .flatMap(data -> timeSeriesManager.getService(metric).commit(data))
                .onErrorResume(err -> Mono.empty()))
            .subscribe()
        );
    }

    private void putTo(String prefix, MonitorInfo<?> source, Map<String, Object> target) {<FILL_FUNCTION_BODY>}

    public TimeSeriesData systemInfoToMap(SystemInfo info) {
        Map<String, Object> map = Maps.newLinkedHashMapWithExpectedSize(12);
        putTo("cpu", info.getCpu(), map);
        putTo("disk", info.getDisk(), map);
        putTo("memory", info.getMemory(), map);
        return TimeSeriesData.of(System.currentTimeMillis(), map);
    }

    //历史记录
    class HistoryDimension implements MeasurementDimension {

        @Override
        public DimensionDefinition getDefinition() {
            return CommonDimensionDefinition.history;
        }

        @Override
        public DataType getValueType() {
            return new ObjectType();
        }

        @Override
        public ConfigMetadata getParams() {
            return new DefaultConfigMetadata();
        }

        @Override
        public boolean isRealTime() {
            return false;
        }

        @Override
        public Flux<? extends MeasurementValue> getValue(MeasurementParameter parameter) {
            Date from = parameter.getDate("from", TimeUtils.parseDate("now-1h"));
            Date to = parameter.getDate("to", TimeUtils.parseDate("now"));

            return QueryParamEntity
                .newQuery()
                .noPaging()
                .between("timestamp", from, to)
                .execute(timeSeriesManager.getService(metric)::query)
                .map(tsData -> SimpleMeasurementValue.of(tsData.getData(), tsData.getTimestamp()));
        }
    }

    //实时监控
    class RealTimeDimension implements MeasurementDimension {

        @Override
        public DimensionDefinition getDefinition() {
            return CommonDimensionDefinition.realTime;
        }

        @Override
        public DataType getValueType() {
            return new ObjectType();
        }

        @Override
        public ConfigMetadata getParams() {

            return new DefaultConfigMetadata()
                .add("interval", "更新频率", StringType.GLOBAL)
                .add("type", "指标类型", new EnumType()
                    .addElement(EnumType.Element.of("all", "全部"))
                    .addElement(EnumType.Element.of("cpu", "CPU"))
                    .addElement(EnumType.Element.of("memory", "内存"))
                    .addElement(EnumType.Element.of("disk", "硬盘"))
                );
        }

        @Override
        public boolean isRealTime() {
            return true;
        }

        @Override
        @SuppressWarnings("all")
        public Publisher<? extends MeasurementValue> getValue(MeasurementParameter parameter) {
            Duration interval = parameter.getDuration("interval", Duration.ofSeconds(1));
            String type = parameter.getString("type", "all");

            return Flux
                .concat(
                    info(monitorService, type),
                    Flux
                        .interval(interval)
                        .flatMap(ignore -> info(monitorService, type))
                )
                .map(info -> SimpleMeasurementValue.of(info, System.currentTimeMillis()));
        }

        private Mono<? extends MonitorInfo<?>> info(SystemMonitorService service, String type) {
            Mono<? extends MonitorInfo<?>> data;
            switch (type) {
                case "cpu":
                    data = service.cpu();
                    break;
                case "memory":
                    data = service.memory();
                    break;
                case "disk":
                    data = service.disk();
                    break;
                default:
                    data = service.system();
                    break;
            }
            return data
                .onErrorResume(err -> Mono.empty());
        }


    }

}

        Map<String, Object> data = FastBeanCopier.copy(source, new HashMap<>());
        data.forEach((key, value) -> {
            char[] keyChars = key.toCharArray();
            keyChars[0] = Character.toUpperCase(keyChars[0]);
            target.put(prefix + new String(keyChars), value);
        });
    
<methods>public void <init>(org.jetlinks.community.dashboard.DashboardDefinition, org.jetlinks.community.dashboard.ObjectDefinition) ,public Mono<org.jetlinks.community.dashboard.Measurement> getMeasurement(java.lang.String) ,public Flux<org.jetlinks.community.dashboard.Measurement> getMeasurements() <variables>private org.jetlinks.community.dashboard.DashboardDefinition dashboardDefinition,private Map<java.lang.String,org.jetlinks.community.dashboard.Measurement> measurements,private org.jetlinks.community.dashboard.ObjectDefinition objectDefinition