Ejemplo n.º 1
0
        /// <summary>
        /// Asks for the data and puts it in the information datagrid
        /// </summary>
        async public void UpdateInfoDataGrid()
        {
            List <Info> infos = new List <Info>();

            // Uptime
            int uptime = await InfluxDB.GetUptime();

            int uptimeHours = uptime / 60 / 60;

            infos.Add(new Info("Uptime", uptimeHours.ToString() + " hours"));

            // CPU usage
            double cpuUsage = await InfluxDB.GetCPUUsage();

            infos.Add(new Info("CPU Usage", cpuUsage.ToString().Substring(0, 4) + "%"));

            // RAM usage
            double ramUsage = await InfluxDB.GetRamUsage();

            infos.Add(new Info("RAM Usage", ramUsage.ToString().Substring(0, 4) + "%"));

            // Ram usage average over 24h
            double ramUsage24h = await InfluxDB.GetRAMUsageAverage24h();

            infos.Add(new Info("Average RAM usage (24h)", ramUsage24h.ToString().Substring(0, 4) + "%"));

            // CPU usage average over 24h
            double cpuUsage24h = await InfluxDB.GetCPUUsageAverage24h();

            infos.Add(new Info("Average CPU Usage (24h)", cpuUsage24h.ToString().Substring(0, 4) + "%"));

            dgPCInfo.ItemsSource = infos;
        }