Example #1
0
        public ActionResult Profiles()
        {
            ProfileBL bl = new ProfileBL();

            List <CoreProfile> profiles = bl.GetProfileList();

            return(View("Profiles", profiles));
        }
Example #2
0
        public ActionResult Monitor()
        {
            ProfileBL bl = new ProfileBL();

            List <CoreProfile> profiles = bl.GetProfileList();

            return(View(profiles));
        }
Example #3
0
        // POST: Core/Delete/5

        public ActionResult Delete(string key)
        {
            ProfileBL bl = new ProfileBL();

            CoreProfile profile = bl.GetProfile(key);

            StopConsumer(profile.ProjectKey, null);

            bl.RemoveProfile(key);


            List <CoreProfile> profiles = bl.GetProfileList();

            return(View("Profiles", profiles));
        }
Example #4
0
        public ActionResult Index()
        {
            IOwinContext        ctx    = Request.GetOwinContext();
            ClaimsPrincipal     user   = ctx.Authentication.User;
            IEnumerable <Claim> claims = user.Claims;
            //获取Cliams的方式
            //1、user.FindFirst("WatcherUser").Value
            //2、use Linq to claims

            ProfileBL bl = new ProfileBL();

            List <CoreProfile> profiles = bl.GetProfileList();


            return(View(profiles));
        }
Example #5
0
        public ActionResult InitProfile(string key)
        {
            try
            {
                ProfileBL bl = new ProfileBL();

                CoreProfile profile = bl.GetProfile(key);


                StopConsumer(profile.ProjectKey, null);

                CreateMQ(profile);

                InitHeartData(profile.ProjectKey);

                string[] types = Enum.GetNames(typeof(LogType));

                foreach (string type in types)
                {
                    switch (type)
                    {
                    case "ExceptionLog":

                        for (int i = 0; i < profile.ExceptionConsumerNum; i++)
                        {
                            CreateConsumer("mq_exception_" + profile.ProjectKey, profile.MQServer, profile.ProjectKey, i, new EventHandler <BasicDeliverEventArgs>(new TrackLogBL(SendHeartData).ResolveException));
                        }

                        break;

                    case "OperateLog":

                        for (int i = 0; i < profile.OperateConsumerNum; i++)
                        {
                            CreateConsumer("mq_operate_" + profile.ProjectKey, profile.MQServer, profile.ProjectKey, i, new EventHandler <BasicDeliverEventArgs>(new TrackLogBL(SendHeartData).ResolveOperate));
                        }

                        break;

                    case "SystemLog":

                        for (int i = 0; i < profile.SystemConsumerNum; i++)
                        {
                            CreateConsumer("mq_system_" + profile.ProjectKey, profile.MQServer, profile.ProjectKey, i, new EventHandler <BasicDeliverEventArgs>(new TrackLogBL(SendHeartData).ResolveSystem));
                        }

                        break;

                    case "Normal":

                        for (int i = 0; i < profile.NormalConsumerNum; i++)
                        {
                            CreateConsumer("mq_normal_" + profile.ProjectKey, profile.MQServer, profile.ProjectKey, i, new EventHandler <BasicDeliverEventArgs>(new TrackLogBL(SendHeartData).ResolveNormal));
                        }

                        break;
                    }
                }


                List <CoreProfile> profiles = bl.GetProfileList();

                return(View("Profiles", profiles));
            }
            catch (Exception e)
            {
                return(View("Profiles"));
            }
        }