Beispiel #1
0
 /// <summary>
 /// Sets the selected server to the one with given index
 /// </summary>
 /// <param name="index">Index of the server to select</param>
 static public void SetSelectedServerIndex(int index)
 {
     SelectedServerIndex = index;
     InfluxDB.SetCurrentServerName(GetSelectedServer().Name);
     InfluxDB.SetCurrentServerAddress(GetSelectedServer().Address);
     HostsUpdated = false;
 }
Beispiel #2
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;
        }
Beispiel #3
0
        /// <summary>
        /// Returns the list of all hosts from the current server
        /// </summary>
        /// <returns></returns>
        static public async Task <List <Host> > GetAllHostsAsync()
        {
            if (HostsUpdated)
            {
                return(Hosts);
            }
            else
            {
                HostsUpdated = true;
                Hosts        = await InfluxDB.GetAllHostsAsync();

                return(Hosts);
            }
        }
Beispiel #4
0
 /// <summary>
 /// Sets the current host
 /// </summary>
 /// <param name="name">Name of the current host</param>
 static public void SetCurrentHost(string name)
 {
     InfluxDB.SetCurrentHost(name);
 }