コード例 #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 Dashboard(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));
        }
コード例 #3
0
        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 async Task <ActionResult> Traffic(string host)
        {
            if (!Current.Settings.HAProxy.Traffic.Enabled)
            {
                return(DefaultAction());
            }

            var hosts     = HAProxyTraffic.GetHostsAsync();
            var topRoutes = HAProxyTraffic.GetTopPageRotuesAsync(30, host);

            await Task.WhenAll(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));
        }
コード例 #5
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));
        }