feat: 重构调度任务删除记录/导出cdr
This commit is contained in:
@@ -310,14 +310,14 @@ INSERT INTO `sys_i18n` VALUES (287, '0', 'system', 1699348237468, 'system', 1699
|
|||||||
INSERT INTO `sys_i18n` VALUES (288, '0', 'system', 1699348237468, 'system', 1699348237468, 'config.errType', '操作含有内置参数,禁止删除!', 'The operation contains built-in parameters and deletion is prohibited!');
|
INSERT INTO `sys_i18n` VALUES (288, '0', 'system', 1699348237468, 'system', 1699348237468, 'config.errType', '操作含有内置参数,禁止删除!', 'The operation contains built-in parameters and deletion is prohibited!');
|
||||||
INSERT INTO `sys_i18n` VALUES (289, '0', 'system', 1699348237468, 'system', 1699348237468, 'job.monitor_sys_resource', '监控-系统资源', 'Monitor-System Resources');
|
INSERT INTO `sys_i18n` VALUES (289, '0', 'system', 1699348237468, 'system', 1699348237468, 'job.monitor_sys_resource', '监控-系统资源', 'Monitor-System Resources');
|
||||||
INSERT INTO `sys_i18n` VALUES (290, '0', 'system', 1699348237468, 'system', 1699348237468, 'job.monitor_sys_resource_remark', '系统资源CPU/IO/Netword收集\ninterval单位分钟,平均分钟资源情况\n注:请根据cron表达式的时间单位分钟,传入参数interva值', 'System Resource CPU/IO/Netword Collection\ninterval unit minutes, average minute resource situation\nNote: Please pass the value of the parameter interva according to the time unit minutes of the cron expression');
|
INSERT INTO `sys_i18n` VALUES (290, '0', 'system', 1699348237468, 'system', 1699348237468, 'job.monitor_sys_resource_remark', '系统资源CPU/IO/Netword收集\ninterval单位分钟,平均分钟资源情况\n注:请根据cron表达式的时间单位分钟,传入参数interva值', 'System Resource CPU/IO/Netword Collection\ninterval unit minutes, average minute resource situation\nNote: Please pass the value of the parameter interva according to the time unit minutes of the cron expression');
|
||||||
INSERT INTO `sys_i18n` VALUES (291, '0', 'system', 1699348237468, 'system', 1699348237468, 'job.delExpiredNeBackup', '删除过期网元备份文件', 'Delete expired NE etc backup file');
|
INSERT INTO `sys_i18n` VALUES (291, '0', 'system', 1699348237468, 'system', 1699348237468, 'job.delete_ne_config_backup', '删除-过期配置文件备份', 'Delete expired NE etc backup file');
|
||||||
INSERT INTO `sys_i18n` VALUES (292, '0', 'system', 1699348237468, 'system', 1699348237468, 'job.delExpiredNeBackupRemark', '删除过期网元etc备份文件, 传入参数表示保留{duration}天的备份文件, 默认60天', 'Delete expired network element etc backup file, pass in the parameter to keep the backup file for {duration} days, default is 60 days.');
|
INSERT INTO `sys_i18n` VALUES (292, '0', 'system', 1699348237468, 'system', 1699348237468, 'job.delete_ne_config_backup_remark', 'storeDays:表示保留最近天数的数据记录', 'storeDays: indicates that the most recent days of data records are kept.');
|
||||||
INSERT INTO `sys_i18n` VALUES (293, '0', 'system', 1699348237468, 'system', 1699348237468, 'job.deleteExpiredAlarmRecord', '删除过期历史告警记录', 'Delete expired historical alarm');
|
INSERT INTO `sys_i18n` VALUES (293, '0', 'system', 1699348237468, 'system', 1699348237468, 'job.delete_alarm_record', '删除-过期告警记录', 'Delete-Expired Alarm Records');
|
||||||
INSERT INTO `sys_i18n` VALUES (294, '0', 'system', 1699348237468, 'system', 1699348237468, 'job.deleteExpiredAlarmRecordRemark', '删除过期历史告警记录,传入参数表示保留{duration}天的历史告警记录', 'Delete expired history alarm records, pass in the parameter to keep the history alarm records for {duration} days.');
|
INSERT INTO `sys_i18n` VALUES (294, '0', 'system', 1699348237468, 'system', 1699348237468, 'job.delete_alarm_record_remark', 'storeDays:表示保留最近天数的数据记录', 'storeDays: indicates that the most recent days of data records are kept.');
|
||||||
INSERT INTO `sys_i18n` VALUES (295, '0', 'system', 1699348237468, 'system', 1699348237468, 'job.deleteExpiredKpiRecord', '删除过期黄金指标记录', 'Delete expired KPI records');
|
INSERT INTO `sys_i18n` VALUES (295, '0', 'system', 1699348237468, 'system', 1699348237468, 'job.delete_kpi_record', '删除-过期指标记录', 'Delete expired KPI records');
|
||||||
INSERT INTO `sys_i18n` VALUES (296, '0', 'system', 1699348237468, 'system', 1699348237468, 'job.deleteExpiredKpiRecordRemark', '黄金指标记录保留{duration}天', 'KPI record retention for {duration} days');
|
INSERT INTO `sys_i18n` VALUES (296, '0', 'system', 1699348237468, 'system', 1699348237468, 'job.delete_kpi_record_remark', 'storeDays:表示保留最近天数的数据记录\r\nneList:表示匹配的网元类型', 'storeDays: Indicates the most recent days of data records retained\r\nneList: Indicates the type of network elements matched');
|
||||||
INSERT INTO `sys_i18n` VALUES (297, '0', 'system', 1699348237468, 'system', 1699348237468, 'job.backupEtcFromNE', '网元配置自动备份任务', 'Network Element Configuration Auto Backup Task');
|
INSERT INTO `sys_i18n` VALUES (297, '0', 'system', 1699348237468, 'system', 1699348237468, 'table.cdr_event_sgwc', '漫游数据话单', 'Roaming Data CDR');
|
||||||
INSERT INTO `sys_i18n` VALUES (298, '0', 'system', 1699348237468, 'system', 1699348237468, 'job.backupEtcFromNERemark', '自动备份网元etc目录下的配置文件', 'Automatically backs up the configuration files in the NE etc directory.');
|
-- INSERT INTO `sys_i18n` VALUES (298, '0', 'system', 1699348237468, 'system', 1699348237468, 'job.backupEtcFromNERemark', '自动备份网元etc目录下的配置文件', 'Automatically backs up the configuration files in the NE etc directory.');
|
||||||
INSERT INTO `sys_i18n` VALUES (299, '0', 'system', 1699348237468, 'system', 1699348237468, 'job.export.jobID', '任务编号', 'ID');
|
INSERT INTO `sys_i18n` VALUES (299, '0', 'system', 1699348237468, 'system', 1699348237468, 'job.export.jobID', '任务编号', 'ID');
|
||||||
INSERT INTO `sys_i18n` VALUES (300, '0', 'system', 1699348237468, 'system', 1699348237468, 'job.export.jobName', '任务名称', 'Name');
|
INSERT INTO `sys_i18n` VALUES (300, '0', 'system', 1699348237468, 'system', 1699348237468, 'job.export.jobName', '任务名称', 'Name');
|
||||||
INSERT INTO `sys_i18n` VALUES (301, '0', 'system', 1699348237468, 'system', 1699348237468, 'job.export.jobGroupName', '任务组名', 'Group');
|
INSERT INTO `sys_i18n` VALUES (301, '0', 'system', 1699348237468, 'system', 1699348237468, 'job.export.jobGroupName', '任务组名', 'Group');
|
||||||
@@ -514,12 +514,12 @@ INSERT INTO `sys_i18n` VALUES (491, '0', 'system', 1699348237468, 'system', 1699
|
|||||||
INSERT INTO `sys_i18n` VALUES (492, '0', 'system', 1699348237468, 'system', 1699348237468, 'dictType.index_status.normal', '正常', 'Normal');
|
INSERT INTO `sys_i18n` VALUES (492, '0', 'system', 1699348237468, 'system', 1699348237468, 'dictType.index_status.normal', '正常', 'Normal');
|
||||||
INSERT INTO `sys_i18n` VALUES (493, '0', 'system', 1699348237468, 'system', 1699348237468, 'dictType.index_status.abnormal', '异常', 'Abnormal');
|
INSERT INTO `sys_i18n` VALUES (493, '0', 'system', 1699348237468, 'system', 1699348237468, 'dictType.index_status.abnormal', '异常', 'Abnormal');
|
||||||
INSERT INTO `sys_i18n` VALUES (494, '0', 'system', 1699348237468, 'system', 1699348237468, 'menu.log.neFile', '网元日志文件', 'NE Log File');
|
INSERT INTO `sys_i18n` VALUES (494, '0', 'system', 1699348237468, 'system', 1699348237468, 'menu.log.neFile', '网元日志文件', 'NE Log File');
|
||||||
INSERT INTO `sys_i18n` VALUES (495, '0', 'system', 1699348237468, 'system', 1699348237468, 'job.deleteExpiredNeStateRecord', '删除过期网元状态记录', 'Delete Expired NE State Record');
|
-- INSERT INTO `sys_i18n` VALUES (495, '0', 'system', 1699348237468, 'system', 1699348237468, 'job.deleteExpiredNeStateRecord', '删除过期网元状态记录', 'Delete Expired NE State Record');
|
||||||
INSERT INTO `sys_i18n` VALUES (496, '0', 'system', 1699348237468, 'system', 1699348237468, 'job.deleteExpiredNeStateRecordRemark', '定期删除过期的网元状态记录, 默认保留{duration}天', 'Delete expired NE state records regularly and keep them for {duration} days by default.');
|
-- INSERT INTO `sys_i18n` VALUES (496, '0', 'system', 1699348237468, 'system', 1699348237468, 'job.deleteExpiredNeStateRecordRemark', '定期删除过期的网元状态记录, 默认保留{duration}天', 'Delete expired NE state records regularly and keep them for {duration} days by default.');
|
||||||
INSERT INTO `sys_i18n` VALUES (497, '0', 'system', 1699348237468, 'system', 1699348237468, 'job.getStateFromNE', '获取网元状态信息', 'Get state from NEs');
|
-- INSERT INTO `sys_i18n` VALUES (497, '0', 'system', 1699348237468, 'system', 1699348237468, 'job.getStateFromNE', '获取网元状态信息', 'Get state from NEs');
|
||||||
INSERT INTO `sys_i18n` VALUES (498, '0', 'system', 1699348237468, 'system', 1699348237468, 'job.getStateFromNERemark', '获取所有网元状态信息', 'Get state information from all NEs');
|
-- INSERT INTO `sys_i18n` VALUES (498, '0', 'system', 1699348237468, 'system', 1699348237468, 'job.getStateFromNERemark', '获取所有网元状态信息', 'Get state information from all NEs');
|
||||||
INSERT INTO `sys_i18n` VALUES (499, '0', 'system', 1699348237468, 'system', 1699348237468, 'job.ne_alarm_state_check', '网元告警-状态检查', 'Network Element Health Check');
|
INSERT INTO `sys_i18n` VALUES (499, '0', 'system', 1699348237468, 'system', 1699348237468, 'job.ne_alarm_state_check', '网元告警-状态检查', 'NE Health Check');
|
||||||
INSERT INTO `sys_i18n` VALUES (500, '0', 'system', 1699348237468, 'system', 1699348237468, 'job.ne_alarm_state_check_remark', '网元告警-状态检查,异常时产生告警', 'Health status inspection of network elements, generating alarms in case of abnormalities.');
|
INSERT INTO `sys_i18n` VALUES (500, '0', 'system', 1699348237468, 'system', 1699348237468, 'job.ne_alarm_state_check_remark', '检查网元的健康状况,在出现异常时发出警报。\r\n\r\nAlarm type:\r\nCommunicationAlarm=1\r\nEquipmentAlarm=2\r\nProcessingFailure=3\r\nEnvironmentalAlarm=4\r\nQualityOfServiceAlarm=5\r\n\r\nSeverity:\r\nCritical=1\r\nMajor=2\r\nMinor=3\r\nWarning=4', 'Checks the health of network elements and sends alerts in case of anomalies.\n\nAlarm type:\nCommunicationAlarm=1\nEquipmentAlarm=2\nProcessingFailure=3\nEnvironmentalAlarm=4\nQualityOfServiceAlarm=5\n\nSeverity:\nCritical=1\nMajor=2\nMinor=3\nWarning=4');
|
||||||
INSERT INTO `sys_i18n` VALUES (501, '0', 'system', 1699348237468, 'system', 1699348237468, 'menu.neUser.nssf', 'NSSF在线订阅数', 'NSSF Subscription Info');
|
INSERT INTO `sys_i18n` VALUES (501, '0', 'system', 1699348237468, 'system', 1699348237468, 'menu.neUser.nssf', 'NSSF在线订阅数', 'NSSF Subscription Info');
|
||||||
INSERT INTO `sys_i18n` VALUES (502, '0', 'system', 1699348237468, 'system', 1699348237468, 'menu.neUser.nssfAmf', 'NSSF可用的注册AMF', 'NSSF Available AMFs');
|
INSERT INTO `sys_i18n` VALUES (502, '0', 'system', 1699348237468, 'system', 1699348237468, 'menu.neUser.nssfAmf', 'NSSF可用的注册AMF', 'NSSF Available AMFs');
|
||||||
INSERT INTO `sys_i18n` VALUES (503, '0', 'system', 1699348237468, 'system', 1699348237468, 'menu.monitor.topology', '拓扑信息', 'Topology Info');
|
INSERT INTO `sys_i18n` VALUES (503, '0', 'system', 1699348237468, 'system', 1699348237468, 'menu.monitor.topology', '拓扑信息', 'Topology Info');
|
||||||
@@ -663,7 +663,7 @@ INSERT INTO `sys_i18n` VALUES (640, '0', 'system', 1699348237468, 'system', 1699
|
|||||||
INSERT INTO `sys_i18n` VALUES (641, '0', 'system', 1699348237468, 'system', 1699348237468, 'table.cdr_event_ims', '语音话单', 'Voice CDR');
|
INSERT INTO `sys_i18n` VALUES (641, '0', 'system', 1699348237468, 'system', 1699348237468, 'table.cdr_event_ims', '语音话单', 'Voice CDR');
|
||||||
INSERT INTO `sys_i18n` VALUES (642, '0', 'system', 1699348237468, 'system', 1699348237468, 'table.cdr_event_smf', '数据话单', 'Data CDR');
|
INSERT INTO `sys_i18n` VALUES (642, '0', 'system', 1699348237468, 'system', 1699348237468, 'table.cdr_event_smf', '数据话单', 'Data CDR');
|
||||||
INSERT INTO `sys_i18n` VALUES (643, '0', 'system', 1699348237468, 'system', 1699348237468, 'table.cdr_event_smsc', '短信话单', 'SMS CDR');
|
INSERT INTO `sys_i18n` VALUES (643, '0', 'system', 1699348237468, 'system', 1699348237468, 'table.cdr_event_smsc', '短信话单', 'SMS CDR');
|
||||||
INSERT INTO `sys_i18n` VALUES (644, '0', 'system', 1699348237468, 'system', 1699348237468, 'menu.log.exportFile', '导出文件管理', 'Exported File Management');
|
INSERT INTO `sys_i18n` VALUES (644, '0', 'system', 1699348237468, 'system', 1699348237468, 'menu.log.exportFile', '导出文件', 'Exported File');
|
||||||
INSERT INTO `sys_i18n` VALUES (645, '0', 'system', 1699348237468, 'system', 1699348237468, 'menu.perf.kpiCReport', '自定义指标数据', 'Custom Indicator Data');
|
INSERT INTO `sys_i18n` VALUES (645, '0', 'system', 1699348237468, 'system', 1699348237468, 'menu.perf.kpiCReport', '自定义指标数据', 'Custom Indicator Data');
|
||||||
INSERT INTO `sys_i18n` VALUES (646, '0', 'system', 1699348237468, 'system', 1699348237468, 'menu.trace.taskHLR', 'HLR 跟踪任务', 'HLR Trace Task');
|
INSERT INTO `sys_i18n` VALUES (646, '0', 'system', 1699348237468, 'system', 1699348237468, 'menu.trace.taskHLR', 'HLR 跟踪任务', 'HLR Trace Task');
|
||||||
INSERT INTO `sys_i18n` VALUES (647, '0', 'system', 1699348237468, 'system', 1699348237468, 'dictType.cdr_cause_code', 'CDR 响应原因代码类别类型', 'CDR Response Reason Code Category Type');
|
INSERT INTO `sys_i18n` VALUES (647, '0', 'system', 1699348237468, 'system', 1699348237468, 'dictType.cdr_cause_code', 'CDR 响应原因代码类别类型', 'CDR Response Reason Code Category Type');
|
||||||
|
|||||||
@@ -31,19 +31,17 @@ CREATE TABLE `sys_job` (
|
|||||||
INSERT INTO `sys_job` VALUES (1, 'job.monitor_sys_resource', 'SYSTEM', 'monitor_sys_resource', '{\"interval\":5}', '0 0/5 * * * ?', '3', '0', '1', '0', 'system', 1698478134839, 'system', 1698478134839, 'job.monitor_sys_resource_remark');
|
INSERT INTO `sys_job` VALUES (1, 'job.monitor_sys_resource', 'SYSTEM', 'monitor_sys_resource', '{\"interval\":5}', '0 0/5 * * * ?', '3', '0', '1', '0', 'system', 1698478134839, 'system', 1698478134839, 'job.monitor_sys_resource_remark');
|
||||||
INSERT INTO `sys_job` VALUES (2, 'job.ne_config_backup', 'SYSTEM', 'ne_config_backup', '', '0 30 0 * * ?', '3', '0', '1', '1', 'system', 1698478134839, 'system', 1698478134839, 'job.ne_config_backup_remark');
|
INSERT INTO `sys_job` VALUES (2, 'job.ne_config_backup', 'SYSTEM', 'ne_config_backup', '', '0 30 0 * * ?', '3', '0', '1', '1', 'system', 1698478134839, 'system', 1698478134839, 'job.ne_config_backup_remark');
|
||||||
INSERT INTO `sys_job` VALUES (3, 'job.ne_data_udm', 'SYSTEM', 'ne_data_udm', '', '0 0 0/12 * * ?', '3', '0', '1', '1', 'system', 1698478134839, 'system', 1698478134839, '');
|
INSERT INTO `sys_job` VALUES (3, 'job.ne_data_udm', 'SYSTEM', 'ne_data_udm', '', '0 0 0/12 * * ?', '3', '0', '1', '1', 'system', 1698478134839, 'system', 1698478134839, '');
|
||||||
INSERT INTO `sys_job` VALUES (4, 'job.ne_alarm_state_check', 'SYSTEM', 'ne_alarm_state_check', '{\"alarmTitle\":\"NE State Check Alarm\",\"alarmType\":\"2\",\"origSeverity\":\"2\",\"specificProblem\":\"alarm cause: the system state of target NE has not been received\",\"specificProblemId\":\"AC10000\",\"addInfo\":\"\"}', '0/5 * * * * ?', '3', '0', '1', '0', 'system', 1698478134839, 'system', 1698478134839, 'job.ne_alarm_state_check_remark');
|
INSERT INTO `sys_job` VALUES (4, 'job.ne_alarm_state_check', 'SYSTEM', 'ne_alarm_state_check', '{\"alarmTitle\":\"NE State Check Alarm\",\"alarmType\":\"2\",\"origSeverity\":\"2\",\"specificProblem\":\"alarm cause: the system state of target NE has not been received\",\"specificProblemId\":\"AC10000\",\"addInfo\":\"\"}', '0/10 * * * * ?', '3', '0', '1', '0', 'system', 1698478134839, 'system', 1698478134839, 'job.ne_alarm_state_check_remark');
|
||||||
INSERT INTO `sys_job` VALUES (5, 'job.deleteExpiredAlarmRecord', 'SYSTEM', 'deleteExpiredRecord', '{\"duration\":90,\"tableName\":\"alarm\",\"colName\":\"event_time\",\"extras\":\"alarm_status=\'0\'\"}', '0 10 0 * * ?', '3', '0', '1', '1', 'system', 1698478134839, 'system', 1698478134839, 'job.deleteExpiredAlarmRecordRemark');
|
INSERT INTO `sys_job` VALUES (5, 'job.delete_alarm_record', 'SYSTEM', 'delete_alarm_record', '{\"storeDays\":7}', '0 10 0 * * ?', '3', '0', '1', '1', 'system', 1698478134839, 'system', 1698478134839, 'job.delete_alarm_record_remark');
|
||||||
INSERT INTO `sys_job` VALUES (6, 'job.deleteExpiredKpiRecord', 'SYSTEM', 'deleteExpiredRecord', '{\"duration\":30,\"tableName\":\"gold_kpi\",\"colName\":\"date\"}', '0 15 0 * * ?', '3', '0', '1', '1', 'system', 1698478134839, 'system', 1698478134839, 'job.deleteExpiredKpiRecordRemark');
|
INSERT INTO `sys_job` VALUES (6, 'job.delete_kpi_record', 'SYSTEM', 'delete_kpi_record', '{\"storeDays\":7,\"neList\":[\"IMS\",\"AMF\",\"UDM\",\"UPF\",\"MME\",\"SMSC\",\"SMF\",\"MME\"]}', '0 20 0 * * ?', '3', '0', '1', '1', 'system', 1698478134839, 'system', 1698478134839, 'job.delete_kpi_record_remark');
|
||||||
INSERT INTO `sys_job` VALUES (7, 'job.backupEtcFromNE', 'SYSTEM', 'backupEtcFromNE', '{}', '0 30 0 * * ?', '3', '0', '0', '1', 'system', 1698478134839, 'system', 1698478134839, 'job.backupEtcFromNERemark');
|
INSERT INTO `sys_job` VALUES (7, 'job.delete_ne_config_backup', 'SYSTEM', 'delete_ne_config_backup', '{\"storeDays\":7}', '0 20 0 * * ?', '3', '0', '1', '1', 'system', 1698478134839, 'system', 1698478134839, 'job.delete_ne_config_backup_remark');
|
||||||
INSERT INTO `sys_job` VALUES (8, 'job.deleteExpiredNeStateRecord', 'SYSTEM', 'deleteExpiredRecord', '{\"duration\":1,\"tableName\":\"ne_state\",\"colName\":\"timestamp\"}', '0 25 0 * * ?', '3', '0', '1', '1', 'system', 1698478134839, 'system', 1698478134839, 'job.deleteExpiredNeStateRecordRemark');
|
|
||||||
INSERT INTO `sys_job` VALUES (9, 'job.getStateFromNE', 'SYSTEM', 'getStateFromNE', '', '0/10 * * * * ?', '3', '0', '0', '0', 'system', 1698478134839, 'system', 1698478134839, 'job.getStateFromNERemark');
|
INSERT INTO `sys_job` VALUES (21, 'job.exportOperateLog', 'SYSTEM', 'exportTable', '{\"hour\":1,\"columns\":[\"id\",\"title\",\"business_type\",\"opera_by\",\"opera_url_method\",\"opera_url\",\"opera_ip\",\"status\",\"opera_time\",\"cost_time\"],\"tableName\":\"sys_log_operate\",\"filePath\":\"/usr/local/omc/backup/operate_log\"}', '0 0 0/1 * * ?', '3', '0', '1', '1', 'system', 1698478134839, 'system', 1698478134839, '');
|
||||||
INSERT INTO `sys_job` VALUES (10, 'job.delExpiredNeBackup', 'SYSTEM', 'delExpiredNeBackup', '{\"duration\":60}', '0 20 0 * * ?', '3', '0', '0', '1', 'system', 1698478134839, 'system', 1698478134839, 'job.delExpiredNeBackupRemark');
|
INSERT INTO `sys_job` VALUES (22, 'job.exportIMSCDR', 'SYSTEM', 'exportTable', '{\"hour\":1,\"columns\":[\"id\",\"record_type\",\"call_type\",\"caller_party\",\"called_party\",\"call_duration\",\"cause\",\"seizure_time\",\"release_time\"],\"tableName\":\"cdr_event_ims\",\"filePath\":\"/usr/local/omc/backup/ims_cdr\"}', '0 0 0/1 * * ?', '3', '0', '1', '1', 'system', 1698478134839, 'system', 1698478134839, '');
|
||||||
INSERT INTO `sys_job` VALUES (11, 'job.exportOperateLog', 'SYSTEM', 'exportTable', '{\"duration\":1,\"tableName\":\"sys_log_operate\",\"timeCol\":\"oper_time\",\"timeUnit\":\"milli\",\"columns\":\"oper_id,title,business_type,method,request_method,operator_type,oper_name,dept_name,oper_url,oper_ip,oper_location,oper_param,oper_msg,status,oper_time,cost_time\",\"extras\":\"\",\"filePath\":\"/usr/local/omc/backup/operate_log\"}', '0 0 0/1 * * ?', '3', '0', '1', '1', 'system', 1698478134839, 'system', 1698478134839, 'job.exportOperateLog');
|
INSERT INTO `sys_job` VALUES (23, 'job.exportSMFCDR', 'SYSTEM', 'exportTable', '{\"hour\":1,\"columns\":[\"id\",\"charging_id\",\"subscription_id_data\",\"subscription_id_type\",\"data_volume_uplink\",\"data_volume_downlink\",\"data_total_volume\",\"invocation_timestamp\",\"user_identifier\",\"ssc_mode\",\"dnn_id\",\"pdu_type\",\"rat_type\",\"pdu_ipv4\",\"pdu_ipv6\",\"network_function_ipv4_address\",\"record_nfId\",\"record_type\",\"record_opening_time\"],\"tableName\":\"cdr_event_smf\",\"filePath\":\"/usr/local/omc/backup/smf_cdr\"}', '0 0 0/1 * * ?', '3', '0', '1', '1', 'system', 1698478134839, 'system', 1698478134839, '');
|
||||||
INSERT INTO `sys_job` VALUES (12, 'job.exportIMSCDR', 'SYSTEM', 'exportTable', '{\"duration\":1,\"tableName\":\"cdr_event_ims\",\"columns\":\"id,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.recordType\')) as record_type,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.callType\')) as call_type,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.callerParty\')) as caller_party,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.calledParty\')) as called_party,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.callDuration\')) as call_duration,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.serviceResult\')) as service_result,DATE_FORMAT(FROM_UNIXTIME(timestamp), \'%Y-%m-%d %H:%i:%s\') AS timestamp\",\"timeCol\":\"timestamp\",\"timeUnit\":\"second\",\"extras\":\"\",\"filePath\":\"/usr/local/omc/backup/ims_cdr\"}', '0 0 0/1 * * ?', '3', '0', '1', '1', 'system', 1698478134839, 'system', 1698478134839, '');
|
INSERT INTO `sys_job` VALUES (24, 'job.exportSMSCCDR', 'SYSTEM', 'exportTable', '{\"hour\":1,\"columns\":[\"id\",\"record_type\",\"service_type\",\"caller_party\",\"called_party\",\"result\",\"update_time\"],\"tableName\":\"cdr_event_smsc\",\"filePath\":\"/usr/local/omc/backup/smsc_cdr\"}', '0 0 0/1 * * ?', '3', '0', '1', '1', 'system', 1698478134839, 'system', 1698478134839, '');
|
||||||
INSERT INTO `sys_job` VALUES (13, 'job.exportSMFCDR', 'SYSTEM', 'exportTable', '{\"duration\":1,\"tableName\":\"cdr_event_smf\",\"columns\":\"id,ne_type,ne_name,rm_uid,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.recordType\')) AS record_type,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.chargingID\')) AS charging_id,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.subscriberIdentifier.subscriptionIDType\')) AS subscriber_id_type,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.subscriberIdentifier.subscriptionIDData\')) AS subscriber_id_data,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.duration\')) AS duration,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.invocationTimestamp\')) as invocationTimestamp,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.listOfMultipleUnitUsage[*].usedUnitContainer[*].dataVolumeUplink\')) AS data_volume_uplink,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.listOfMultipleUnitUsage[*].usedUnitContainer[*].dataVolumeDownlink\')) AS data_volume_downlink,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.listOfMultipleUnitUsage[*].usedUnitContainer[*].dataTotalVolume\')) AS data_total_volume,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.pDUSessionChargingInformation.pDUAddress.pDUIPv4Address\')) AS pdu_ipv4_address,timestamp\",\"timeCol\":\"timestamp\",\"timeUnit\":\"second\",\"extras\":\"\",\"filePath\":\"/usr/local/omc/backup/smf_cdr\"}', '0 0 0/1 * * ?', '3', '0', '1', '1', 'system', 1698478134839, 'system', 1698478134839, '');
|
INSERT INTO `sys_job` VALUES (25, 'job.exportSGWCCDR', 'SYSTEM', 'exportTable', '{\"hour\":1,\"columns\":[\"charging_id\",\"served_imsi\",\"served_msisdn\",\"data_volume_gprs_uplink\",\"data_volume_gprs_downlink\",\"duration\",\"invocation_timestamp\",\"pgw_address_used\",\"sgw_address\",\"rat_type\",\"pdp_pdn_type\",\"served_pdppdn_address\",\"serving_node_address\",\"serving_node_type\",\"access_point_name_ni\",\"cause_for_rec_closing\",\"record_sequence_number\",\"local_record_sequence_number\",\"record_type\",\"record_opening_time\"],\"tableName\":\"cdr_event_sgwc\",\"filePath\":\"/usr/local/omc/backup/sgwc_cdr\"}', '0 0 0/1 * * ?', '3', '0', '1', '1', 'system', 1698478134839, 'system', 1698478134839, '');
|
||||||
INSERT INTO `sys_job` VALUES (14, 'job.exportSMSCCDR', 'SYSTEM', 'exportTable', '{\"duration\":1,\"tableName\":\"cdr_event_smsc\",\"columns\":\"id,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.recordType\')) as record_type,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.serviceType\')) as service_type,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.callerParty\')) as caller_party,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.calledParty\')) as called_party,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.result\')) as result,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.updateTime\')) as update_time\",\"timeCol\":\"timestamp\",\"timeUnit\":\"second\",\"extras\":\"\",\"filePath\":\"/usr/local/omc/backup/smsc_cdr\"}', '0 0 0/1 * * ?', '3', '0', '1', '1', 'system', 1698478134839, 'system', 1698478134839, '');
|
INSERT INTO `sys_job` VALUES (26, 'job.removeExportedFiles', 'SYSTEM', 'removeFile', '[{\"filePath\":\"/usr/local/omc/backup/operate_log\",\"maxDays\":30},{\"filePath\":\"/usr/local/omc/backup/ims_cdr\",\"maxDays\":30},{\"filePath\":\"/usr/local/omc/backup/smf_cdr\",\"maxDays\":30},{\"filePath\":\"/usr/local/omc/backup/smsc_cdr\",\"maxDays\":30},{\"filePath\":\"/usr/local/omc/backup/sgwc_cdr\",\"maxDays\":30}]', '0 10 0 * * ?', '3', '0', '1', '1', 'system', 1698478134839, 'system', 1698478134839, '');
|
||||||
INSERT INTO `sys_job` VALUES (15, 'job.removeExportedFiles', 'SYSTEM', 'removeFile', '[{\"filePath\":\"/usr/local/omc/backup/operate_log\",\"maxDays\":30},{\"filePath\":\"/usr/local/omc/backup/ims_cdr\",\"maxDays\":30},{\"filePath\":\"/usr/local/omc/backup/smf_cdr\",\"maxDays\":30},{\"filePath\":\"/usr/local/omc/backup/smsc_cdr\",\"maxDays\":30}]', '0 10 0 * * ?', '3', '0', '1', '1', 'system', 1698478134839, 'system', 1698478134839, '');
|
|
||||||
INSERT INTO `sys_job` VALUES (16, 'job.exportSGWCCDR', 'SYSTEM', 'exportTable', '{\"duration\":1,\"tableName\":\"cdr_event_sgwc\",\"columns\":\"id,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.recordType\')) as recordType,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.accessPointNameNI\')) as accessPointNameNI,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.servedIMSI\')) as IMSI,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.servedMSISDN\')) as MSISDN,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.servedPDPPDNAddress\')) as PdpAddress,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.duration\')) as duration,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.recordOpeningTime\')) as recordOpeningTime,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.chargingID\')) as chargingID,JSON_UNQUOTE(JSON_EXTRACT(cdr_json, \'$.listOfTrafficVolumes[0].dataVolumeGPRSDownlink\')) AS dataVolumeGPRSDownlink,JSON_UNQUOTE(JSON_EXTRACT(cdr_json, \'$.listOfTrafficVolumes[0].dataVolumeGPRsUplink\')) as dataVolumeGPRsUplink,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.userLocationInformation.tai.tac\')) as tac,JSON_UNQUOTE(JSON_EXTRACT(cdr_json,\'$.userLocationInformation.ecgi.eutraCellId\')) as cellID\",\"timeCol\":\"timestamp\",\"timeUnit\":\"second\",\"extras\":\"\",\"filePath\":\"/usr/local/omc/backup/sgwc_cdr\"}', '0 0 0/1 * * ?', '3', '0', '1', '1', 'system', 1698478134839, 'system', 1698478134839, '');
|
|
||||||
|
|
||||||
SET FOREIGN_KEY_CHECKS = 1;
|
SET FOREIGN_KEY_CHECKS = 1;
|
||||||
|
|
||||||
|
|||||||
@@ -1,174 +0,0 @@
|
|||||||
package backupEtcFromNE
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
"strings"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"be.ems/lib/config"
|
|
||||||
"be.ems/lib/dborm"
|
|
||||||
"be.ems/lib/global"
|
|
||||||
"be.ems/lib/log"
|
|
||||||
"be.ems/src/framework/cron"
|
|
||||||
)
|
|
||||||
|
|
||||||
var NewProcessor = &BarProcessor{
|
|
||||||
progress: 0,
|
|
||||||
count: 0,
|
|
||||||
}
|
|
||||||
|
|
||||||
// bar 队列任务处理
|
|
||||||
type BarProcessor struct {
|
|
||||||
// 任务进度
|
|
||||||
progress int
|
|
||||||
// 执行次数
|
|
||||||
count int
|
|
||||||
}
|
|
||||||
|
|
||||||
type BarParams struct {
|
|
||||||
Duration int `json:"duration"`
|
|
||||||
TableName string `json:"tableName"`
|
|
||||||
ColName string `json:"colName"` // column name of time string
|
|
||||||
Extras string `json:"extras"` // extras condition for where
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *BarProcessor) Execute(data any) (any, error) {
|
|
||||||
log.Infof("execute %d,last progress: %d ", s.count, s.progress)
|
|
||||||
s.count++
|
|
||||||
|
|
||||||
options := data.(cron.JobData)
|
|
||||||
sysJob := options.SysJob
|
|
||||||
// var params BarParams
|
|
||||||
|
|
||||||
// err := json.Unmarshal([]byte(sysJob.TargetParams), ¶ms)
|
|
||||||
// if err != nil {
|
|
||||||
// return nil, err
|
|
||||||
// }
|
|
||||||
|
|
||||||
log.Infof("Repeat %v Job ID %d", options.Repeat, sysJob.JobId)
|
|
||||||
|
|
||||||
var nes []dborm.NeInfo
|
|
||||||
_, err := dborm.XormGetAllNeInfo(&nes)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
var successfulNEs, failureNEs []string
|
|
||||||
for _, neInfo := range nes {
|
|
||||||
neTypeUpper := strings.ToUpper(neInfo.NeType)
|
|
||||||
neTypeLower := strings.ToLower(neInfo.NeType)
|
|
||||||
nePath := fmt.Sprintf("%s/etc/%s", config.GetYamlConfig().OMC.Backup, neTypeLower)
|
|
||||||
isExist, err := global.PathExists(nePath)
|
|
||||||
if err != nil {
|
|
||||||
log.Errorf("Failed to PathExists:", err)
|
|
||||||
failureNEs = append(failureNEs, neInfo.NeType+"/"+neInfo.NeId)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if isExist {
|
|
||||||
err = os.RemoveAll(nePath)
|
|
||||||
if err != nil {
|
|
||||||
log.Errorf("Failed to RemoveAll:", err)
|
|
||||||
failureNEs = append(failureNEs, neInfo.NeType+"/"+neInfo.NeId)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
err = os.MkdirAll(nePath, os.ModePerm)
|
|
||||||
if err != nil {
|
|
||||||
log.Errorf("Failed to MkdirAll:", err)
|
|
||||||
failureNEs = append(failureNEs, neInfo.NeType+"/"+neInfo.NeId)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
var scpCmd string
|
|
||||||
ipType := global.ParseIPAddr(neInfo.Ip)
|
|
||||||
omcNetypeLower := strings.ToLower(config.GetYamlConfig().OMC.NeType)
|
|
||||||
etcListIMS := "{*.yaml,mmtel,vars.cfg}"
|
|
||||||
if config.GetYamlConfig().NE.EtcListIMS != "" {
|
|
||||||
etcListIMS = config.GetYamlConfig().NE.EtcListIMS
|
|
||||||
}
|
|
||||||
switch neTypeLower {
|
|
||||||
case omcNetypeLower:
|
|
||||||
if ipType == global.IsIPv4 {
|
|
||||||
scpCmd = fmt.Sprintf("scp -r %s@%s:%s/etc/*.yaml %s/etc/%s", config.GetYamlConfig().NE.User,
|
|
||||||
neInfo.Ip, config.GetYamlConfig().NE.OmcDir, config.GetYamlConfig().OMC.Backup, neTypeLower)
|
|
||||||
} else {
|
|
||||||
scpCmd = fmt.Sprintf("scp -r %s@[%s]:%s/etc/*.yaml %s/etc/%s", config.GetYamlConfig().NE.User,
|
|
||||||
neInfo.Ip, config.GetYamlConfig().NE.OmcDir, config.GetYamlConfig().OMC.Backup, neTypeLower)
|
|
||||||
}
|
|
||||||
|
|
||||||
case "ims":
|
|
||||||
if ipType == global.IsIPv4 {
|
|
||||||
scpCmd = fmt.Sprintf("scp -r %s@%s:%s/%s/%s %s/etc/%s", config.GetYamlConfig().NE.User,
|
|
||||||
neInfo.Ip, config.GetYamlConfig().NE.EtcDir, neTypeLower,
|
|
||||||
etcListIMS, config.GetYamlConfig().OMC.Backup, neTypeLower)
|
|
||||||
} else {
|
|
||||||
scpCmd = fmt.Sprintf("scp -r %s@[%s]:%s/%s/%s %s/etc/%s", config.GetYamlConfig().NE.User,
|
|
||||||
neInfo.Ip, config.GetYamlConfig().NE.EtcDir, neTypeLower,
|
|
||||||
etcListIMS, config.GetYamlConfig().OMC.Backup, neTypeLower)
|
|
||||||
}
|
|
||||||
|
|
||||||
case "mme":
|
|
||||||
if ipType == global.IsIPv4 {
|
|
||||||
scpCmd = fmt.Sprintf("scp -r %s@%s:%s/%s/*.conf %s/etc/%s", config.GetYamlConfig().NE.User,
|
|
||||||
neInfo.Ip, config.GetYamlConfig().NE.EtcDir,
|
|
||||||
neTypeLower, config.GetYamlConfig().OMC.Backup, neTypeLower)
|
|
||||||
} else {
|
|
||||||
scpCmd = fmt.Sprintf("scp -r %s@[%s]:%s/%s/*.conf %s/etc/%s", config.GetYamlConfig().NE.User,
|
|
||||||
neInfo.Ip, config.GetYamlConfig().NE.EtcDir,
|
|
||||||
neTypeLower, config.GetYamlConfig().OMC.Backup, neTypeLower)
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
|
||||||
if ipType == global.IsIPv4 {
|
|
||||||
scpCmd = fmt.Sprintf("scp -r %s@%s:%s/%s/*.yaml %s/etc/%s", config.GetYamlConfig().NE.User,
|
|
||||||
neInfo.Ip, config.GetYamlConfig().NE.EtcDir,
|
|
||||||
neTypeLower, config.GetYamlConfig().OMC.Backup, neTypeLower)
|
|
||||||
} else {
|
|
||||||
scpCmd = fmt.Sprintf("scp -r %s@[%s]:%s/%s/*.yaml %s/etc/%s", config.GetYamlConfig().NE.User,
|
|
||||||
neInfo.Ip, config.GetYamlConfig().NE.EtcDir,
|
|
||||||
neTypeLower, config.GetYamlConfig().OMC.Backup, neTypeLower)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
zipFile := fmt.Sprintf("%s-%s-etc-%s.zip", neTypeLower, strings.ToLower(neInfo.NeId), time.Now().Format(global.DateData))
|
|
||||||
zipFilePath := config.GetYamlConfig().OMC.Backup + "/" + zipFile
|
|
||||||
zipCmd := fmt.Sprintf("cd %s/etc && zip -r %s %s/*", config.GetYamlConfig().OMC.Backup, zipFilePath, neTypeLower)
|
|
||||||
|
|
||||||
command := fmt.Sprintf("%s&&%s", scpCmd, zipCmd)
|
|
||||||
|
|
||||||
log.Trace("command:", command)
|
|
||||||
out, err := global.ExecCmd(command)
|
|
||||||
if err != nil {
|
|
||||||
log.Error("Faile to exec command:", err)
|
|
||||||
failureNEs = append(failureNEs, neInfo.NeType+"/"+neInfo.NeId)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
log.Trace("command output:", out)
|
|
||||||
|
|
||||||
md5Sum, err := global.GetFileMD5Sum(zipFilePath)
|
|
||||||
if err != nil {
|
|
||||||
log.Error("Faile to md5sum:", err)
|
|
||||||
failureNEs = append(failureNEs, neInfo.NeType+"/"+neInfo.NeId)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
//log.Debug("md5Str:", md5Sum)
|
|
||||||
path := config.GetYamlConfig().OMC.Backup
|
|
||||||
neBackup := dborm.NeBackup{NeType: neTypeUpper, NeId: neInfo.NeId, FileName: zipFile, Path: path, Md5Sum: md5Sum}
|
|
||||||
_, err = dborm.XormInsertTableOne("ne_backup", neBackup)
|
|
||||||
if err != nil {
|
|
||||||
log.Error("Faile to XormInsertTableOne:", err)
|
|
||||||
failureNEs = append(failureNEs, neInfo.NeType+"/"+neInfo.NeId)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
successfulNEs = append(successfulNEs, neInfo.NeType+"/"+neInfo.NeId)
|
|
||||||
}
|
|
||||||
|
|
||||||
log.Infof("successfulNEs: %s failureNEs: %s", successfulNEs, failureNEs)
|
|
||||||
// result
|
|
||||||
return map[string]any{
|
|
||||||
"successfulNEs": successfulNEs,
|
|
||||||
"failureNEs": failureNEs,
|
|
||||||
}, nil
|
|
||||||
}
|
|
||||||
@@ -1,80 +0,0 @@
|
|||||||
package delExpiredNeBackup
|
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"be.ems/lib/dborm"
|
|
||||||
"be.ems/lib/log"
|
|
||||||
"be.ems/src/framework/cron"
|
|
||||||
)
|
|
||||||
|
|
||||||
var NewProcessor = &BarProcessor{
|
|
||||||
progress: 0,
|
|
||||||
count: 0,
|
|
||||||
}
|
|
||||||
|
|
||||||
// bar 队列任务处理
|
|
||||||
type BarProcessor struct {
|
|
||||||
// 任务进度
|
|
||||||
progress int
|
|
||||||
// 执行次数
|
|
||||||
count int
|
|
||||||
}
|
|
||||||
|
|
||||||
type BarParams struct {
|
|
||||||
Duration int `json:"duration"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *BarProcessor) Execute(data any) (any, error) {
|
|
||||||
log.Infof("执行 %d 次,上次进度: %d ", s.count, s.progress)
|
|
||||||
s.count++
|
|
||||||
|
|
||||||
options := data.(cron.JobData)
|
|
||||||
sysJob := options.SysJob
|
|
||||||
var params BarParams
|
|
||||||
duration := 60
|
|
||||||
|
|
||||||
err := json.Unmarshal([]byte(sysJob.TargetParams), ¶ms)
|
|
||||||
if err == nil {
|
|
||||||
duration = params.Duration
|
|
||||||
}
|
|
||||||
log.Infof("重复 %v 任务ID %d", options.Repeat, sysJob.JobId)
|
|
||||||
|
|
||||||
// // 实现任务处理逻辑
|
|
||||||
// i := 0
|
|
||||||
// s.progress = i
|
|
||||||
// for i < 5 {
|
|
||||||
// // 获取任务进度
|
|
||||||
// progress := s.progress
|
|
||||||
// log.Infof("jonId: %s => 任务进度:%d", sysJob.JobID, progress)
|
|
||||||
// // 延迟响应
|
|
||||||
// time.Sleep(time.Second * 2)
|
|
||||||
// // 程序中途执行错误
|
|
||||||
// if i == 3 {
|
|
||||||
// // arr := [1]int{1}
|
|
||||||
// // arr[i] = 3
|
|
||||||
// // fmt.Println(arr)
|
|
||||||
// // return "i = 3"
|
|
||||||
// panic("程序中途执行错误")
|
|
||||||
// }
|
|
||||||
// i++
|
|
||||||
// // 改变任务进度
|
|
||||||
// s.progress = i
|
|
||||||
// }
|
|
||||||
where := fmt.Sprintf("NOW()>ADDDATE(`create_time`,interval %d day)", duration)
|
|
||||||
affected, err := dborm.XormDeleteDataByWhere(where, "ne_backup")
|
|
||||||
if err != nil {
|
|
||||||
// panic(fmt.Sprintf("Failed to XormDeleteDataByWhere:%v", err))
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// delete expired files in backup directory
|
|
||||||
// todo ...
|
|
||||||
|
|
||||||
// 返回结果,用于记录执行结果
|
|
||||||
return map[string]any{
|
|
||||||
"msg": "sucess",
|
|
||||||
"affected": affected,
|
|
||||||
}, nil
|
|
||||||
}
|
|
||||||
@@ -1,98 +0,0 @@
|
|||||||
package deleteExpiredRecord
|
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"be.ems/lib/dborm"
|
|
||||||
"be.ems/lib/log"
|
|
||||||
"be.ems/src/framework/cron"
|
|
||||||
)
|
|
||||||
|
|
||||||
var NewProcessor = &BarProcessor{
|
|
||||||
progress: 0,
|
|
||||||
count: 0,
|
|
||||||
}
|
|
||||||
|
|
||||||
// bar 队列任务处理
|
|
||||||
type BarProcessor struct {
|
|
||||||
// 任务进度
|
|
||||||
progress int
|
|
||||||
// 执行次数
|
|
||||||
count int
|
|
||||||
}
|
|
||||||
|
|
||||||
type BarParams struct {
|
|
||||||
Duration int `json:"duration"`
|
|
||||||
TableName string `json:"tableName"`
|
|
||||||
ColName string `json:"colName"` // column name of time string
|
|
||||||
Extras string `json:"extras"` // extras condition for where
|
|
||||||
SessFlag bool `json:"sessFlag"` // session flag, true: session model, false: no session
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *BarProcessor) Execute(data any) (any, error) {
|
|
||||||
log.Infof("执行 %d 次,上次进度: %d ", s.count, s.progress)
|
|
||||||
s.count++
|
|
||||||
|
|
||||||
options := data.(cron.JobData)
|
|
||||||
sysJob := options.SysJob
|
|
||||||
var params BarParams
|
|
||||||
|
|
||||||
err := json.Unmarshal([]byte(sysJob.TargetParams), ¶ms)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
//duration = params.Duration
|
|
||||||
log.Infof("重复 %v 任务ID %d", options.Repeat, sysJob.JobId)
|
|
||||||
|
|
||||||
// // 实现任务处理逻辑
|
|
||||||
// i := 0
|
|
||||||
// s.progress = i
|
|
||||||
// for i < 5 {
|
|
||||||
// // 获取任务进度
|
|
||||||
// progress := s.progress
|
|
||||||
// log.Infof("jonId: %s => 任务进度:%d", sysJob.JobID, progress)
|
|
||||||
// // 延迟响应
|
|
||||||
// time.Sleep(time.Second * 2)
|
|
||||||
// // 程序中途执行错误
|
|
||||||
// if i == 3 {
|
|
||||||
// // arr := [1]int{1}
|
|
||||||
// // arr[i] = 3
|
|
||||||
// // fmt.Println(arr)
|
|
||||||
// // return "i = 3"
|
|
||||||
// panic("程序中途执行错误")
|
|
||||||
// }
|
|
||||||
// i++
|
|
||||||
// // 改变任务进度
|
|
||||||
// s.progress = i
|
|
||||||
// }
|
|
||||||
|
|
||||||
var where string
|
|
||||||
if params.Extras == "" {
|
|
||||||
where = fmt.Sprintf("NOW()>ADDDATE(`%s`,interval %d day)", params.ColName, params.Duration)
|
|
||||||
} else {
|
|
||||||
where = fmt.Sprintf("NOW()>ADDDATE(`%s`,interval %d day) and %s", params.ColName, params.Duration, params.Extras)
|
|
||||||
}
|
|
||||||
|
|
||||||
var affected int64 = 0
|
|
||||||
if params.SessFlag {
|
|
||||||
affected, err = dborm.XormDeleteDataByWhere(where, params.TableName)
|
|
||||||
if err != nil {
|
|
||||||
// panic(fmt.Sprintf("Failed to XormDeleteDataByWhere:%v", err))
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
affected, err = dborm.XormDeleteDataByWhereNoSession(where, params.TableName)
|
|
||||||
if err != nil {
|
|
||||||
// panic(fmt.Sprintf("Failed to XormDeleteDataByWhere:%v", err))
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 返回结果,用于记录执行结果
|
|
||||||
return map[string]any{
|
|
||||||
"msg": "sucess",
|
|
||||||
"affected": affected,
|
|
||||||
}, nil
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
package delete_alarm_record
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"be.ems/src/framework/cron"
|
||||||
|
"be.ems/src/framework/database/db"
|
||||||
|
"be.ems/src/framework/logger"
|
||||||
|
)
|
||||||
|
|
||||||
|
var NewProcessor = &DeleteAlarmRecordProcessor{
|
||||||
|
count: 0,
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteAlarmRecordProcessor 删除告警记录
|
||||||
|
type DeleteAlarmRecordProcessor struct {
|
||||||
|
count int // 执行次数
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *DeleteAlarmRecordProcessor) Execute(data any) (any, error) {
|
||||||
|
s.count++ // 执行次数加一
|
||||||
|
options := data.(cron.JobData)
|
||||||
|
sysJob := options.SysJob
|
||||||
|
logger.Infof("重复:%v 任务ID:%d 执行次数:%d", options.Repeat, sysJob.JobId, s.count)
|
||||||
|
// 返回结果,用于记录执行结果
|
||||||
|
result := map[string]any{
|
||||||
|
"count": s.count,
|
||||||
|
}
|
||||||
|
|
||||||
|
// 读取参数值
|
||||||
|
var params struct {
|
||||||
|
StoreDays int `json:"storeDays"` // store days
|
||||||
|
}
|
||||||
|
err := json.Unmarshal([]byte(sysJob.TargetParams), ¶ms)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("json params err: %v", err)
|
||||||
|
}
|
||||||
|
if params.StoreDays < 0 {
|
||||||
|
return nil, fmt.Errorf("params storeDays less than 0 ")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 计算删除时间
|
||||||
|
ltTime := time.Now().AddDate(0, 0, -params.StoreDays).UnixMilli()
|
||||||
|
|
||||||
|
// 告警表
|
||||||
|
alarmTx := db.DB("").Table("alarm").Where("timestamp < ?", ltTime)
|
||||||
|
if err := alarmTx.Delete(nil).Error; err != nil {
|
||||||
|
result["alarm"] = err.Error()
|
||||||
|
} else {
|
||||||
|
result["alarm"] = alarmTx.RowsAffected
|
||||||
|
}
|
||||||
|
|
||||||
|
// 告警事件表
|
||||||
|
alarmEventTx := db.DB("").Table("alarm_event").Where("timestamp < ?", ltTime)
|
||||||
|
if err := alarmEventTx.Delete(nil).Error; err != nil {
|
||||||
|
result["alarm_event"] = err.Error()
|
||||||
|
} else {
|
||||||
|
result["alarm_event"] = alarmEventTx.RowsAffected
|
||||||
|
}
|
||||||
|
|
||||||
|
// 告警日志表
|
||||||
|
alarmLogTx := db.DB("").Table("alarm_log").Where("created_at < ?", ltTime)
|
||||||
|
if err := alarmLogTx.Delete(nil).Error; err != nil {
|
||||||
|
result["alarm_log"] = err.Error()
|
||||||
|
} else {
|
||||||
|
result["alarm_log"] = alarmLogTx.RowsAffected
|
||||||
|
}
|
||||||
|
|
||||||
|
// 告警转发日志表
|
||||||
|
alarmForwardLogTx := db.DB("").Table("alarm_forward_log").Where("created_at < ?", ltTime)
|
||||||
|
if err := alarmForwardLogTx.Delete(nil).Error; err != nil {
|
||||||
|
result["alarm_forward_log"] = err.Error()
|
||||||
|
} else {
|
||||||
|
result["alarm_forward_log"] = alarmForwardLogTx.RowsAffected
|
||||||
|
}
|
||||||
|
|
||||||
|
// 返回结果,用于记录执行结果
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
package delete_data_record
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"be.ems/src/framework/cron"
|
||||||
|
"be.ems/src/framework/database/db"
|
||||||
|
"be.ems/src/framework/logger"
|
||||||
|
)
|
||||||
|
|
||||||
|
var NewProcessor = &DeleteDataRecordProcessor{
|
||||||
|
count: 0,
|
||||||
|
}
|
||||||
|
|
||||||
|
// bar 队列任务处理
|
||||||
|
type DeleteDataRecordProcessor struct {
|
||||||
|
count int // 执行次数
|
||||||
|
}
|
||||||
|
|
||||||
|
type optionParams struct {
|
||||||
|
TableName string `json:"tableName"` // table name
|
||||||
|
ColName string `json:"colName"` // column name
|
||||||
|
StoreDays int `json:"storeDays"` // store days
|
||||||
|
WhereSQL string `json:"whereSQL"` // extras condition for where
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *DeleteDataRecordProcessor) Execute(data any) (any, error) {
|
||||||
|
s.count++ // 执行次数加一
|
||||||
|
options := data.(cron.JobData)
|
||||||
|
sysJob := options.SysJob
|
||||||
|
logger.Infof("重复:%v 任务ID:%d 执行次数:%d", options.Repeat, sysJob.JobId, s.count)
|
||||||
|
// 返回结果,用于记录执行结果
|
||||||
|
result := map[string]any{
|
||||||
|
"count": s.count,
|
||||||
|
}
|
||||||
|
|
||||||
|
// 读取参数值
|
||||||
|
var params optionParams
|
||||||
|
err := json.Unmarshal([]byte(sysJob.TargetParams), ¶ms)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("json params err: %v", err)
|
||||||
|
}
|
||||||
|
if params.TableName == "" {
|
||||||
|
return nil, fmt.Errorf("params tableName is empty ")
|
||||||
|
}
|
||||||
|
if params.StoreDays < 0 {
|
||||||
|
return nil, fmt.Errorf("params storeDays less than 0 ")
|
||||||
|
}
|
||||||
|
// 指定表名
|
||||||
|
tx := db.DB("").Table(params.TableName)
|
||||||
|
|
||||||
|
if params.StoreDays >= 0 && params.ColName != "" {
|
||||||
|
// 计算删除时间
|
||||||
|
ltTime := time.Now().AddDate(0, 0, -params.StoreDays).UnixMilli()
|
||||||
|
tx = tx.Where(fmt.Sprintf("%s < ?", params.ColName), ltTime)
|
||||||
|
}
|
||||||
|
if params.WhereSQL != "" {
|
||||||
|
tx = tx.Where(params.WhereSQL)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 执行删除
|
||||||
|
if err := tx.Delete(nil).Error; err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
result["affected"] = tx.RowsAffected
|
||||||
|
|
||||||
|
// 返回结果,用于记录执行结果
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
package delete_kpi_record
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"be.ems/src/framework/cron"
|
||||||
|
"be.ems/src/framework/database/db"
|
||||||
|
"be.ems/src/framework/logger"
|
||||||
|
)
|
||||||
|
|
||||||
|
var NewProcessor = &DeleteKPIRecordProcessor{
|
||||||
|
count: 0,
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteKPIRecordProcessor 删除KPI记录
|
||||||
|
type DeleteKPIRecordProcessor struct {
|
||||||
|
count int // 执行次数
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *DeleteKPIRecordProcessor) Execute(data any) (any, error) {
|
||||||
|
s.count++ // 执行次数加一
|
||||||
|
options := data.(cron.JobData)
|
||||||
|
sysJob := options.SysJob
|
||||||
|
logger.Infof("重复:%v 任务ID:%d 执行次数:%d", options.Repeat, sysJob.JobId, s.count)
|
||||||
|
// 返回结果,用于记录执行结果
|
||||||
|
result := map[string]any{
|
||||||
|
"count": s.count,
|
||||||
|
}
|
||||||
|
|
||||||
|
// 读取参数值
|
||||||
|
var params struct {
|
||||||
|
StoreDays int `json:"storeDays"` // store days
|
||||||
|
NeList []string `json:"neList"` // ne list
|
||||||
|
}
|
||||||
|
err := json.Unmarshal([]byte(sysJob.TargetParams), ¶ms)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("json params err: %v", err)
|
||||||
|
}
|
||||||
|
if params.StoreDays < 0 {
|
||||||
|
return nil, fmt.Errorf("params storeDays less than 0 ")
|
||||||
|
}
|
||||||
|
if len(params.NeList) <= 0 {
|
||||||
|
return nil, fmt.Errorf("params neList less than 0 ")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 计算删除时间
|
||||||
|
ltTime := time.Now().AddDate(0, 0, -params.StoreDays).UnixMilli()
|
||||||
|
|
||||||
|
for _, neType := range params.NeList {
|
||||||
|
neTypeLower := strings.ToLower(neType)
|
||||||
|
|
||||||
|
// KPI数据表
|
||||||
|
kpiTableName := fmt.Sprintf("kpi_report_%s", neTypeLower)
|
||||||
|
kpiTx := db.DB("").Table(kpiTableName).Where("created_at < ?", ltTime)
|
||||||
|
if err := kpiTx.Delete(nil).Error; err != nil {
|
||||||
|
result[kpiTableName] = err.Error()
|
||||||
|
} else {
|
||||||
|
result[kpiTableName] = kpiTx.RowsAffected
|
||||||
|
}
|
||||||
|
|
||||||
|
// KPI自定义数据表
|
||||||
|
kpicTableName := fmt.Sprintf("kpi_c_report_%s", neTypeLower)
|
||||||
|
kpicTx := db.DB("").Table(kpicTableName).Where("created_at < ?", ltTime)
|
||||||
|
if err := kpicTx.Delete(nil).Error; err != nil {
|
||||||
|
result[kpiTableName] = err.Error()
|
||||||
|
} else {
|
||||||
|
result[kpiTableName] = kpicTx.RowsAffected
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 返回结果,用于记录执行结果
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,128 @@
|
|||||||
|
package delete_ne_config_backup
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"be.ems/src/framework/cron"
|
||||||
|
"be.ems/src/framework/database/db"
|
||||||
|
"be.ems/src/framework/logger"
|
||||||
|
"be.ems/src/framework/utils/date"
|
||||||
|
neModel "be.ems/src/modules/network_element/model"
|
||||||
|
neService "be.ems/src/modules/network_element/service"
|
||||||
|
)
|
||||||
|
|
||||||
|
var NewProcessor = &DeleteNeConfigBackupProcessor{
|
||||||
|
neInfoService: neService.NewNeInfo,
|
||||||
|
count: 0,
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteNeConfigBackupProcessor 网元配置文件定期备份
|
||||||
|
type DeleteNeConfigBackupProcessor struct {
|
||||||
|
neInfoService *neService.NeInfo // 网元信息服务
|
||||||
|
count int // 执行次数
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *DeleteNeConfigBackupProcessor) Execute(data any) (any, error) {
|
||||||
|
s.count++ // 执行次数加一
|
||||||
|
options := data.(cron.JobData)
|
||||||
|
sysJob := options.SysJob
|
||||||
|
logger.Infof("重复:%v 任务ID:%d 执行次数:%d", options.Repeat, sysJob.JobId, s.count)
|
||||||
|
// 返回结果,用于记录执行结果
|
||||||
|
result := map[string]any{
|
||||||
|
"count": s.count,
|
||||||
|
}
|
||||||
|
|
||||||
|
// 读取参数值
|
||||||
|
var params struct {
|
||||||
|
StoreDays int `json:"storeDays"` // store days
|
||||||
|
}
|
||||||
|
err := json.Unmarshal([]byte(sysJob.TargetParams), ¶ms)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("json params err: %v", err)
|
||||||
|
}
|
||||||
|
if params.StoreDays < 0 {
|
||||||
|
return nil, fmt.Errorf("params storeDays less than 0 ")
|
||||||
|
}
|
||||||
|
|
||||||
|
neList := s.neInfoService.Find(neModel.NeInfo{}, false, false)
|
||||||
|
for _, neInfo := range neList {
|
||||||
|
neTypeAndId := fmt.Sprintf("%s_%s", neInfo.NeType, neInfo.NeId)
|
||||||
|
tx := db.DB("").Model(&neModel.NeConfigBackup{})
|
||||||
|
tx = tx.Where("ne_type = ? and ne_id = ?", neInfo.NeType, neInfo.NeId)
|
||||||
|
|
||||||
|
// 查询最后记录数据
|
||||||
|
var lastCreateTime int64 = 0
|
||||||
|
lastTx := tx.Select("create_time").Order("create_time DESC").Limit(1)
|
||||||
|
if err := lastTx.Find(&lastCreateTime).Error; err != nil {
|
||||||
|
result[neTypeAndId] = err.Error()
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if lastCreateTime <= 1e12 {
|
||||||
|
result[neTypeAndId] = "no data"
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// 计算删除时间
|
||||||
|
lastTime := time.UnixMilli(lastCreateTime)
|
||||||
|
ltTime := lastTime.AddDate(0, 0, -params.StoreDays)
|
||||||
|
|
||||||
|
// 删除小于最后时间的数据
|
||||||
|
delTx := tx.Delete("create_time < ?", ltTime.UnixMilli())
|
||||||
|
if err := delTx.Error; err != nil {
|
||||||
|
result[neTypeAndId] = err.Error()
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
result[neTypeAndId] = tx.RowsAffected
|
||||||
|
|
||||||
|
// 删除本地文件
|
||||||
|
s.deleteFile(neInfo.NeType, neInfo.NeId, ltTime)
|
||||||
|
}
|
||||||
|
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// deleteFile 删除本地文件
|
||||||
|
func (s DeleteNeConfigBackupProcessor) deleteFile(neType, neId string, oldFileDate time.Time) {
|
||||||
|
neTypeLower := strings.ToLower(neType)
|
||||||
|
localPath := fmt.Sprintf("/usr/local/etc/omc/ne_config/%s/%s/backup ", neTypeLower, neId)
|
||||||
|
files, err := os.ReadDir(localPath)
|
||||||
|
if err != nil {
|
||||||
|
logger.Errorf("logger Remove ne_config File ReadDir err: %v", err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for _, file := range files {
|
||||||
|
// 跳过非指定文件名
|
||||||
|
// zipFileName := fmt.Sprintf("%s-%s-etc-%s.zip", neTypeLower, neInfo.NeId, date.ParseDateToStr(time.Now(), date.YYYYMMDDHHMMSS))
|
||||||
|
fileName := fmt.Sprintf("%s-%s-etc-", neTypeLower, neId)
|
||||||
|
if !strings.HasPrefix(file.Name(), fileName) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
idx := strings.LastIndex(file.Name(), "-")
|
||||||
|
if idx == -1 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
dateStr := file.Name()[idx+1 : idx+15]
|
||||||
|
|
||||||
|
// 解析日期字符串
|
||||||
|
fileDate, err := time.Parse(date.YYYYMMDDHHMMSS, dateStr)
|
||||||
|
if err != nil {
|
||||||
|
logger.Errorf("logger Remove ne_config name Parse err: %v", err.Error())
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// 判断文件日期是否在给定日期之前
|
||||||
|
if fileDate.Before(oldFileDate) {
|
||||||
|
err := os.Remove(filepath.Join(localPath, file.Name()))
|
||||||
|
if err != nil {
|
||||||
|
logger.Errorf("logger Remove ne_config file err: %v", err.Error())
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -29,7 +29,7 @@ func (s *MonitorSysResourceProcessor) Execute(data any) (any, error) {
|
|||||||
s.count++ // 执行次数加一
|
s.count++ // 执行次数加一
|
||||||
options := data.(cron.JobData)
|
options := data.(cron.JobData)
|
||||||
sysJob := options.SysJob
|
sysJob := options.SysJob
|
||||||
logger.Infof("重复 %v 任务ID %d", options.Repeat, sysJob.JobId)
|
logger.Infof("重复:%v 任务ID:%d 执行次数:%d", options.Repeat, sysJob.JobId, s.count)
|
||||||
|
|
||||||
// 读取参数值
|
// 读取参数值
|
||||||
var params struct {
|
var params struct {
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ func (s *NeAlarmStateCheckProcessor) Execute(data any) (any, error) {
|
|||||||
s.count++ // 执行次数加一
|
s.count++ // 执行次数加一
|
||||||
options := data.(cron.JobData)
|
options := data.(cron.JobData)
|
||||||
sysJob := options.SysJob
|
sysJob := options.SysJob
|
||||||
logger.Infof("重复 %v 任务ID %d", options.Repeat, sysJob.JobId)
|
logger.Infof("重复:%v 任务ID:%d 执行次数:%d", options.Repeat, sysJob.JobId, s.count)
|
||||||
// 返回结果,用于记录执行结果
|
// 返回结果,用于记录执行结果
|
||||||
result := map[string]any{
|
result := map[string]any{
|
||||||
"count": s.count,
|
"count": s.count,
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ func (s *NeConfigBackupProcessor) Execute(data any) (any, error) {
|
|||||||
s.count++ // 执行次数加一
|
s.count++ // 执行次数加一
|
||||||
options := data.(cron.JobData)
|
options := data.(cron.JobData)
|
||||||
sysJob := options.SysJob
|
sysJob := options.SysJob
|
||||||
logger.Infof("重复 %v 任务ID %d", options.Repeat, sysJob.JobId)
|
logger.Infof("重复:%v 任务ID:%d 执行次数:%d", options.Repeat, sysJob.JobId, s.count)
|
||||||
// 返回结果,用于记录执行结果
|
// 返回结果,用于记录执行结果
|
||||||
result := map[string]any{
|
result := map[string]any{
|
||||||
"count": s.count,
|
"count": s.count,
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ func (s *NeDataUDM) Execute(data any) (any, error) {
|
|||||||
s.count++ // 执行次数加一
|
s.count++ // 执行次数加一
|
||||||
options := data.(cron.JobData)
|
options := data.(cron.JobData)
|
||||||
sysJob := options.SysJob
|
sysJob := options.SysJob
|
||||||
logger.Infof("重复 %v 任务ID %d", options.Repeat, sysJob.JobId)
|
logger.Infof("重复:%v 任务ID:%d 执行次数:%d", options.Repeat, sysJob.JobId, s.count)
|
||||||
// 返回结果,用于记录执行结果
|
// 返回结果,用于记录执行结果
|
||||||
result := map[string]any{
|
result := map[string]any{
|
||||||
"count": s.count,
|
"count": s.count,
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ package processor
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"be.ems/src/framework/cron"
|
"be.ems/src/framework/cron"
|
||||||
"be.ems/src/modules/crontask/processor/backupEtcFromNE"
|
processorDeleteAlarmRecord "be.ems/src/modules/crontask/processor/delete_alarm_record"
|
||||||
"be.ems/src/modules/crontask/processor/delExpiredNeBackup"
|
processorDeleteDataRecord "be.ems/src/modules/crontask/processor/delete_data_record"
|
||||||
"be.ems/src/modules/crontask/processor/deleteExpiredRecord"
|
processorDeleteKPIRecord "be.ems/src/modules/crontask/processor/delete_kpi_record"
|
||||||
|
processorDeleteNeConfigBackup "be.ems/src/modules/crontask/processor/delete_ne_config_backup"
|
||||||
"be.ems/src/modules/crontask/processor/exportTable"
|
"be.ems/src/modules/crontask/processor/exportTable"
|
||||||
"be.ems/src/modules/crontask/processor/getStateFromNE"
|
|
||||||
processorMonitorSysResource "be.ems/src/modules/crontask/processor/monitor_sys_resource"
|
processorMonitorSysResource "be.ems/src/modules/crontask/processor/monitor_sys_resource"
|
||||||
processorNeAlarmStateCheck "be.ems/src/modules/crontask/processor/ne_alarm_state_check"
|
processorNeAlarmStateCheck "be.ems/src/modules/crontask/processor/ne_alarm_state_check"
|
||||||
processorNeConfigBackup "be.ems/src/modules/crontask/processor/ne_config_backup"
|
processorNeConfigBackup "be.ems/src/modules/crontask/processor/ne_config_backup"
|
||||||
@@ -24,11 +24,16 @@ func InitCronQueue() {
|
|||||||
cron.CreateQueue("ne_data_udm", processorNeDataUDM.NewProcessor)
|
cron.CreateQueue("ne_data_udm", processorNeDataUDM.NewProcessor)
|
||||||
// 网元告警-状态检查
|
// 网元告警-状态检查
|
||||||
cron.CreateQueue("ne_alarm_state_check", processorNeAlarmStateCheck.NewProcessor)
|
cron.CreateQueue("ne_alarm_state_check", processorNeAlarmStateCheck.NewProcessor)
|
||||||
// delete expired NE backup file
|
|
||||||
cron.CreateQueue("delExpiredNeBackup", delExpiredNeBackup.NewProcessor)
|
// 删除-表内数据记录
|
||||||
cron.CreateQueue("deleteExpiredRecord", deleteExpiredRecord.NewProcessor)
|
cron.CreateQueue("delete_data_record", processorDeleteDataRecord.NewProcessor)
|
||||||
cron.CreateQueue("backupEtcFromNE", backupEtcFromNE.NewProcessor)
|
// 删除-告警数据记录
|
||||||
cron.CreateQueue("getStateFromNE", getStateFromNE.NewProcessor)
|
cron.CreateQueue("delete_alarm_record", processorDeleteAlarmRecord.NewProcessor)
|
||||||
|
// 删除-KPI数据记录
|
||||||
|
cron.CreateQueue("delete_kpi_record", processorDeleteKPIRecord.NewProcessor)
|
||||||
|
// 删除-网元配置文件定期备份
|
||||||
|
cron.CreateQueue("delete_ne_config_backup", processorDeleteNeConfigBackup.NewProcessor)
|
||||||
|
|
||||||
cron.CreateQueue("exportTable", exportTable.NewProcessor)
|
cron.CreateQueue("exportTable", exportTable.NewProcessor)
|
||||||
cron.CreateQueue("removeFile", removeFile.NewProcessor)
|
cron.CreateQueue("removeFile", removeFile.NewProcessor)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user