Exemplo n.º 1
0
            /// <summary>
            /// Gets the CPU usage from the cluster.
            /// </summary>
            /// <param name="start"></param>
            /// <param name="end"></param>
            /// <param name="stepSize"></param>
            /// <returns></returns>
            public async Task <PrometheusResponse <PrometheusMatrixResult> > GetCpuUsageAsync(DateTime start, DateTime end, string stepSize = "15s")
            {
                await SyncContext.Clear;

                var query = $@"(sum(irate(node_cpu_seconds_total{{mode = ""idle"", cluster=~""{NeonDashboardService.ClusterInfo.Name}""}}[10m])))";

                CPUUsagePercent = await QueryRangeAsync(query, start, end, stepSize);

                NotifyStateChanged();

                return(CPUUsagePercent);
            }
Exemplo n.º 2
0
            /// <summary>
            /// Gets the total disk usage for the cluster.
            /// </summary>
            /// <param name="start"></param>
            /// <param name="end"></param>
            /// <param name="stepSize"></param>
            /// <returns></returns>
            public async Task <PrometheusResponse <PrometheusMatrixResult> > GetDiskUsageAsync(DateTime start, DateTime end, string stepSize = "15s")
            {
                await SyncContext.Clear;

                var query = $@"sum(node_filesystem_size_bytes{{cluster=~""{NeonDashboardService.ClusterInfo.Name}"", mountpoint=""/"",fstype!=""rootfs""}}) - sum(node_filesystem_avail_bytes{{cluster=~""{NeonDashboardService.ClusterInfo.Name}"", mountpoint=""/"",fstype!=""rootfs""}})";

                DiskUsageBytes = await QueryRangeAsync(query, start, end, stepSize);

                NotifyStateChanged();

                return(DiskUsageBytes);
            }
Exemplo n.º 3
0
            /// <summary>
            /// Get the total memory usage for the cluster.
            /// </summary>
            /// <param name="start"></param>
            /// <param name="end"></param>
            /// <param name="stepSize"></param>
            /// <returns></returns>
            public async Task <PrometheusResponse <PrometheusMatrixResult> > GetMemoryUsageAsync(DateTime start, DateTime end, string stepSize = "15s")
            {
                await SyncContext.Clear;

                var query = $@"sum(node_memory_MemTotal_bytes{{cluster=~""{NeonDashboardService.ClusterInfo.Name}""}}) - sum(node_memory_MemFree_bytes{{cluster=~""{NeonDashboardService.ClusterInfo.Name}""}})";

                MemoryUsageBytes = await QueryRangeAsync(query, start, end, stepSize);

                NotifyStateChanged();

                return(MemoryUsageBytes);
            }