Esempio n. 1
0
        /// <summary>Implements <see cref="IClientConnInfoDao.Find"/></summary>
        public ClientConnInfo Find(Int64 iD)
        {
            String         stmtId = "ClientConnInfo-Find";
            ClientConnInfo result = Instance.QueryForObject <ClientConnInfo>(stmtId, iD);

            return(result);
        }
Esempio n. 2
0
        /// <summary>Implements <see cref="IClientConnInfoDao.Insert"/></summary>
        public void Insert(ClientConnInfo obj)
        {
            if (obj == null)
            {
                throw new ArgumentNullException("obj");
            }
            String stmtId = "ClientConnInfo-Insert";

            Instance.Insert(stmtId, obj);
        }
Esempio n. 3
0
        /// <summary>Implements <see cref="IClientConnInfoDao.Delete"/></summary>
        public void Delete(ClientConnInfo obj)
        {
            if (obj == null)
            {
                throw new ArgumentNullException("obj");
            }
            String stmtId = "ClientConnInfo-Delete";

            Instance.Delete(stmtId, obj);
        }
Esempio n. 4
0
        /// <summary>Implements <see cref="IClientConnInfoDao.Reload"/></summary>
        public void Reload(ClientConnInfo obj)
        {
            if (obj == null)
            {
                throw new ArgumentNullException("obj");
            }
            String stmtId = "ClientConnInfo-Find";

            Instance.QueryForObject <ClientConnInfo>(stmtId, obj, obj);
        }
Esempio n. 5
0
        static void Main(string[] args)
        {
            //首先获取wcf监控服务器的信息
            IWcfServerDao     serverdao  = CastleContext.Instance.GetService <IWcfServerDao>();
            IList <WcfServer> serverlist = serverdao.FindAll();

            //首先建立批次信息
            Batch batch = new Batch();

            batch.CreateTime = DateTime.Now;
            IBatchDao batchdao = CastleContext.Instance.GetService <IBatchDao>();
            int       batchid  = batchdao.Insert(batch);

            IWcfServerPerformanceDao perfdao    = CastleContext.Instance.GetService <IWcfServerPerformanceDao>();
            IClientConnInfoDao       clientdao  = CastleContext.Instance.GetService <IClientConnInfoDao>();
            IOperationInfoDao        operatedao = CastleContext.Instance.GetService <IOperationInfoDao>();

            foreach (WcfServer server in serverlist)
            {
                string ip = server.IP + ":" + server.Point;
                PCData pcdata;
                double memCount;
                Dictionary <string, LinkModel> modellist = getLinkModel(ip, out pcdata, out memCount);
                int all_connnums = 0;

                foreach (string key in modellist.Keys)
                {
                    LinkModel model = modellist[key];
                    Dictionary <string, UrlInfo> infolist = model.UrlInfoList;

                    foreach (string url in infolist.Keys)
                    {
                        UrlInfo info = infolist[url];
                        all_connnums += info.ConnNums;

                        foreach (string opereateName in info.OperateNums.Keys)
                        {
                            //加入操作信息表
                            OperationInfo oinfo = new OperationInfo();
                            oinfo.Adress        = url;
                            oinfo.BatchID       = batchid;
                            oinfo.IP            = model.ClientIP.Split('_')[0];
                            oinfo.OperationName = opereateName;
                            oinfo.OperationNums = info.OperateNums[opereateName];
                            oinfo.ServerID      = server.ID;
                            oinfo.AppName       = model.ClientIP.Split('_')[1];

                            operatedao.Insert(oinfo);
                        }

                        //加入客户端连接信息表
                        ClientConnInfo clientinfo = new ClientConnInfo();
                        clientinfo.Adress   = url;
                        clientinfo.BatchID  = batchid;
                        clientinfo.IP       = model.ClientIP.Split('_')[0];
                        clientinfo.LinkNums = info.ConnNums;
                        clientinfo.ServerID = server.ID;
                        clientinfo.AppName  = model.ClientIP.Split('_')[1];

                        clientdao.Insert(clientinfo);
                    }
                }

                //存入服务器性能表
                WcfServerPerformance sperf = new WcfServerPerformance();
                sperf.BatchID         = batchid;
                sperf.Cpu             = (decimal)pcdata.Cpu;
                sperf.AllMem          = (decimal)memCount;
                sperf.Mem             = (decimal)pcdata.Mem;
                sperf.ProcessId       = pcdata.ProcessId;
                sperf.ServerID        = server.ID;
                sperf.ThreadCount     = pcdata.ThreadCount;
                sperf.CurrentConnNums = all_connnums;

                perfdao.Insert(sperf);
            }
        }