private void pollAllSnmpHost()
        {
            if (HostListView.Items.Count > 0)
            {
                //Show ProgressBar
                this.ProgressLabel.Visible = true;
                this.ProgressBar.Visible = true;
                this.ProgressStatusLabel.Visible = true;
                this.FailedLabel.Visible = true;
                this.ProgressFailedLabel.Visible = true;

                this.ProgressBar.Minimum = 0;
                this.ProgressBar.Maximum = HostListView.Items.Count;
                this.ProgressBar.Step = 1;
                this.ProgressStatusLabel.Text = String.Format("0/{0}" ,HostListView.Items.Count);
                this.Refresh();
                //this.statusStrip1.Refresh();

                int i = 1;
                int failed = 0;
                foreach (ListViewItem lsti in HostListView.Items)
                {
                    SnmpPoller snmp = new SnmpPoller(HDDResultListView, CPUResultListView, lsti.SubItems[0].Text, Convert.ToInt16(lsti.SubItems[1].Text), lsti.SubItems[2].Text, Convert.ToInt16(lsti.SubItems[3].Text), lsti.SubItems[4].Text, lsti.SubItems[5].Text);
                    snmp.HddStatsPoll();

                    lsti.SubItems[6].Text = snmp.SnmpError;
                    if (snmp.SnmpError != "")
                    {
                        failed++;
                        this.ProgressFailedLabel.Text = String.Format("{0}/{1}", failed, HostListView.Items.Count);
                    }

                    this.ProgressBar.PerformStep();
                    this.ProgressStatusLabel.Text = String.Format("{0}/{1}", i,HostListView.Items.Count);
                    this.Refresh();
                    //this.statusStrip1.Refresh();
                    i++;
                }
            }
        }
 private void pollToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (HostListView.SelectedItems.Count > 0)
     {
         foreach (ListViewItem lsti in HostListView.SelectedItems)
         {
             SnmpPoller snmp = new SnmpPoller(HDDResultListView, CPUResultListView, lsti.SubItems[0].Text, Convert.ToInt16(lsti.SubItems[1].Text), lsti.SubItems[2].Text, Convert.ToInt16(lsti.SubItems[3].Text), lsti.SubItems[4].Text, lsti.SubItems[5].Text);
             snmp.HddStatsPoll();
         }
     }
 }
Exemplo n.º 3
0
        private void SnmpPollAllHost()
        {
            if (SnmpHostListView.Items.Count > 0)
            {
                //Show ProgressBar
                this.ProgressLabel.Visible = true;
                this.ProgressBar.Visible = true;
                this.ProgressStatusLabel.Visible = true;
                this.FailedLabel.Visible = true;
                this.ProgressFailedLabel.Visible = true;

                this.SNMPProgressBar.Minimum = 0;
                this.SNMPProgressBar.Maximum = SnmpHostListView.Items.Count;
                this.SNMPProgressBar.Value = 0;
                this.SNMPProgressBar.Step = 1;
                this.SNMPProgressBar.ForeColor = Color.Blue;
                this.SNMPProgressBar.Refresh();

                this.SNMPProgressLabel.Text = String.Format("0/{0}", SNMPProgressBar.Maximum);
                this.SNMPProgressLabel.Refresh();

                int i = 1;
                int failed = 0;

                foreach (ListViewItem lsti in SnmpHostListView.Items)
                {
                    SnmpPoller snmp = new SnmpPoller(SnmpHDDResultListView, SnmpCPUResultListView, lsti.SubItems[0].Text, Convert.ToInt16(lsti.SubItems[1].Text), lsti.SubItems[2].Text, Convert.ToInt16(lsti.SubItems[3].Text), lsti.SubItems[4].Text, lsti.SubItems[5].Text);
                    snmp.HddStatsPoll();

                    lsti.SubItems[6].Text = snmp.SnmpError;
                    if (snmp.SnmpError != "")
                    {
                        failed++;
                        this.ProgressFailedLabel.Text = String.Format("{0}/{1}", failed, SNMPProgressBar.Maximum);
                    }

                    this.SNMPProgressBar.PerformStep();
                    this.SNMPProgressBar.Refresh();

                    this.SNMPProgressLabel.Text = String.Format("{0}/{1}", i, SNMPProgressBar.Maximum);
                    this.SNMPProgressLabel.Refresh();
                    i++;
                }
            }

            //Refresh
            SnmpHostListView.Refresh();
            SnmpHDDResultListView.Refresh();
            SnmpCPUResultListView.Refresh();
        }