示例#1
0
 public ActionResult HAProxyDetailed(string group, string node, string watch = null, bool norefresh = false)
 {
     var haGroup = HAProxyGroup.GetGroup(group ?? node);
     var vd = new HAProxyModel
     {
         SelectedGroup = haGroup,
         Groups = haGroup != null ? new List<HAProxyGroup> { haGroup } : HAProxyGroup.AllGroups,
         Proxies = (haGroup != null ? haGroup.GetProxies() : HAProxyGroup.GetAllProxies()),
         View = HAProxyModel.Views.Detailed,
         Refresh = !norefresh,
         WatchProxy = watch
     };
     return View("HAProxy.Detailed", vd);
 }
示例#2
0
        public ActionResult HAProxyDashboard(string group, string node, string watch = null, bool norefresh = false)
        {
            var haGroup = HAProxyGroup.GetGroup(group ?? node);
            var proxies = (haGroup != null ? haGroup.GetProxies() : HAProxyGroup.GetAllProxies());
            proxies.RemoveAll(p => !p.HasServers);

            var vd = new HAProxyModel
            {
                SelectedGroup = haGroup,
                Groups = haGroup != null ? new List<HAProxyGroup> { haGroup } : HAProxyGroup.AllGroups,
                Proxies = proxies,
                View = HAProxyModel.Views.Dashboard,
                Refresh = !norefresh,
                WatchProxy = watch
            };
            return View("HAProxy.Dashboard", vd);
        }
        public ActionResult HAProxyAdminDashboard(string group, bool norefresh = false)
        {
            var haGroup = HAProxyGroup.GetGroup(group);
            var proxies = haGroup != null ? haGroup.GetProxies() : HAProxyGroup.GetAllProxies();
            proxies.RemoveAll(p => !p.HasServers);

            var vd = new HAProxyModel
                {
                    SelectedGroup = haGroup,
                    Groups = haGroup != null ? new List<HAProxyGroup> { haGroup } : HAProxyGroup.AllGroups,
                    Proxies = proxies,
                    View = HAProxyModel.Views.Admin,
                    Refresh = !norefresh,
                    AdminMode = true
                };
            return View("HAProxy.Dashboard", vd);
        }
示例#4
0
        public ActionResult HAProxyTraffic(string host)
        {
            if (!Current.Settings.HAProxy.Traffic.Enabled)
                return DefaultAction();
            
            var hosts = Task.Run(() => Data.HAProxy.HAProxyTraffic.GetHosts());
            var topRoutes = Task.Run(() => Data.HAProxy.HAProxyTraffic.GetTopPageRotues(30, host));

            Task.WaitAll(hosts, topRoutes);

            var vd = new HAProxyModel
            {
                Host = host,
                Hosts = hosts.Result.OrderBy(h => h != "stackoverflow.com").ThenBy(h => h),
                TopRoutes = topRoutes.Result,
                View = HAProxyModel.Views.Traffic
            };
            return View("HAProxy.Traffic", vd);
        }