コード例 #1
0
    protected void timerMonitoring_Tick(object sender, EventArgs e)
    {
        //FillRAMValues();
        //InitChartRAM();

        //FillCPUValues();
        //InitChartCPU();
        LogMonitoring.Add("Tick");
        InitCPU();
        InitRAM();
        InitStockage();

        upMonitoring.Update();
    }
コード例 #2
0
    protected List <string> GetLastEspaceDisque()
    {
        List <string> val = new List <string>();

        try
        {
            Serveur myServeur = GetServeur();
            if (myServeur != null)
            {
                LogMonitoring.Add("-- Début GetLastEspaceDisque --");
                string execPath = myServeur.cheminInfosMonitoring;

                string resPath = Path.Combine(Path.GetDirectoryName(execPath), "disk.txt");

                ProcessStartInfo psi = new ProcessStartInfo();
                psi.FileName        = execPath;
                psi.Arguments       = "disk";
                psi.CreateNoWindow  = true;
                psi.WindowStyle     = ProcessWindowStyle.Hidden;
                psi.UserName        = "******";
                psi.Password        = ConvertToSecureString("LZ0i0GODt9cuoJ");
                psi.UseShellExecute = false;

                LogMonitoring.Add("Lancement ProcessStartInfo");
                Process proc = Process.Start(psi);
                proc.WaitForExit();
                LogMonitoring.Add("Fin ProcessStartInfo");

                val = File.ReadAllLines(resPath).ToList();
                LogMonitoring.Add("DISK : " + val);
                LogMonitoring.Add("-- Fin GetLastEspaceDisque --");
            }
        }
        catch (Exception e)
        {
            LogMonitoring.Add("ERROR : GetLastEspaceDisque : " + e.Message);
            LogMonitoring.Add(e.StackTrace);
        }
        return(val);
    }