org.dromara.jpom.system.init.ServerCheckMonitor Maven / Gradle / Ivy
The newest version!
/*
* Copyright (c) 2019 Of Him Code Technology Studio
* Jpom is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
*/
package org.dromara.jpom.system.init;
import cn.keepbx.jpom.event.ISystemTask;
import cn.keepbx.jpom.model.JsonMessage;
import com.alibaba.fastjson2.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.dromara.jpom.common.ILoadEvent;
import org.dromara.jpom.common.RemoteVersion;
import org.dromara.jpom.common.forward.NodeForward;
import org.dromara.jpom.common.forward.NodeUrl;
import org.dromara.jpom.common.i18n.I18nMessageUtil;
import org.dromara.jpom.cron.CronUtils;
import org.dromara.jpom.func.assets.AssetsExecutorPoolService;
import org.dromara.jpom.model.data.NodeModel;
import org.dromara.jpom.script.BaseRunScript;
import org.dromara.jpom.service.node.NodeService;
import org.dromara.jpom.service.node.script.NodeScriptExecuteLogServer;
import org.dromara.jpom.service.node.script.NodeScriptServer;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Configuration;
import java.util.Collection;
import java.util.List;
/**
* 检查监控数据状态
*
* @author bwcx_jzy
* @since 2019/7/14
*/
@Configuration
@Slf4j
public class ServerCheckMonitor implements ILoadEvent, ISystemTask {
private final NodeService nodeService;
private final NodeScriptServer nodeScriptServer;
private final NodeScriptExecuteLogServer nodeScriptExecuteLogServer;
private final AssetsExecutorPoolService assetsExecutorPoolService;
public ServerCheckMonitor(NodeService nodeService,
NodeScriptServer nodeScriptServer,
NodeScriptExecuteLogServer nodeScriptExecuteLogServer,
AssetsExecutorPoolService assetsExecutorPoolService) {
this.nodeService = nodeService;
this.nodeScriptServer = nodeScriptServer;
this.nodeScriptExecuteLogServer = nodeScriptExecuteLogServer;
this.assetsExecutorPoolService = assetsExecutorPoolService;
}
/**
* 同步 节点的脚本模版日志
*
* @param nodeModel 节点
*/
private void pullScriptLogItem(NodeModel nodeModel) {
try {
//NodeScriptExecuteLogServer nodeScriptExecuteLogServer = SpringUtil.getBean(NodeScriptExecuteLogServer.class);
Collection strings = nodeScriptExecuteLogServer.syncExecuteNodeInc(nodeModel);
if (strings == null) {
return;
}
JSONObject jsonObject = new JSONObject();
jsonObject.put("ids", strings);
JsonMessage
© 2015 - 2025 Weber Informatics LLC | Privacy Policy