Example #1
0
		/// <summary>Implements <see cref="IBatchDao.Insert"/></summary>
		public int Insert(Batch obj) {
			if (obj == null) throw new ArgumentNullException("obj");
			String stmtId = "Batch-Insert";
			int id = (int)Instance.Insert(stmtId, obj);

            return id;
		}
Example #2
0
		/// <summary>Implements <see cref="IBatchDao.Reload"/></summary>
		public void Reload(Batch obj) {
			if (obj == null) throw new ArgumentNullException("obj");
			String stmtId = "Batch-Find";
			Instance.QueryForObject<Batch>(stmtId, obj, obj);
		}
Example #3
0
		/// <summary>Implements <see cref="IBatchDao.Delete"/></summary>
		public void Delete(Batch obj) {
			if (obj == null) throw new ArgumentNullException("obj");
			String stmtId = "Batch-Delete";
			Instance.Delete(stmtId, obj);
		}
Example #4
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);
            }
        }