kongdeqiang
2023-02-14 18d6ac5798b9ef96077f592ccc3f94b365006e6a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
package com.wgcloud.task;
 
import cn.hutool.core.collection.CollectionUtil;
import com.wgcloud.common.NettytHandler;
import com.wgcloud.config.CommonConfig;
import com.wgcloud.entity.*;
import com.wgcloud.service.*;
import com.wgcloud.util.DateUtil;
import com.wgcloud.util.HostUtil;
import com.wgcloud.util.ServerBackupUtil;
import com.wgcloud.util.ThreadPoolUtil;
import com.wgcloud.util.msg.WarnMailUtil;
import com.wgcloud.util.msg.WarnPools;
import com.wgcloud.util.staticvar.BatchData;
import com.wgcloud.util.staticvar.StaticKeys;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
 
import java.util.*;
 
/**
 * @version v3.3
 * @ClassName:DataScheduledTask.java
 * @author: http://www.wgstart.com
 * @date: 2021年3月16日
 * @Description: 定时提交监控数据,清理历史数据
 * @Copyright: 2019-2021 wgcloud. All rights reserved.
 */
@Component
public class DataScheduledTask {
    private Logger logger = LoggerFactory.getLogger(DataScheduledTask.class);
 
 
    @Autowired
    private SystemInfoService systemInfoService;
    @Autowired
    private DiskStateService diskStateService;
    @Autowired
    private DeskIoService deskIoService;
    @Autowired
    private DiskSmartService diskSmartService;
    @Autowired
    private HostDiskPerService hostDiskPerService;
    @Autowired
    private CpuTemperaturesService cpuTemperaturesService;
    @Autowired
    private LogInfoService logInfoService;
    @Autowired
    private AppInfoService appInfoService;
    @Autowired
    private CustomInfoService customInfoService;
    @Autowired
    private FileWarnInfoService fileWarnInfoService;
    @Autowired
    private DockerInfoService dockerInfoService;
    @Autowired
    private PortInfoService portInfoService;
    @Autowired
    private FileSafeService fileSafeService;
    @Autowired
    private CpuStateService cpuStateService;
    @Autowired
    private MemStateService memStateService;
    @Autowired
    private NetIoStateService netIoStateService;
    @Autowired
    private SysLoadStateService sysLoadStateService;
    @Autowired
    private AppStateService appStateService;
    @Autowired
    private CustomStateService customStateService;
    @Autowired
    private FileWarnStateService fileWarnStateService;
    @Autowired
    private ShellStateService shellStateService;
    @Autowired
    private HeathStateService heathStateService;
    @Autowired
    private DceStateService dceStateService;
    @Autowired
    private SnmpStateService snmpStateService;
    @Autowired
    private DockerStateService dockerStateService;
    @Autowired
    private DbTableCountService dbTableCountService;
    @Autowired
    private TaskUtilService taskUtilService;
    @Autowired
    private CommonConfig commonConfig;
 
 
    /**
     * 29秒后执行,之后每隔29秒执行, 单位:ms。
     * 批量提交数据
     */
    @Scheduled(initialDelay = 29000L, fixedRate = 29 * 1000)
    public synchronized void commitTask() {
        if (DateUtil.isClearTime()) {
            logger.info("正在清空历史趋势图数据,不执行提交监控数据----------" + DateUtil.getCurrentDateTime());
            BatchData.clearAll();
            return;
        }
        logger.info("批量提交监控数据任务开始----------" + DateUtil.getCurrentDateTime());
        try {
            if (BatchData.FILEWARN_STATE_LIST.size() > 0) {
                List<FileWarnState> FILEWARN_STATE_LIST = new ArrayList<FileWarnState>();
                FILEWARN_STATE_LIST.addAll(BatchData.FILEWARN_STATE_LIST);
                BatchData.FILEWARN_STATE_LIST.clear();
                fileWarnStateService.saveRecord(FILEWARN_STATE_LIST);
            }
            if (BatchData.APP_STATE_LIST.size() > 0) {
                List<AppState> APP_STATE_LIST = new ArrayList<AppState>();
                APP_STATE_LIST.addAll(BatchData.APP_STATE_LIST);
                BatchData.APP_STATE_LIST.clear();
                appStateService.saveRecord(APP_STATE_LIST);
            }
            if (BatchData.CUSTOM_STATE_LIST.size() > 0) {
                List<CustomState> CUSTOM_STATE_LIST = new ArrayList<CustomState>();
                CUSTOM_STATE_LIST.addAll(BatchData.CUSTOM_STATE_LIST);
                BatchData.CUSTOM_STATE_LIST.clear();
                customStateService.saveRecord(CUSTOM_STATE_LIST);
            }
            if (BatchData.HEATH_STATE_LIST.size() > 0) {
                List<HeathState> HEATH_STATE_LIST = new ArrayList<HeathState>();
                HEATH_STATE_LIST.addAll(BatchData.HEATH_STATE_LIST);
                BatchData.HEATH_STATE_LIST.clear();
                heathStateService.saveRecord(HEATH_STATE_LIST);
            }
            if (BatchData.DCE_STATE_LIST.size() > 0) {
                List<DceState> DCE_STATE_LIST = new ArrayList<DceState>();
                DCE_STATE_LIST.addAll(BatchData.DCE_STATE_LIST);
                BatchData.DCE_STATE_LIST.clear();
                dceStateService.saveRecord(DCE_STATE_LIST);
            }
            if (BatchData.DBTABLE_COUNT_LIST.size() > 0) {
                List<DbTableCount> DBTABLE_COUNT_LIST = new ArrayList<DbTableCount>();
                DBTABLE_COUNT_LIST.addAll(BatchData.DBTABLE_COUNT_LIST);
                BatchData.DBTABLE_COUNT_LIST.clear();
                dbTableCountService.saveRecord(DBTABLE_COUNT_LIST);
            }
            if (BatchData.SNMP_STATE_LIST.size() > 0) {
                List<SnmpState> SNMP_STATE_LIST = new ArrayList<SnmpState>();
                SNMP_STATE_LIST.addAll(BatchData.SNMP_STATE_LIST);
                BatchData.SNMP_STATE_LIST.clear();
                snmpStateService.saveRecord(SNMP_STATE_LIST);
            }
            if (BatchData.DOCKER_STATE_LIST.size() > 0) {
                List<DockerState> DOCKER_STATE_LIST = new ArrayList<DockerState>();
                DOCKER_STATE_LIST.addAll(BatchData.DOCKER_STATE_LIST);
                BatchData.DOCKER_STATE_LIST.clear();
                dockerStateService.saveRecord(DOCKER_STATE_LIST);
            }
            if (BatchData.CPU_STATE_LIST.size() > 0) {
                List<CpuState> CPU_STATE_LIST = new ArrayList<CpuState>();
                CPU_STATE_LIST.addAll(BatchData.CPU_STATE_LIST);
                BatchData.CPU_STATE_LIST.clear();
                cpuStateService.saveRecord(CPU_STATE_LIST);
            }
            if (BatchData.MEM_STATE_LIST.size() > 0) {
                List<MemState> MEM_STATE_LIST = new ArrayList<MemState>();
                MEM_STATE_LIST.addAll(BatchData.MEM_STATE_LIST);
                BatchData.MEM_STATE_LIST.clear();
                memStateService.saveRecord(MEM_STATE_LIST);
            }
            if (BatchData.NETIO_STATE_LIST.size() > 0) {
                List<NetIoState> NETIO_STATE_LIST = new ArrayList<NetIoState>();
                NETIO_STATE_LIST.addAll(BatchData.NETIO_STATE_LIST);
                BatchData.NETIO_STATE_LIST.clear();
                netIoStateService.saveRecord(NETIO_STATE_LIST);
            }
            if (BatchData.SYSLOAD_STATE_LIST.size() > 0) {
                List<SysLoadState> SYSLOAD_STATE_LIST = new ArrayList<SysLoadState>();
                SYSLOAD_STATE_LIST.addAll(BatchData.SYSLOAD_STATE_LIST);
                BatchData.SYSLOAD_STATE_LIST.clear();
                sysLoadStateService.saveRecord(SYSLOAD_STATE_LIST);
            }
            if (BatchData.LOG_INFO_LIST.size() > 0) {
                List<LogInfo> LOG_INFO_LIST = new ArrayList<LogInfo>();
                LOG_INFO_LIST.addAll(BatchData.LOG_INFO_LIST);
                BatchData.LOG_INFO_LIST.clear();
                logInfoService.saveRecord(LOG_INFO_LIST);
            }
            if (BatchData.DISK_STATE_LIST.size() > 0) {
                batchCommitDeskState();
            }
            if (BatchData.DESK_IO_LIST.size() > 0) {
                batchCommitDeskIo();
            }
            if (BatchData.DISK_SMART_LIST.size() > 0) {
                batchCommitDiskSmart();
            }
            if (BatchData.CPU_TEMPERATURES_LIST.size() > 0) {
                batchCommitCpuTemperatures();
            }
            if (BatchData.SYSTEM_INFO_LIST.size() > 0) {
                batchCommitSystemInfo();
            }
            if (BatchData.APP_INFO_LIST.size() > 0) {
                batchCommitAppInfo();
            }
            if (BatchData.CUSTOM_INFO_LIST.size() > 0) {
                batchCommitCustomInfo();
            }
            if (BatchData.FILEWARN_INFO_LIST.size() > 0) {
                batchCommitFileWarnInfo();
            }
            if (BatchData.PORT_INFO_LIST.size() > 0) {
                batchCommitPortInfo();
            }
            if (BatchData.FILE_SAFE_LIST.size() > 0) {
                batchCommitFileSafes();
            }
            if (BatchData.DOCKER_INFO_LIST.size() > 0) {
                batchCommitDockerInfo();
            }
        } catch (Exception e) {
            // TODO Auto-generated catch block
            logger.error("批量提交监控数据错误", e);
            logInfoService.save("批量提交监控数据错误", e.toString(), StaticKeys.LOG_XTCZ);
        }
        logger.info("批量提交监控数据任务结束----------" + DateUtil.getCurrentDateTime());
    }
 
    /**
     * cpu温度数据保存
     *
     * @throws Exception
     */
    private void batchCommitCpuTemperatures() throws Exception {
        Map<String, Object> paramsDel = new HashMap<String, Object>();
 
        List<CpuTemperatures> CPU_TEMPERATURES_LIST = new ArrayList<CpuTemperatures>();
        CPU_TEMPERATURES_LIST.addAll(BatchData.CPU_TEMPERATURES_LIST);
        BatchData.CPU_TEMPERATURES_LIST.clear();
        List<String> hostnameList = new ArrayList<String>();
        for (CpuTemperatures deskState : CPU_TEMPERATURES_LIST) {
            if (!hostnameList.contains(deskState.getHostname())) {
                hostnameList.add(deskState.getHostname());
            }
        }
        if (!CollectionUtil.isEmpty(hostnameList)) {
            cpuTemperaturesService.deleteByAccHname(hostnameList);
        }
        cpuTemperaturesService.saveRecord(CPU_TEMPERATURES_LIST);
    }
 
    /**
     * 磁盘smart数据保存
     *
     * @throws Exception
     */
    private void batchCommitDiskSmart() throws Exception {
        List<DiskSmart> DISK_SMART_LIST = new ArrayList<DiskSmart>();
        DISK_SMART_LIST.addAll(BatchData.DISK_SMART_LIST);
        BatchData.DISK_SMART_LIST.clear();
        List<String> hostnameList = new ArrayList<String>();
        for (DiskSmart diskSmart : DISK_SMART_LIST) {
            if (!hostnameList.contains(diskSmart.getHostname())) {
                hostnameList.add(diskSmart.getHostname());
            }
        }
        if (!CollectionUtil.isEmpty(hostnameList)) {
            diskSmartService.deleteByAccHname(hostnameList);
        }
        diskSmartService.saveRecord(DISK_SMART_LIST);
    }
 
    /**
     * 磁盘io数据保存
     *
     * @throws Exception
     */
    private void batchCommitDeskIo() throws Exception {
        List<DeskIo> DESK_IO_LIST = new ArrayList<DeskIo>();
        DESK_IO_LIST.addAll(BatchData.DESK_IO_LIST);
        BatchData.DESK_IO_LIST.clear();
        List<String> hostnameList = new ArrayList<String>();
        for (DeskIo deskState : DESK_IO_LIST) {
            if (!hostnameList.contains(deskState.getHostname())) {
                hostnameList.add(deskState.getHostname());
            }
        }
        if (!CollectionUtil.isEmpty(hostnameList)) {
            deskIoService.deleteByAccHname(hostnameList);
        }
        deskIoService.saveRecord(DESK_IO_LIST);
    }
 
 
    /**
     * 磁盘空间数据保存
     *
     * @throws Exception
     */
    private void batchCommitDeskState() throws Exception {
        List<DiskState> DISK_STATE_LIST = new ArrayList<DiskState>();
        DISK_STATE_LIST.addAll(BatchData.DISK_STATE_LIST);
        BatchData.DISK_STATE_LIST.clear();
        List<String> hostnameList = new ArrayList<String>();
        for (DiskState diskState : DISK_STATE_LIST) {
            if (!hostnameList.contains(diskState.getHostname())) {
                hostnameList.add(diskState.getHostname());
            }
        }
        if (!CollectionUtil.isEmpty(hostnameList)) {
            diskStateService.deleteByAccHname(hostnameList);
        }
        diskStateService.saveRecord(DISK_STATE_LIST);
    }
 
    /**
     * docker监控数据保存
     *
     * @throws Exception
     */
    private void batchCommitDockerInfo() throws Exception {
        Map<String, Object> paramsDel = new HashMap<String, Object>();
        List<DockerInfo> DOCKER_INFO_LIST = new ArrayList<DockerInfo>();
        DOCKER_INFO_LIST.addAll(BatchData.DOCKER_INFO_LIST);
        BatchData.DOCKER_INFO_LIST.clear();
 
        dockerInfoService.updateRecord(DOCKER_INFO_LIST);
    }
 
    /**
     * 进程监控数据保存
     *
     * @throws Exception
     */
    private void batchCommitAppInfo() throws Exception {
        Map<String, Object> paramsDel = new HashMap<String, Object>();
        List<AppInfo> APP_INFO_LIST = new ArrayList<AppInfo>();
        APP_INFO_LIST.addAll(BatchData.APP_INFO_LIST);
        BatchData.APP_INFO_LIST.clear();
 
        appInfoService.updateRecord(APP_INFO_LIST);
    }
 
    /**
     * 自定义监控项数据保存
     *
     * @throws Exception
     */
    private void batchCommitCustomInfo() throws Exception {
        Map<String, Object> paramsDel = new HashMap<String, Object>();
        List<CustomInfo> CUSTOM_INFO_LIST = new ArrayList<CustomInfo>();
        CUSTOM_INFO_LIST.addAll(BatchData.CUSTOM_INFO_LIST);
        BatchData.CUSTOM_INFO_LIST.clear();
 
        customInfoService.updateRecord(CUSTOM_INFO_LIST);
    }
 
    /**
     * 日志文件监控数据保存
     *
     * @throws Exception
     */
    private void batchCommitFileWarnInfo() throws Exception {
        Map<String, Object> paramsDel = new HashMap<String, Object>();
        List<FileWarnInfo> FILEWARN_INFO_LIST = new ArrayList<FileWarnInfo>();
        FILEWARN_INFO_LIST.addAll(BatchData.FILEWARN_INFO_LIST);
        BatchData.FILEWARN_INFO_LIST.clear();
 
        fileWarnInfoService.updateRecord(FILEWARN_INFO_LIST);
    }
 
    /**
     * 端口监控数据保存
     *
     * @throws Exception
     */
    private void batchCommitPortInfo() throws Exception {
        Map<String, Object> paramsDel = new HashMap<String, Object>();
        List<PortInfo> PORT_INFO_LIST = new ArrayList<PortInfo>();
        PORT_INFO_LIST.addAll(BatchData.PORT_INFO_LIST);
        BatchData.PORT_INFO_LIST.clear();
 
        portInfoService.updateRecord(PORT_INFO_LIST);
    }
 
    /**
     * 文件防篡改信息监测数据保存
     *
     * @throws Exception
     */
    private void batchCommitFileSafes() throws Exception {
        Map<String, Object> params = new HashMap<String, Object>();
        List<FileSafe> FILE_SAFE_LIST = new ArrayList<FileSafe>();
        FILE_SAFE_LIST.addAll(BatchData.FILE_SAFE_LIST);
        BatchData.FILE_SAFE_LIST.clear();
 
        fileSafeService.updateRecord(FILE_SAFE_LIST);
    }
 
    /**
     * 主机监控数据保存
     *
     * @throws Exception
     */
    private void batchCommitSystemInfo() throws Exception {
        Map<String, Object> paramsDel = new HashMap<String, Object>();
        List<SystemInfo> SYSTEM_INFO_LIST = new ArrayList<SystemInfo>();
        SYSTEM_INFO_LIST.addAll(BatchData.SYSTEM_INFO_LIST);
        BatchData.SYSTEM_INFO_LIST.clear();
        List<SystemInfo> updateList = new ArrayList<SystemInfo>();
        List<SystemInfo> insertList = new ArrayList<SystemInfo>();
        List<SystemInfo> savedList = systemInfoService.selectAllByParams(paramsDel);
        for (SystemInfo systemInfo : SYSTEM_INFO_LIST) {
            if (StringUtils.isEmpty(systemInfo.getHostname())) {
                continue;
            }
            boolean issaved = false;
            //之前若保存过,更新主机
            for (SystemInfo systemInfoS : savedList) {
                if (systemInfoS.getHostname().equals(systemInfo.getHostname())) {
                    systemInfo.setId(systemInfoS.getId());
                    updateList.add(systemInfo);
                    issaved = true;
                    break;
                }
            }
            //之前未保存过,新增主机
            if (!issaved) {
                insertList.add(systemInfo);
            }
        }
        //更新
        systemInfoService.updateRecord(updateList);
        //新增
        systemInfoService.saveRecord(insertList);
 
        //新加入主机发送通知 begin
        for (SystemInfo systemInfoNew : insertList) {
            Runnable runnable = () -> {
                WarnMailUtil.sendHostDown(systemInfoNew, false);
            };
            ThreadPoolUtil.executor.execute(runnable);
        }
        //新加入主机发送通知 end
    }
 
    /**
     * 所有主机都新增一条磁盘总使用率信息
     *
     * @throws Exception
     */
    private void addHostDiskPer() throws Exception {
        Date nowtime = DateUtil.getNowTime();
        List<HostDiskPer> hostDiskPerList = new ArrayList<>();
        Map<String, Object> params = new HashMap<String, Object>();
        List<SystemInfo> systemInfoList = systemInfoService.selectAllByParams(params);
        for (SystemInfo systemInfo1 : systemInfoList) {
            params.put("hostname", systemInfo1.getHostname());
            List<DiskState> deskStates = diskStateService.selectAllByParams(params);
            HostUtil.setDiskSumPer(deskStates, systemInfo1);
            HostDiskPer hostDiskPer = new HostDiskPer();
            hostDiskPer.setCreateTime(nowtime);
            hostDiskPer.setDiskSumPer(systemInfo1.getDiskPer());
            hostDiskPer.setHostname(systemInfo1.getHostname());
            hostDiskPerList.add(hostDiskPer);
        }
        hostDiskPerService.saveRecord(hostDiskPerList);
    }
 
    /**
     * 每天凌晨8:24:30执行
     * 清理历史数据过程即将结束时,将主机、端口、进程、docker的更新时间刷新为当前时间
     */
    @Scheduled(cron = "30 24 8 * * ?")
    public void refreshCommitDate() {
        try {
            taskUtilService.refreshCommitDate();
        } catch (Exception e) {
            logger.error("刷新监控数据更新时间错误", e);
        }
    }
 
    /**
     * 每天凌晨8:10执行
     * 删除历史趋势图数据,默认15天
     */
    @Scheduled(cron = "0 10 8 * * ?")
    public void clearHisdataTask() {
        if (!StaticKeys.NODE_MASTER.equals(commonConfig.getNodeType())) {
            logger.info("slave节点不执行清空历史趋势图数据任务");
            return;
        }
        logger.info("清空" + commonConfig.getHistoryDataOut() + "天前的监控历史趋势图数据");
        logger.info("定时清空历史趋势图数据任务开始----------" + DateUtil.getCurrentDateTime());
 
        //配置的历史数据保留时间,天
        String thrityDayBefore = DateUtil.getDateBefore(commonConfig.getHistoryDataOut());
        Map<String, Object> paramsDel = new HashMap<String, Object>();
        try {
            paramsDel.put(StaticKeys.SEARCH_END_TIME, thrityDayBefore);
            //执行删除操作begin
            if (paramsDel.get(StaticKeys.SEARCH_END_TIME) != null && !"".equals(paramsDel.get(StaticKeys.SEARCH_END_TIME))) {
                //删除历史cpu监控趋势图信息
                cpuStateService.deleteByAccountAndDate(paramsDel);
                //删除历史内存监控趋势图信息
                memStateService.deleteByAccountAndDate(paramsDel);
                //删除历史吞吐率监控趋势图信息
                netIoStateService.deleteByAccountAndDate(paramsDel);
                //删除历史负载状态监控趋势图信息
                sysLoadStateService.deleteByAccountAndDate(paramsDel);
                //删除历史进程趋势图数据
                appStateService.deleteByDate(paramsDel);
                //删除历史docker状态趋势图数据
                dockerStateService.deleteByDate(paramsDel);
                //删除历史磁盘监控信息
                diskStateService.deleteByAccountAndDate(paramsDel);
                //删除历史磁盘Io信息
                deskIoService.deleteByAccountAndDate(paramsDel);
                //删除历史磁盘smart信息
                diskSmartService.deleteByAccountAndDate(paramsDel);
                //删除历史cpu温度监控信息
                cpuTemperaturesService.deleteByAccountAndDate(paramsDel);
                //删除历史接口检测趋势图数据
                heathStateService.deleteByDate(paramsDel);
                //删除历史数通检测趋势图数据
                dceStateService.deleteByDate(paramsDel);
                //删除系统日志数据
                logInfoService.deleteByDate(paramsDel);
                //删除数据表历史统计趋势图信息数据
                dbTableCountService.deleteByDate(paramsDel);
                //删除日志监控数据记录
                fileWarnStateService.deleteByDate(paramsDel);
                //删除执行下发状态记录
                shellStateService.deleteByDate(paramsDel);
                //删除磁盘总使用率趋势图信息
                hostDiskPerService.deleteByAccountAndDate(paramsDel);
                //删除历史SNMP设备检测趋势图数据
                snmpStateService.deleteByDate(paramsDel);
                //删除自定义监控项趋势图数据
                customStateService.deleteByDate(paramsDel);
 
                //所有主机增加一条磁盘总使用率 begin
                addHostDiskPer();
                //所有主机增加一条磁盘总使用率 end
 
                //清空发告警邮件的记录
                logger.info("清空告警标记");
                WarnPools.clearOldData();
 
                //清空登录错误缓存记录
                logger.info("清空登录账号登录错误缓存记录");
                StaticKeys.LOGIN_BLOCK_MAP.clear();
                StaticKeys.LOGIN_ERROR_MAP.clear();
 
                //清空web ssh终端缓存
                logger.info("清空web ssh终端缓存");
                NettytHandler.clearOldData();
 
                //清空缓存主机备注信息
                HostUtil.clearCacheMap();
 
                //清空server-backup节点处理监控的各种数据ID集合
                ServerBackupUtil.clearCacheIdList();
 
                logInfoService.save("定时清空历史趋势图数据完成", "每天8:10清空" + commonConfig.getHistoryDataOut() +
                        "天前的监控历史趋势图数据,任务完成", StaticKeys.LOG_XTCZ);
 
            }
            //执行删除操作end
 
        } catch (Exception e) {
            logger.error("定时清空历史趋势图数据任务出错", e);
            logInfoService.save("定时清空历史趋势图数据错误", e.toString(), StaticKeys.LOG_XTCZ);
        }
        logger.info("定时清空历史趋势图数据任务结束----------" + DateUtil.getCurrentDateTime());
    }
 
 
}