Exemplo n.º 1
0
        public void Init(bool isEnableInnerMsg, string serverAddress, AppServerConfig appServerConfig, IPCCommuConfig ipcConfig)
        {
            CommonLib.InnerMessageManager.SetEnable(isEnableInnerMsg);

            MyIP = appServerConfig.IPAddress;

            AppServerInfo.App서버_정보_설정(appServerConfig);

            hubConnection = new HubConnection(serverAddress);

            RegistHubProxy(hubConnection);

            SendMessages.Init(agentHubProxy);

            IPCCommu.Init(ipcConfig.MyPort, ipcConfig.OtherPort, ipcConfig.MaxPacketSize, ipcConfig.MaxPacketBufferSize);
            IPCCommu.InitClient(appServerConfig.AppServerName);

            ComputerStatus.Init();
        }
        public static void 관리서버에_App서버_상태통보(string currentDateTime, string userCount)
        {
            try
            {
                //if (string.IsNullOrEmpty(currentDateTime))
                //{
                //    return;
                //}

                var exename = AppServerInfo.AppServerExeFileName.Replace(".exe", "");
                ComputerStatus.GetStatus(AppServerInfo.AppServerProcess, exename);

                bool 서버실행중 = true;
                if (AppServerInfo.AppServerProcess == null)
                {
                    서버실행중 = false;
                }

                bool agent와AppServer통신가능_여부 = true;
                if (string.IsNullOrEmpty(currentDateTime))
                {
                    agent와AppServer통신가능_여부 = false;
                }

                var msgAsppServerStatus = new CommonLib.MsgAppServerStatus()
                {
                    AppServer실행중           = 서버실행중,
                    전체_CPU_사용량             = ComputerStatus.전체_CPU_사용량.ToString(),
                    프로세스_CPU_사용량           = ComputerStatus.프로세스_CPU_사용량.ToString(),
                    AppServer메모리_사용량       = ComputerStatus.메모리_사용량.ToString(),
                    Agent와AppServer통신가능_여부 = agent와AppServer통신가능_여부,
                    UserCount = userCount,
                };


                string json = JsonConvert.SerializeObject(msgAsppServerStatus, Formatting.Indented);
                agentHubProxy.Invoke("Agent로부터_App서버_상태", json);
            }
            catch (Exception ex)
            {
                CommonLib.DevLog.Write(ex.ToString(), CommonLib.LOG_LEVEL.ERROR);
            }
        }