Пример #1
0
        public PerfmonAlertEditPage()
        {
            InitializeComponent();
            Text = Messages.ALERTS;

            m_invalidParamToolTip = new ToolTip
            {
                IsBalloon    = true,
                ToolTipIcon  = ToolTipIcon.Warning,
                ToolTipTitle = Messages.INVALID_PARAMETER
            };

            ////xapi trigger level is a fraction; gui shows percentage
            cpuAlert = new AlertGroup(CPUAlertCheckBox, CpuGroupBox,
                                      nudCPUUsagePercent, nudCPUDurationThreshold, nudAlertInterval,
                                      new[] { cpuMinutesLabel, cpuPercentLabel, CPUUsagePercentLabel, CPUDurationThresholdLabel })
            {
                AlertEnablementChanged = SetAlertIntervalEnablement,
                SubTextFormat          = Messages.ALERT_CPUS_SUB_TEXT,
                PerfmonDefinitionName  = PerfmonDefinition.ALARM_TYPE_CPU,
                XapiToGuiTriggerLevel  = (num => num * 100),
                XapiToGuiTriggerPeriod = (num => num / 60),
                XapiToGuiAlertInterval = (num => num / 60),
                GuiToXapiTriggerLevel  = (num => num / 100),
                GuiToXapiTriggerPeriod = (num => num * 60),
                GuiToXapiAlertInterval = (num => num * 60),
            };

            //xapi trigger level is in B/s; gui shows KB/s
            netAlert = new AlertGroup(NetAlertCheckBox, NetGroupBox,
                                      nudNetUsagePercent, nudNetDurationThreshold, nudAlertInterval,
                                      new[] { NetMinutesLabel, NetPercentLabel, NetUsagePercentLabel, NetDurationThresholdLabel })
            {
                AlertEnablementChanged = SetAlertIntervalEnablement,
                SubTextFormat          = Messages.ALERT_NET_SUB_TEXT,
                PerfmonDefinitionName  = PerfmonDefinition.ALARM_TYPE_NETWORK,
                XapiToGuiTriggerLevel  = (num => num / 1024),
                XapiToGuiTriggerPeriod = (num => num / 60),
                XapiToGuiAlertInterval = (num => num / 60),
                GuiToXapiTriggerLevel  = (num => num * 1024),
                GuiToXapiTriggerPeriod = (num => num * 60),
                GuiToXapiAlertInterval = (num => num * 60),
            };

            //xapi trigger level is in B/s; gui shows KB/s
            diskAlert = new AlertGroup(DiskAlertCheckBox, DiskGroupBox,
                                       nudDiskUsagePercent, nudDiskDurationThreshold, nudAlertInterval,
                                       new[] { DiskMinutesLabel, DiskPercentLabel, DiskUsagePercentLabel, DiskDurationThresholdLabel })
            {
                AlertEnablementChanged = SetAlertIntervalEnablement,
                SubTextFormat          = Messages.ALERT_DISK_SUB_TEXT,
                PerfmonDefinitionName  = PerfmonDefinition.ALARM_TYPE_DISK,
                XapiToGuiTriggerLevel  = (num => num / 1024),
                XapiToGuiTriggerPeriod = (num => num / 60),
                XapiToGuiAlertInterval = (num => num / 60),
                GuiToXapiTriggerLevel  = (num => num * 1024),
                GuiToXapiTriggerPeriod = (num => num * 60),
                GuiToXapiAlertInterval = (num => num * 60),
            };

            //xapi trigger level is in kiB; gui shows MB
            memoryAlert = new AlertGroup(MemoryAlertCheckBox, MemoryGroupBox,
                                         nudMemoryUsage, nudMemoryDurationThreshold, nudAlertInterval,
                                         new[] { memoryMinutesLabel, memoryUsageLabel, memoryUnitsLabel, memoryDurationThresholdLabel })
            {
                AlertEnablementChanged = SetAlertIntervalEnablement,
                SubTextFormat          = Messages.ALERT_MEMORY_SUB_TEXT,
                PerfmonDefinitionName  = PerfmonDefinition.ALARM_TYPE_MEMORY,
                XapiToGuiTriggerLevel  = (num => num / 1024),
                XapiToGuiTriggerPeriod = (num => num / 60),
                XapiToGuiAlertInterval = (num => num / 60),
                GuiToXapiTriggerLevel  = (num => num * 1024),
                GuiToXapiTriggerPeriod = (num => num * 60),
                GuiToXapiAlertInterval = (num => num * 60),
            };

            //xapi trigger level is in MiB/s; gui shows KB/s
            srAlert = new AlertGroup(SrAlertCheckBox, SrGroupBox,
                                     nudSrUsage, nudSrMinutes, nudAlertInterval,
                                     new[] { SrUsageLabel, srMinutesLabel, srUnitsLabel, SrDurationThresholdLabel })
            {
                AlertEnablementChanged = SetAlertIntervalEnablement,
                SubTextFormat          = Messages.ALERT_SR_SUB_TEXT,
                PerfmonDefinitionName  = PerfmonDefinition.ALARM_TYPE_SR,
                XapiToGuiTriggerLevel  = (num => num * 1024),
                XapiToGuiTriggerPeriod = (num => num / 60),
                XapiToGuiAlertInterval = (num => num / 60),
                GuiToXapiTriggerLevel  = (num => num / 1024),
                GuiToXapiTriggerPeriod = (num => num * 60),
                GuiToXapiAlertInterval = (num => num * 60),
            };

            cpuAlert.ToggleAlertGroupEnablement();
            netAlert.ToggleAlertGroupEnablement();
            diskAlert.ToggleAlertGroupEnablement();
            memoryAlert.ToggleAlertGroupEnablement();
            srAlert.ToggleAlertGroupEnablement();
        }
Пример #2
0
        public PerfmonAlertEditPage()
        {
            InitializeComponent();
            Text = Messages.ALERTS;

            m_invalidParamToolTip = new ToolTip
                {
                    IsBalloon = true,
                    ToolTipIcon = ToolTipIcon.Warning,
                    ToolTipTitle = Messages.INVALID_PARAMETER
                };

            ////xapi trigger level is a fraction; gui shows percentage
            cpuAlert = new AlertGroup(CPUAlertCheckBox, CpuGroupBox,
                nudCPUUsagePercent, nudCPUDurationThreshold, nudAlertInterval,
                new[] { cpuMinutesLabel, cpuPercentLabel, CPUUsagePercentLabel, CPUDurationThresholdLabel })
                {
                    AlertEnablementChanged = SetAlertIntervalEnablement,
                    SubTextFormat = Messages.ALERT_CPUS_SUB_TEXT,
                    PerfmonDefinitionName = PerfmonDefinition.ALARM_TYPE_CPU,
                    XapiToGuiTriggerLevel = (num => num * 100),
                    XapiToGuiTriggerPeriod = (num => num / 60),
                    XapiToGuiAlertInterval = (num => num / 60),
                    GuiToXapiTriggerLevel = (num => num / 100),
                    GuiToXapiTriggerPeriod = (num => num * 60),
                    GuiToXapiAlertInterval = (num => num * 60),
                };

            //xapi trigger level is in B/s; gui shows KB/s
            netAlert = new AlertGroup(NetAlertCheckBox, NetGroupBox,
                nudNetUsagePercent, nudNetDurationThreshold, nudAlertInterval,
                new[] { NetMinutesLabel, NetPercentLabel, NetUsagePercentLabel, NetDurationThresholdLabel })
                {
                    AlertEnablementChanged = SetAlertIntervalEnablement,
                    SubTextFormat = Messages.ALERT_NET_SUB_TEXT,
                    PerfmonDefinitionName = PerfmonDefinition.ALARM_TYPE_NETWORK,
                    XapiToGuiTriggerLevel = (num => num / 1024),
                    XapiToGuiTriggerPeriod = (num => num / 60),
                    XapiToGuiAlertInterval = (num => num / 60),
                    GuiToXapiTriggerLevel = (num => num * 1024),
                    GuiToXapiTriggerPeriod = (num => num * 60),
                    GuiToXapiAlertInterval = (num => num * 60),
                };

            //xapi trigger level is in B/s; gui shows KB/s
            diskAlert = new AlertGroup(DiskAlertCheckBox, DiskGroupBox,
                nudDiskUsagePercent, nudDiskDurationThreshold, nudAlertInterval,
                new[] { DiskMinutesLabel, DiskPercentLabel, DiskUsagePercentLabel, DiskDurationThresholdLabel })
                {
                    AlertEnablementChanged = SetAlertIntervalEnablement,
                    SubTextFormat = Messages.ALERT_DISK_SUB_TEXT,
                    PerfmonDefinitionName = PerfmonDefinition.ALARM_TYPE_DISK,
                    XapiToGuiTriggerLevel = (num => num / 1024),
                    XapiToGuiTriggerPeriod = (num => num / 60),
                    XapiToGuiAlertInterval = (num => num / 60),
                    GuiToXapiTriggerLevel = (num => num * 1024),
                    GuiToXapiTriggerPeriod = (num => num * 60),
                    GuiToXapiAlertInterval = (num => num * 60),
                };

            //xapi trigger level is in kiB; gui shows MB
            memoryAlert = new AlertGroup(MemoryAlertCheckBox, MemoryGroupBox,
                nudMemoryUsage, nudMemoryDurationThreshold, nudAlertInterval,
                new[] { memoryMinutesLabel, memoryUsageLabel, memoryUnitsLabel, memoryDurationThresholdLabel })
                {
                    AlertEnablementChanged = SetAlertIntervalEnablement,
                    SubTextFormat = Messages.ALERT_MEMORY_SUB_TEXT,
                    PerfmonDefinitionName = PerfmonDefinition.ALARM_TYPE_MEMORY_FREE,
                    XapiToGuiTriggerLevel = (num => num / 1024),
                    XapiToGuiTriggerPeriod = (num => num / 60),
                    XapiToGuiAlertInterval = (num => num / 60),
                    GuiToXapiTriggerLevel = (num => num * 1024),
                    GuiToXapiTriggerPeriod = (num => num * 60),
                    GuiToXapiAlertInterval = (num => num * 60),
                };

            //xapi trigger level is in MiB/s; gui shows KB/s
            srAlert = new AlertGroup(SrAlertCheckBox, SrGroupBox,
                nudSrUsage, nudSrMinutes, nudAlertInterval,
                new[] { SrUsageLabel, srMinutesLabel, srUnitsLabel, SrDurationThresholdLabel })
                {
                    AlertEnablementChanged = SetAlertIntervalEnablement,
                    SubTextFormat = Messages.ALERT_SR_SUB_TEXT,
                    PerfmonDefinitionName = PerfmonDefinition.ALARM_TYPE_SR,
                    XapiToGuiTriggerLevel = (num => num * 1024),
                    XapiToGuiTriggerPeriod = (num => num / 60),
                    XapiToGuiAlertInterval = (num => num / 60),
                    GuiToXapiTriggerLevel = (num => num / 1024),
                    GuiToXapiTriggerPeriod = (num => num * 60),
                    GuiToXapiAlertInterval = (num => num * 60),
                };


            dom0MemoryAlert = new AlertGroup(Dom0MemoryAlertCheckBox, Dom0MemoryUsageGroupBox,
                nudDom0MemUsage, nudDom0MemoryDurationThreshold, nudAlertInterval,
                new[] { dom0MemoryMinutesLabel, dom0MemoryPercentLabel, Dom0MemoryUsagePercentLabel, Dom0MemoryDurationThresholdLabel })
            {
                AlertEnablementChanged = SetAlertIntervalEnablement,
                SubTextFormat = Messages.ALERT_DOM0_MEMORY_SUB_TEXT,
                PerfmonDefinitionName = PerfmonDefinition.ALARM_TYPE_MEMORY_DOM0_USAGE,
                XapiToGuiTriggerLevel = (num => num * 100),
                XapiToGuiTriggerPeriod = (num => num / 60),
                XapiToGuiAlertInterval = (num => num / 60),
                GuiToXapiTriggerLevel = (num => num / 100),
                GuiToXapiTriggerPeriod = (num => num * 60),
                GuiToXapiAlertInterval = (num => num * 60),
            };

            physicalUtilisationAlert = new AlertGroup(physicalUtilisationAlertCheckBox, PhysicalUtilisationGroupBox,
                nudPhysicalUtilisation, nudPhysicalUtilisationDurationThreshold, nudAlertInterval,
                new[] { physicalUtilisationLabel, physicalUtilisationDurationLabel, physicalUtilisationPercentLabel, physicalUtilisationMinutesLabel })
            {
                AlertEnablementChanged = SetAlertIntervalEnablement,
                SubTextFormat = Messages.ALERT_SR_PHYSICAL_UTILISATION_SUB_TEXT,
                PerfmonDefinitionName = PerfmonDefinition.ALARM_TYPE_SR_PHYSICAL_UTILISATION,
                XapiToGuiTriggerLevel = (num => num * 100),
                XapiToGuiTriggerPeriod = (num => num / 60),
                XapiToGuiAlertInterval = (num => num / 60),
                GuiToXapiTriggerLevel = (num => num / 100),
                GuiToXapiTriggerPeriod = (num => num * 60),
                GuiToXapiAlertInterval = (num => num * 60),
            };
            
            cpuAlert.ToggleAlertGroupEnablement();
            netAlert.ToggleAlertGroupEnablement();
            diskAlert.ToggleAlertGroupEnablement();
            memoryAlert.ToggleAlertGroupEnablement();
            srAlert.ToggleAlertGroupEnablement();
            dom0MemoryAlert.ToggleAlertGroupEnablement();
            physicalUtilisationAlert.ToggleAlertGroupEnablement();
        }