Exemplo n.º 1
0
        public CollectorEntry()
        {
            ServiceWindows = new ServiceWindows();
            ServiceWindows.CreateFromConfig("<serviceWindows/>");
            Name                = "";
            Enabled             = true;
            UniqueId            = Guid.NewGuid().ToString();
            RemoteAgentHostPort = 8181;
            PollCount           = 0;
            RefreshCount        = 0;
            GoodStateCount      = 0;
            WarningStateCount   = 0;
            ErrorStateCount     = 0;
            LastGoodState       = null;
            LastWarningState    = null;
            LastErrorState      = null;
            StateHistorySize    = 1;
            ExpandOnStart       = true;

            //Polling overrides
            EnabledPollingOverride                 = false;
            OnlyAllowUpdateOncePerXSec             = 1;
            EnablePollFrequencySliding             = false;
            PollSlideFrequencyAfterFirstRepeatSec  = 2;
            PollSlideFrequencyAfterSecondRepeatSec = 5;
            PollSlideFrequencyAfterThirdRepeatSec  = 30;
            ConfigVariables = new List <ConfigVariable>();
        }
Exemplo n.º 2
0
        public string ToConfig()
        {
            StringBuilder configVarXml = new StringBuilder();

            configVarXml.AppendLine("<configVars>");
            foreach (ConfigVariable cv in ConfigVariables)
            {
                configVarXml.AppendLine(cv.ToXml());
            }
            configVarXml.AppendLine("</configVars>");
            string config = string.Format(Properties.Resources.NotifierEntryXml,
                                          Name.EscapeXml(),
                                          NotifierRegistrationName,
                                          Enabled,
                                          Enum.GetName(typeof(QuickMon.AlertLevel), this.AlertLevel),
                                          Enum.GetName(typeof(QuickMon.DetailLevel), this.DetailLevel),
                                          AttendedOptionOverride.ToString(),
                                          InitialConfiguration,
                                          ServiceWindows.ToConfig(),
                                          AlertForCollectorsConfig(),
                                          configVarXml.ToString()
                                          );

            return(config);
        }
Exemplo n.º 3
0
 private void EditServiceWindows_Shown(object sender, EventArgs e)
 {
     if (SelectedServiceWindows == null)
     {
         SelectedServiceWindows = new ServiceWindows();
     }
     LoadServiceWindowsTimes();
 }
Exemplo n.º 4
0
        public CollectorHost()
        {
            ServiceWindows = new ServiceWindows();
            ServiceWindows.CreateFromConfig("<serviceWindows/>");
            Name                       = "";
            Enabled                    = true;
            UniqueId                   = Guid.NewGuid().ToString();
            ParentCollectorId          = "";
            CollectorAgents            = new List <ICollector>();
            RemoteAgentHostPort        = GlobalConstants.DefaultRemoteHostPort;
            Categories                 = new List <string>();
            BlockedCollectorAgentTypes = new List <string>();
            Notes                      = "";

            //Stats
            PollCount         = 0;
            RefreshCount      = 0;
            GoodStateCount    = 0;
            WarningStateCount = 0;
            ErrorStateCount   = 0;
            LastGoodState     = null;
            LastWarningState  = null;
            LastErrorState    = null;

            //UI
            ExpandOnStartOption = QuickMon.ExpandOnStartOption.Auto;

            //Polling overrides
            EnabledPollingOverride                 = false;
            OnlyAllowUpdateOncePerXSec             = 1;
            EnablePollFrequencySliding             = false;
            PollSlideFrequencyAfterFirstRepeatSec  = 2;
            PollSlideFrequencyAfterSecondRepeatSec = 5;
            PollSlideFrequencyAfterThirdRepeatSec  = 30;
            ConfigVariables = new List <ConfigVariable>();
            ActionScripts   = new List <ActionScript>();

            //security and impersonation
            RunAs        = "";
            RunAsEnabled = false;

            //Alert Texts
            AlertHeaderText  = "";
            AlertFooterText  = "";
            ErrorAlertText   = "";
            WarningAlertText = "";
            GoodAlertText    = "";

            LastErrorCorrectiveScriptRun    = new DateTime(2000, 1, 1);
            LastWarningCorrectiveScriptRun  = new DateTime(2000, 1, 1);
            LastRestorationScriptRun        = new DateTime(2000, 1, 1);
            TimesErrorCorrectiveScriptRan   = 0;
            TimesWarningCorrectiveScriptRan = 0;
            TimesRestorationScriptRan       = 0;
        }
Exemplo n.º 5
0
 public NotifierEntry()
 {
     ServiceWindows = new ServiceWindows();
     ServiceWindows.CreateFromConfig("<serviceWindows/>");
     AlertForCollectors     = new List <string>();
     AttendedOptionOverride = AttendedOption.AttendedAndUnAttended;
     Enabled         = true;
     AlertLevel      = AlertLevel.Warning;
     DetailLevel     = DetailLevel.Detail;
     ConfigVariables = new List <ConfigVariable>();
 }
Exemplo n.º 6
0
 public NotifierHost()
 {
     Enabled                = true;
     NotifierAgents         = new List <INotifier>();
     AlertForCollectors     = new List <string>();
     ServiceWindows         = new ServiceWindows();
     Categories             = new List <string>();
     ConfigVariables        = new List <ConfigVariable>();
     AlertLevel             = QuickMon.AlertLevel.Warning;
     DetailLevel            = QuickMon.DetailLevel.Detail;
     AttendedOptionOverride = AttendedOption.AttendedAndUnAttended;
     OnlyRecordAlertOnHosts = new List <string>();
 }
Exemplo n.º 7
0
        /// <summary>
        /// Export current CollectorEntry config as XML string
        /// </summary>
        /// <returns>XML config string</returns>
        public string ToConfig()
        {
            string        collectorConfig = (InitialConfiguration == null || InitialConfiguration.Length == 0) && (Collector != null) && (Collector.AgentConfig != null) ? Collector.AgentConfig.ToConfig() : InitialConfiguration;
            StringBuilder configVarXml    = new StringBuilder();

            configVarXml.AppendLine("<configVars>");
            foreach (ConfigVariable cv in ConfigVariables)
            {
                configVarXml.AppendLine(cv.ToXml());
            }
            configVarXml.AppendLine("</configVars>");
            string config = ToConfig(UniqueId,
                                     Name.EscapeXml(),
                                     Enabled,
                                     ExpandOnStart,
                                     IsFolder,
                                     CollectorRegistrationName,
                                     ParentCollectorId,
                                     CollectOnParentWarning,
                                     RepeatAlertInXMin, AlertOnceInXMin, DelayErrWarnAlertForXSec,
                                     RepeatAlertInXPolls, AlertOnceInXPolls, DelayErrWarnAlertForXPolls,
                                     CorrectiveScriptDisabled,
                                     CorrectiveScriptOnWarningPath,
                                     CorrectiveScriptOnErrorPath,
                                     RestorationScriptPath,
                                     CorrectiveScriptsOnlyOnStateChange,
                                     EnableRemoteExecute,
                                     ForceRemoteExcuteOnChildCollectors,
                                     RemoteAgentHostAddress,
                                     RemoteAgentHostPort,
                                     BlockParentOverrideRemoteAgentHostSettings,
                                     RunLocalOnRemoteHostConnectionFailure,

                                     EnabledPollingOverride,
                                     OnlyAllowUpdateOncePerXSec,
                                     EnablePollFrequencySliding,
                                     PollSlideFrequencyAfterFirstRepeatSec,
                                     PollSlideFrequencyAfterSecondRepeatSec,
                                     PollSlideFrequencyAfterThirdRepeatSec,
                                     AlertsPaused,

                                     collectorConfig,
                                     ServiceWindows.ToConfig(),
                                     configVarXml.ToString()
                                     );

            return(config);
        }
Exemplo n.º 8
0
 public bool IsEnabledNow()
 {
     if (Enabled)
     {
         InServiceWindow = !ServiceWindows.IsInTimeWindow();
         if (!InServiceWindow)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 9
0
        public string ToConfig()
        {
            string config = string.Format(Properties.Resources.CollectorEntryXml,
                                          UniqueId,
                                          Name.EscapeXml(),
                                          Enabled,
                                          IsFolder,
                                          CollectorRegistrationName,
                                          ParentCollectorId,
                                          CollectOnParentWarning,
                                          RepeatAlertInXMin,
                                          AlertOnceInXMin,
                                          DelayErrWarnAlertForXSec,
                                          CorrectiveScriptDisabled,
                                          CorrectiveScriptOnWarningPath,
                                          CorrectiveScriptOnErrorPath,
                                          Configuration,
                                          ServiceWindows.ToConfig());

            return(config);
        }
Exemplo n.º 10
0
        public MonitorStates GetCurrentState()
        {
            if (LastMonitorState != MonitorStates.ConfigurationError)
            {
                if (IsFolder)
                {
                    if (Enabled && ServiceWindows.IsInTimeWindow())
                    {
                        CurrentState = MonitorStates.Folder;
                    }
                    else
                    {
                        CurrentState = MonitorStates.Disabled;
                    }
                }
                else
                {
                    if (Enabled && ServiceWindows.IsInTimeWindow())
                    {
                        //*********** Call actual collector GetState **********
                        CurrentState       = Collector.GetState();
                        LastMonitorDetails = Collector.LastDetailMsg;
                        if (CurrentState == MonitorStates.Good)
                        {
                            LastGoodState = DateTime.Now;
                        }
                    }
                    else
                    {
                        CurrentState = MonitorStates.Disabled;
                    }
                }
            }
            else
            {
                CurrentState = MonitorStates.ConfigurationError;
            }

            return(CurrentState);
        }
Exemplo n.º 11
0
 public AgentHostEntryBase()
 {
     ServiceWindows = new ServiceWindows();
     ServiceWindows.CreateFromConfig("<serviceWindows/>");
 }
Exemplo n.º 12
0
        public MonitorState RefreshCurrentState(bool forceRefreshNow = false)
        {
            MonitorState resultMonitorState = new MonitorState()
            {
                State = CollectorState.NotAvailable, RepeatCount = 0
            };

            if (AlertHeaderText != null && AlertHeaderText.Trim().Length > 0)
            {
                resultMonitorState.AlertHeader = AlertHeaderText;
            }
            if (AlertFooterText != null && AlertFooterText.Trim().Length > 0)
            {
                resultMonitorState.AlertFooter = AlertFooterText;
            }

            RefreshCount++;
            //CurrentPollAborted = false;
            PollingOverrideActive = false;
            if (CurrentState.State != CollectorState.ConfigurationError)
            {
                if (InServiceWindow)                     //currently in Service window
                {
                    if (ServiceWindows.IsInTimeWindow()) //Service window expired
                    {
                        InServiceWindow = false;
                        RaiseEntereringServiceWindow();
                    }
                }
                else if (!ServiceWindows.IsInTimeWindow())
                {
                    InServiceWindow = true;
                    RaiseExitingServiceWindow();
                }

                if (!Enabled)
                {
                    resultMonitorState.State      = CollectorState.Disabled;
                    StagnantStateFirstRepeat      = false;
                    StagnantStateSecondRepeat     = false;
                    StagnantStateThirdRepeat      = false;
                    resultMonitorState.RawDetails = "Collector host is disabled.";
                }
                else if (InServiceWindow)
                {
                    resultMonitorState.State      = CollectorState.NotInServiceWindow;
                    StagnantStateFirstRepeat      = false;
                    StagnantStateSecondRepeat     = false;
                    StagnantStateThirdRepeat      = false;
                    resultMonitorState.RawDetails = "Disabled due to 'out of service window' event.";
                }
                else if (CollectorAgents == null || CollectorAgents.Count == 0) //like old folder type collector
                {
                    resultMonitorState.State      = CollectorState.None;
                    StagnantStateFirstRepeat      = false;
                    StagnantStateSecondRepeat     = false;
                    StagnantStateThirdRepeat      = false;
                    resultMonitorState.RawDetails = "There are no agents.";
                }
                else if (CollectorAgents != null && CollectorAgents.Count == CollectorAgents.Count(ca => !ca.Enabled))
                {
                    resultMonitorState.State      = CollectorState.Disabled;
                    StagnantStateFirstRepeat      = false;
                    StagnantStateSecondRepeat     = false;
                    StagnantStateThirdRepeat      = false;
                    resultMonitorState.RawDetails = "Disabled because all agents are disabled.";
                }
                else if (CurrentState.State != CollectorState.NotAvailable && !forceRefreshNow && EnabledPollingOverride && !EnablePollFrequencySliding &&
                         (LastStateUpdate.AddSeconds(OnlyAllowUpdateOncePerXSec) > DateTime.Now))
                {
                    //Not time yet for update
                    PollingOverrideActive = true;
                    //CurrentPollAborted = true;
                    //repeat same State
                    resultMonitorState = null;
                    resultMonitorState = CurrentState;
                    //resultMonitorState.Timestamp = DateTime.Now;

                    //if (resultMonitorState.RawDetails == null)
                    //    resultMonitorState.RawDetails = "";
                    //if (resultMonitorState.RawDetails.Length > 0)
                    //    resultMonitorState.RawDetails += "\r\n";
                    //resultMonitorState.RawDetails += "Due to polling override (OnlyAllowUpdateOncePerXSec) the previous state is repeated.";

                    //resultMonitorState.State = CurrentState.State;
                    //resultMonitorState.CurrentValue = CurrentState.ReadValues();
                    //resultMonitorState.RawDetails = "Due to polling override (OnlyAllowUpdateOncePerXSec) the previous state is repeated.";
                    RaiseLoggingPollingOverridesTriggeredEvent(string.Format("Polling override of {0} seconds not reached yet", OnlyAllowUpdateOncePerXSec));
                }
                else if (CurrentState.State != CollectorState.NotAvailable && !forceRefreshNow && EnabledPollingOverride && EnablePollFrequencySliding &&
                         !StagnantStateFirstRepeat && !StagnantStateThirdRepeat && !StagnantStateSecondRepeat &&
                         LastStateUpdate.AddSeconds(OnlyAllowUpdateOncePerXSec - 1) > DateTime.Now)
                {
                    PollingOverrideActive    = true;
                    resultMonitorState       = null;
                    resultMonitorState       = CurrentState;
                    StagnantStateFirstRepeat = true;
                    LastStateUpdate          = DateTime.Now;
                }
                else if (CurrentState.State != CollectorState.NotAvailable && !forceRefreshNow && EnabledPollingOverride && EnablePollFrequencySliding &&
                         StagnantStateFirstRepeat && !StagnantStateThirdRepeat && !StagnantStateSecondRepeat &&
                         LastStateUpdate.AddSeconds(PollSlideFrequencyAfterFirstRepeatSec - 1) > DateTime.Now)
                {
                    PollingOverrideActive     = true;
                    resultMonitorState        = null;
                    resultMonitorState        = CurrentState;
                    StagnantStateFirstRepeat  = true;
                    StagnantStateSecondRepeat = true;
                    LastStateUpdate           = DateTime.Now;
                }
                else if (CurrentState.State != CollectorState.NotAvailable && !forceRefreshNow && EnabledPollingOverride && EnablePollFrequencySliding &&
                         StagnantStateFirstRepeat && StagnantStateThirdRepeat && !StagnantStateSecondRepeat &&
                         LastStateUpdate.AddSeconds(PollSlideFrequencyAfterSecondRepeatSec - 1) > DateTime.Now)
                {
                    PollingOverrideActive     = true;
                    resultMonitorState        = null;
                    resultMonitorState        = CurrentState;
                    StagnantStateFirstRepeat  = true;
                    StagnantStateSecondRepeat = true;
                    StagnantStateThirdRepeat  = true;
                    LastStateUpdate           = DateTime.Now;
                }
                else if (CurrentState.State != CollectorState.NotAvailable && !forceRefreshNow && EnabledPollingOverride && EnablePollFrequencySliding &&
                         StagnantStateFirstRepeat && StagnantStateThirdRepeat && StagnantStateSecondRepeat &&
                         LastStateUpdate.AddSeconds(PollSlideFrequencyAfterThirdRepeatSec - 1) > DateTime.Now)
                {
                    PollingOverrideActive     = true;
                    resultMonitorState        = null;
                    resultMonitorState        = CurrentState;
                    StagnantStateFirstRepeat  = true;
                    StagnantStateSecondRepeat = true;
                    StagnantStateThirdRepeat  = true;
                    if (!stagnantStateMaxReached)
                    {
                        LastStateUpdate         = DateTime.Now;
                        stagnantStateMaxReached = true;
                    }
                }



                //else if (CurrentState.State != CollectorState.NotAvailable && !forceRefreshNow && EnabledPollingOverride && EnablePollFrequencySliding &&
                //    (
                //        (StagnantStateThirdRepeat && (LastStateUpdate.AddSeconds(PollSlideFrequencyAfterThirdRepeatSec) > DateTime.Now)) ||
                //        (!StagnantStateThirdRepeat && StagnantStateSecondRepeat && (LastStateUpdate.AddSeconds(PollSlideFrequencyAfterSecondRepeatSec) > DateTime.Now)) ||
                //        (!StagnantStateThirdRepeat && !StagnantStateSecondRepeat && StagnantStateFirstRepeat && (LastStateUpdate.AddSeconds(PollSlideFrequencyAfterFirstRepeatSec) > DateTime.Now)) ||
                //        (!StagnantStateFirstRepeat && !StagnantStateThirdRepeat && !StagnantStateSecondRepeat && (LastStateUpdate.AddSeconds(OnlyAllowUpdateOncePerXSec) > DateTime.Now))
                //    )
                //   )
                //{
                //    //Not time yet for update
                //    //CurrentPollAborted = true;
                //    //repeat same State
                //    resultMonitorState = null;
                //    resultMonitorState = CurrentState.Clone();
                //    resultMonitorState.Timestamp = DateTime.Now;

                //    //if (resultMonitorState.RawDetails == null)
                //    //    resultMonitorState.RawDetails = "";
                //    //if (resultMonitorState.RawDetails.Length > 0)
                //    //    resultMonitorState.RawDetails += "\r\n";

                //    //resultMonitorState.State = CurrentState.State;
                //    //resultMonitorState.CurrentValue = CurrentState.ReadValues();
                //    //if (StagnantStateThirdRepeat)
                //    //    resultMonitorState.RawDetails += "Due to polling override (StagnantStateThirdRepeat) the previous state is repeated.";
                //    //else if (StagnantStateSecondRepeat)
                //    //    resultMonitorState.RawDetails += "Due to polling override (StagnantStateSecondRepeat) the previous state is repeated.";
                //    //else if (StagnantStateFirstRepeat)
                //    //    resultMonitorState.RawDetails += "Due to polling override (StagnantStateFirstRepeat) the previous state is repeated.";
                //    //else
                //    //    resultMonitorState.RawDetails += "Due to polling override (EnablePollFrequencySliding) the previous state is repeated.";
                //}
                else
                {
                    stagnantStateMaxReached = false;
                    //*********** Call actual collector GetState **********
                    LastStateCheckAttemptBegin = DateTime.Now;
                    System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
                    //Applies config vars to Initial configs of agents (on the run)
                    ApplyConfigVarsNow();
                    sw.Start();

                    //first check if remote host exection is required
                    if (EnableRemoteExecute || (OverrideRemoteAgentHost && !BlockParentOverrideRemoteAgentHostSettings))
                    {
                        resultMonitorState = GetRemoteState();
                    }
                    else if (!RunAsEnabled || RunAs == null || RunAs.Length == 0 || RunTimeUserNameCacheFile == null || RunTimeUserNameCacheFile.Length == 0 || RunTimeMasterKey == null || RunTimeMasterKey.Length == 0)
                    {
                        resultMonitorState = GetStateFromLocalCurrentUser();
                    }
                    else
                    {
                        resultMonitorState = GetStateFromLocal();
                    }
                    sw.Stop();
                    resultMonitorState.CallDurationMS = (int)sw.ElapsedMilliseconds;
                    RaiseAllAgentsExecutionTime(sw.ElapsedMilliseconds);

                    #region Calculate summarized state
                    if (resultMonitorState.ChildStates != null && resultMonitorState.ChildStates.Count > 0)
                    {
                        int allCount      = resultMonitorState.ChildStates.Count;
                        int disabledCount = (from cs in resultMonitorState.ChildStates
                                             where cs.State == CollectorState.Disabled
                                             select cs).Count();
                        int goodCount = (from cs in resultMonitorState.ChildStates
                                         where cs.State == CollectorState.Good
                                         select cs).Count();
                        int warningCount = (from cs in resultMonitorState.ChildStates
                                            where cs.State == CollectorState.Warning
                                            select cs).Count();
                        int errorCount = (from cs in resultMonitorState.ChildStates
                                          where cs.State == CollectorState.Error
                                          select cs).Count();

                        if (allCount == disabledCount)
                        {
                            resultMonitorState.State = CollectorState.Disabled;
                        }
                        else if (AgentCheckSequence == QuickMon.AgentCheckSequence.All)
                        {
                            if (allCount - disabledCount == goodCount)
                            {
                                resultMonitorState.State = CollectorState.Good;
                            }
                            else if (allCount - disabledCount == errorCount)
                            {
                                resultMonitorState.State = CollectorState.Error;
                            }
                            else
                            {
                                resultMonitorState.State = CollectorState.Warning;
                            }
                        }
                        else if (AgentCheckSequence == QuickMon.AgentCheckSequence.FirstSuccess)
                        {
                            if (goodCount > 0)
                            {
                                resultMonitorState.State = CollectorState.Good;
                            }
                            else if (warningCount > 0)
                            {
                                resultMonitorState.State = CollectorState.Warning;
                            }
                            else
                            {
                                resultMonitorState.State = CollectorState.Error;
                            }
                        }
                        else
                        {
                            if (errorCount > 0)
                            {
                                resultMonitorState.State = CollectorState.Error;
                            }
                            else if (warningCount > 0)
                            {
                                resultMonitorState.State = CollectorState.Warning;
                            }
                            else
                            {
                                resultMonitorState.State = CollectorState.Good;
                            }
                        }
                    }
                    #endregion
                }
            }
            else
            {
                resultMonitorState.State = CollectorState.ConfigurationError;
            }

            //Set current CH state plus raise any alerts if required
            // if (!PollingOverrideActive)
            SetCurrentState(resultMonitorState);
            return(resultMonitorState);
        }
Exemplo n.º 13
0
        /// <summary>
        /// Export current NotifierHost config as XML string
        /// </summary>
        /// <returns>XML config string</returns>
        public string ToXml()
        {
            StringBuilder configXml = new StringBuilder();

            configXml.AppendLine(string.Format("<notifierHost name=\"{0}\" enabled=\"{1}\" alertLevel=\"{2}\" " +
                                               "detailLevel=\"{3}\" attendedOptionOverride=\"{4}\">\r\n",
                                               Name.EscapeXml(), Enabled, AlertLevel, DetailLevel, AttendedOptionOverride));

            configXml.AppendLine("<!-- collectorHosts -->");
            if (AlertForCollectors == null || AlertForCollectors.Count == 0)
            {
                configXml.AppendLine("<collectorHosts />");
            }
            else
            {
                configXml.AppendLine("<collectorHosts>");
                foreach (string collectorHostName in AlertForCollectors)
                {
                    configXml.AppendLine(string.Format("<collectorHost name=\"{0}\" />", collectorHostName.EscapeXml()));
                }
                configXml.AppendLine("</collectorHosts>");
            }
            configXml.AppendLine("<!-- ServiceWindows -->");
            configXml.AppendLine(ServiceWindows.ToXml());

            configXml.AppendLine("<!-- Categories -->");
            configXml.AppendLine(GetCategoriesXML());

            configXml.AppendLine("<!-- Config variables -->");
            if (ConfigVariables == null || ConfigVariables.Count == 0)
            {
                configXml.AppendLine("<configVars />");
            }
            else
            {
                configXml.AppendLine("<configVars>");
                foreach (ConfigVariable cv in ConfigVariables)
                {
                    configXml.AppendLine(cv.ToXml());
                }
                configXml.AppendLine("</configVars>");
            }

            if (OnlyRecordAlertOnHosts != null && OnlyRecordAlertOnHosts.Count > 0)
            {
                configXml.AppendLine("<recordOnHosts>");
                foreach (string host in OnlyRecordAlertOnHosts)
                {
                    configXml.AppendLine(string.Format("<host name=\"{0}\" />", host.EscapeXml()));
                }
                configXml.AppendLine("</recordOnHosts>");
            }
            else
            {
                configXml.AppendLine("<recordOnHosts />");
            }

            configXml.AppendLine("<!-- notifierAgents -->");
            configXml.AppendLine("<notifierAgents>");
            foreach (INotifier notifierAgent in NotifierAgents)
            {
                configXml.AppendLine(string.Format("<notifierAgent name=\"{0}\" type=\"{1}\" enabled=\"{2}\">",
                                                   notifierAgent.Name.EscapeXml(), notifierAgent.AgentClassName.EscapeXml(), notifierAgent.Enabled));
                configXml.AppendLine(notifierAgent.AgentConfig.ToXml());
                configXml.AppendLine("</notifierAgent>");
            }
            configXml.AppendLine("</notifierAgents>");
            configXml.AppendLine("</notifierHost>");
            return(configXml.ToString());
        }