public async Task <JsonResult> PollCPU(string id = null, string node = null, string range = null)
        {
            var n = id.HasValue() ? DashboardData.GetNodeById(id) : DashboardData.GetNodeByName(node);

            if (n == null)
            {
                return(JsonNotFound());
            }

            var data = await n.GetCPUUtilization();

            if (data?.Data == null)
            {
                return(JsonNotFound());
            }

            var total = data.Data.FirstOrDefault(c => c.Name == "Total");

            return(Json(new
            {
                duration = data.Duration.TotalMilliseconds,
                cores = data.Data.Where(c => c != total).Select(c => new
                {
                    name = c.Name,
                    utilization = c.Utilization
                }),
                total = total?.Utilization ?? 0
            }));
        }
        public ActionResult PollCPU(int?id = null, string node = null, string range = null)
        {
            var n = id.HasValue ? DashboardData.GetNodeById(id.Value) : DashboardData.GetNodeByName(node);

            if (n == null)
            {
                return(JsonNotFound());
            }

            var data = n.GetCPUUtilization();

            if (data == null || data.Data == null)
            {
                return(JsonNotFound());
            }

            var total = data.Data.FirstOrDefault(c => c.Name == "Total");

            return(Json(new
            {
                duration = data.Duration.TotalMilliseconds,
                cores = data.Data.Where(c => c != total).Select(c => new
                {
                    name = c.Name,
                    utilization = c.Utilization
                }),
                total = total != null ? total.Utilization : 0
            }));
        }
示例#3
0
        public ActionResult SingleNode([DefaultValue(CurrentStatusTypes.Stats)] CurrentStatusTypes view, string node = null)
        {
            var vd = new NodeModel
            {
                CurrentNode       = DashboardData.GetNodeByName(node),
                CurrentStatusType = view
            };

            return(View("Node", vd));
        }
示例#4
0
        public ActionResult InstanceSummary(string node, string type)
        {
            var n = DashboardData.GetNodeByName(node);

            switch (type)
            {
            case "hardware":
                return(View("Node.Hardware", n));

            case "network":
                return(View("Node.Network", n));

            default:
                return(ContentNotFound("Unknown summary view requested"));
            }
        }
示例#5
0
        public ActionResult Test(string node = null)
        {
            var n = DashboardData.GetNodeByName(node);

            return(View(n));
        }