示例#1
0
        public AddServer(String monitorName, String remoteIpOrHostName, FullMonitorType tab,
                         MonitorBaseType baseTab, IEnumerable<CAlert> defaultAlerts)
        {
            InitializeComponent();
            perfCounterPCTypeDdl.Visible = false;
            perfCounterCategoryWaitLabel.Visible = true;
            perfCounterCounterNameDdl.Visible = false;
            perfCounterCounterNameWaitLabel.Visible = true;
            perfCounterInstanceNameDdl.Visible = false;
            perfCounterInstanceNameWaitLabel.Visible = true;

            foreach(CAlert c in defaultAlerts)
            {
                switch(c.Type)
                {
                    case AlertType.Email:
                        addServerAlertEmailTextBox.Text = c.Info;
                        break;
                    case AlertType.Phone:
                        addServerAlertSmsTextBox.Text = c.Info;
                        break;
                }

            }
            //NOTE:MonitorName should be the hostname if for some reason HostName isn't populated
            //_hostName = (hostName == "" ? Environment.MachineName : (hostName != "" ? hostName : monitorName));
            IpOrHostName = remoteIpOrHostName == "" ? Environment.MachineName : remoteIpOrHostName;
            FriendlyName = monitorName == "" ? Environment.MachineName + " " + tab : monitorName;

            switch (tab)
            {
                #region cases

                default:
                case FullMonitorType.None:
                case FullMonitorType.PerformanceCounter:
                    _perfCounterPopulation = new Thread(GetPerfCounterTypes) {Name = "PerformanceCounter Start"};
                    _perfCounterPopulation.Start();
                    addServerBaseTabControl.SelectedIndex = (int) baseTab;
                    addServerTabControl.SelectedIndex = (int) tab;
                    break;
                case FullMonitorType.Service:
                    _serviceMonitorPopulation = new Thread(GetServices) {Name = "ServiceMonitor Start"};
                    _serviceMonitorPopulation.Start();
                    addServerBaseTabControl.SelectedIndex = (int) baseTab;
                    addServerTabControl.SelectedIndex = (int) tab;
                    break;
                case FullMonitorType.EventLog:
                    _eventMonitorPopulation = new Thread(GetEvents) {Name = "EventMonitor Start"};
                    _eventMonitorPopulation.Start();
                    addServerBaseTabControl.SelectedIndex = (int) baseTab;
                    addServerTabControl.SelectedIndex = (int) tab;
                    break;
                case FullMonitorType.Basic:
                    //_basicMonitorPopulation = new Thread(GetBasics) {Name = "BasicMonitor Start"};
                    //_basicMonitorPopulation.Start();
                    addServerBaseTabControl.SelectedIndex = (int) baseTab;
                    //addServerTabControl.SelectedIndex = (int) tab;
                    break;
                case FullMonitorType.Common:
                    //commonBaseTab.Focus();
                    //commonBaseTab.Select();
                    _commonMonitorPopulation = new Thread(GetCommon) {Name = "CommonMonitor Start"};
                    _commonMonitorPopulation.Start();
                    addServerBaseTabControl.SelectedIndex = (int) baseTab;
                    break;
                #endregion
            }

            ReturnValue = FullMonitorType.None;
        }
示例#2
0
 private void AddSelServerShow(FullMonitorType tab, MonitorBaseType baseTab)
 {
     AddServer addserver = new AddServer(serverBrowser.SelectedNode.Text, serverBrowser.SelectedNode.Text, tab,
                                         baseTab, configurationData.Settings.DefaultAlerts);
     AddOwnedForm(addserver);
     addserver.Show();
 }
示例#3
0
        public AddServer(String monitorName, String remoteIpOrHostName, FullMonitorType tab,
                         MonitorBaseType baseTab, IEnumerable<CAlert> defaultAlerts, IMonitor repopulateMonitor)
        {
            InitializeComponent();
            perfCounterPCTypeDdl.Visible = false;
            perfCounterCategoryWaitLabel.Visible = true;
            perfCounterCounterNameDdl.Visible = false;
            perfCounterCounterNameWaitLabel.Visible = true;
            perfCounterInstanceNameDdl.Visible = false;
            perfCounterInstanceNameWaitLabel.Visible = true;

            foreach (CAlert c in defaultAlerts)
            {
                switch (c.Type)
                {
                    case AlertType.Email:
                        addServerAlertEmailTextBox.Text = c.Info;
                        break;
                    case AlertType.Phone:
                        addServerAlertSmsTextBox.Text = c.Info;
                        break;
                }

            }
            //NOTE:MonitorName should be the hostname if for some reason HostName isn't populated
            //_hostName = (hostName == "" ? Environment.MachineName : (hostName != "" ? hostName : monitorName));
            IpOrHostName = remoteIpOrHostName == "" ? Environment.MachineName : remoteIpOrHostName;
            FriendlyName = monitorName == "" ? Environment.MachineName + " " + tab : monitorName;

            switch (repopulateMonitor.Type)
            {
                #region cases
                case FullMonitorType.PerformanceCounter:
                    addServerBaseTabControl.SelectedIndex = (int)baseTab;
                    addServerTabControl.SelectedIndex = (int)tab;
                    if (repopulateMonitor.Common)
                    {
                        CommonRepopulate(repopulateMonitor);
                        ReturnValue = FullMonitorType.Common;
                    }
                    else
                    {
                        ReturnValue = repopulateMonitor.Type;
                        PerfCounterRepopulate((PfcMonitor)repopulateMonitor);
                    }
                    break;
                case FullMonitorType.Service:
                    addServerBaseTabControl.SelectedIndex = (int)baseTab;
                    addServerTabControl.SelectedIndex = (int)tab;
                    if (repopulateMonitor.Common)
                    {
                        CommonRepopulate(repopulateMonitor);
                        ReturnValue = FullMonitorType.Common;
                    }
                    else
                    {
                        ReturnValue = repopulateMonitor.Type;
                        ServiceRepopulate((ServiceMonitor)repopulateMonitor);
                    }
                    break;
                case FullMonitorType.EventLog:
                    addServerBaseTabControl.SelectedIndex = (int)baseTab;
                    addServerTabControl.SelectedIndex = (int)tab;
                    if (repopulateMonitor.Common)
                    {
                        CommonRepopulate(repopulateMonitor);
                        ReturnValue = FullMonitorType.Common;
                    }
                    else
                    {
                        ReturnValue = repopulateMonitor.Type;
                        EventRepopulate((EventMonitor) repopulateMonitor);
                    }
                    break;
                case FullMonitorType.Basic:
                    addServerBaseTabControl.SelectedIndex = (int)baseTab;
                    BasicRepopulate((BasicMonitor)repopulateMonitor);
                    ReturnValue = repopulateMonitor.Type;
                    break;
                case FullMonitorType.Common:
                    addServerBaseTabControl.SelectedIndex = (int)baseTab;
                    if (repopulateMonitor.Common)
                    {
                        CommonRepopulate(repopulateMonitor);
                        ReturnValue = FullMonitorType.Common;
                    }
                    else
                        ReturnValue = repopulateMonitor.Type;
                    break;
                case FullMonitorType.Wmi:
                    addServerBaseTabControl.SelectedIndex = (int)baseTab;
                    if (repopulateMonitor.Common)
                    {
                        CommonRepopulate(repopulateMonitor);
                        ReturnValue = FullMonitorType.Common;
                    }
                    else
                        ReturnValue = repopulateMonitor.Type;
                    break;
                default:
                case FullMonitorType.None:
                    Logger.Instance.Log(this.GetType(), LogType.Debug, "AddServer: Unable to match Monitor Type");
                    this.Close();
                    break;
                    #endregion
            }
        }
示例#4
0
 private void AddNewServerShow(FullMonitorType tab, MonitorBaseType baseTab)
 {
     AddServer addserver = new AddServer(String.Empty, String.Empty, tab, baseTab, configurationData.Settings.DefaultAlerts);
     AddOwnedForm(addserver);
     addserver.Show();
 }