public LoadBalancerTile(
            DrawingElement drawing,
            LoadBalancerNode loadBalancer,
            TrafficIndicatorConfiguration trafficIndicatorConfiguration,
            string title,
            string cssClass,
            List <string> details,
            bool showConnections,
            bool showSessions,
            bool showTraffic)
            : base(drawing, title, cssClass, loadBalancer.Offline, 2, loadBalancer.Name)
        {
            _drawing      = drawing;
            _loadBalancer = loadBalancer;
            _trafficIndicatorThresholds = trafficIndicatorConfiguration.Thresholds;

            LinkUrl = "/ui/node?name=" + loadBalancer.Name;

            if (details != null)
            {
                AddDetails(details, null, loadBalancer.Offline ? "disabled" : string.Empty);
            }

            if (loadBalancer.Offline)
            {
                Title.CssClass += " disabled";
            }

            if (loadBalancer.Outputs != null)
            {
                _outputDrawings = new OutputDrawing[loadBalancer.Outputs.Length];

                for (var i = 0; i < loadBalancer.Outputs.Length; i++)
                {
                    var outputNodeName = loadBalancer.Outputs[i];
                    var output         = loadBalancer.OutputNodes[i];
                    _outputDrawings[i] = new OutputDrawing(
                        drawing,
                        outputNodeName,
                        "Server",
                        output,
                        cssClass + "_output",
                        showConnections,
                        showSessions,
                        showTraffic);
                }

                foreach (var outputDrawing in _outputDrawings)
                {
                    AddChild(outputDrawing);
                }
            }
        }
Exemple #2
0
        public LoadBalancerStats(
            DrawingElement drawing,
            LoadBalancerNode loadBalancer,
            DashboardConfiguration dashboardConfiguration,
            DrawingElement[] topSectionElements)
            : base(drawing)
        {
            var topSection    = AddSection();
            var bottomSection = AddSection();

            foreach (var element in topSectionElements)
            {
                topSection.AddChild(element);
            }

            var requestRateData = new Tuple <string, float> [loadBalancer.OutputNodes.Length];

            for (var i = 0; i < loadBalancer.OutputNodes.Length; i++)
            {
                var nodeName  = loadBalancer.OutputNodes[i].Name;
                var nodeTitle = FindNodeTitle(dashboardConfiguration, nodeName);

                requestRateData[i] = new Tuple <string, float>(
                    nodeTitle,
                    (float)loadBalancer.OutputNodes[i].TrafficAnalytics.RequestsPerMinute);
            }

            bottomSection.AddChild(CreatePieChart("Request Rate", "/min", requestRateData, TotalHandling.Sum, "rate_piechart"));

            var requestTimeData = new Tuple <string, float> [loadBalancer.OutputNodes.Length];

            for (var i = 0; i < loadBalancer.OutputNodes.Length; i++)
            {
                var nodeName  = loadBalancer.OutputNodes[i].Name;
                var nodeTitle = FindNodeTitle(dashboardConfiguration, nodeName);

                requestTimeData[i] = new Tuple <string, float>(
                    nodeTitle,
                    (float)loadBalancer.OutputNodes[i].TrafficAnalytics.RequestTime.TotalMilliseconds);
            }

            bottomSection.AddChild(CreatePieChart("Request Time", "ms", requestTimeData, TotalHandling.Maximum, "time_piechart"));
        }