private void cmdTest_Click(object sender, EventArgs e) { string configXml = txtConfig.Text; //"<monitorPack version=\"4.0.0\" name=\"Test\" typeName=\"TestType\" enabled=\"True\" " + // "defaultNotifier=\"Default notifiers\" runCorrectiveScripts=\"True\" " + // "stateHistorySize=\"100\" pollingFreqSecOverride=\"12\">\r\n" + // "<configVars />\r\n" + // "<collectorHosts>\r\n"; //configXml += txtConfig.Text; //configXml += "</collectorHosts>" + // "<notifierHosts>\r\n" + // "<notifierHost name=\"AudioNotifier\" enabled=\"True\" alertLevel=\"Warning\" detailLevel=\"Detail\" " + // "attendedOptionOverride=\"OnlyAttended\">\r\n" + // "<notifierAgents>\r\n" + // "<notifierAgent type=\"AudioNotifier\">\r\n" + // "<config>\r\n" + // "<audioConfig>\r\n" + // "<goodState enabled=\"false\" useSystemSounds=\"true\" soundPath=\"\" systemSound=\"1\" soundRepeatCount=\"1\" soundVolumePerc=\"-1\" />\r\n" + // "<warningState enabled=\"true\" useSystemSounds=\"true\" soundPath=\"\" systemSound=\"3\" soundRepeatCount=\"1\" soundVolumePerc=\"-1\" />\r\n" + // "<errorState enabled=\"true\" useSystemSounds=\"true\" soundPath=\"\" systemSound=\"2\" soundRepeatCount=\"1\" soundVolumePerc=\"-1\" />\r\n" + // "</audioConfig>\r\n" + // "</config>\r\n" + // "</notifierAgent>\r\n" + // "</notifierAgents>\r\n" + // "</notifierHost>\r\n" + // "</notifierHosts>\r\n" + // "</monitorPack>"; MonitorPack m = new MonitorPack(); m.LoadXml(configXml); m.RefreshStates(); StringBuilder sb = new StringBuilder(); sb.AppendLine(string.Format("Global state: {0}", m.CurrentState)); sb.AppendLine(new string('*', 30)); foreach (CollectorHost ch in m.CollectorHosts) { MonitorState ms = ch.CurrentState; sb.AppendLine(string.Format("Collector host: {0}", ch.Name)); sb.AppendLine(string.Format("Time: {0}", ms.Timestamp.ToString("yyyy-MM-dd HH:mm:ss"))); sb.AppendLine(string.Format("Duration: {0}ms", ms.CallDurationMS)); sb.AppendLine(string.Format("Run on host: {0}", ms.ExecutedOnHostComputer)); sb.AppendLine(string.Format("State: {0}", ms.State)); sb.AppendLine("DETAILS (agents)"); sb.AppendLine(string.Format("{0}", XmlFormattingUtils.NormalizeXML(ms.ReadAllRawDetails()))); //sb.AppendLine(string.Format("\t\tState: {0}\r\n{1}", ms.State, XmlFormattingUtils.NormalizeXML(ms.ReadAllRawDetails('\t', 3)))); sb.AppendLine(new string('*', 30)); } MessageBox.Show(sb.ToString(), "Result", MessageBoxButtons.OK, MessageBoxIcon.Information); }
public MonitorState GetState(CollectorEntryRequest entry) { MonitorState monitorState = new MonitorState(); StringBuilder plainTextDetails = new StringBuilder(); StringBuilder htmlTextTextDetails = new StringBuilder(); Console.WriteLine("{0}: Running collector: {1}", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), entry.Name); try { string tempMonitorPack = "<monitorPack version=\"3.0.0.0\" name=\"\" enabled=\"True\" defaultViewerNotifier=\"\" runCorrectiveScripts=\"False\"><collectorEntries>" + entry.ToConfig() + "</collectorEntries><notifierEntries></notifierEntries></monitorPack>"; MonitorPack m = new MonitorPack(); m.LoadXml(tempMonitorPack); monitorState.State = m.RefreshStates(); //there is only one...Collector CollectorEntry ce = (from c in m.Collectors select c).FirstOrDefault(); if (ce != null) //Just is case it is null { plainTextDetails.AppendLine(string.Format("Collector: {0}, State: {1}", ce.Name, ce.CurrentState.State)); htmlTextTextDetails.AppendLine(string.Format("<p>Collector: {0}, State: {1}</p>", ce.Name, ce.CurrentState.State)); if (ce.CurrentState.RawDetails != null && ce.CurrentState.RawDetails.Length > 0) { plainTextDetails.AppendLine(string.Format(" Details: {0}", ce.CurrentState.RawDetails.Trim('\r', '\n').Replace("\t", " "))); } if (ce.CurrentState.HtmlDetails != null && ce.CurrentState.HtmlDetails.Length > 0) { htmlTextTextDetails.AppendLine(string.Format("<blockquote>Details: {0}</blockquote>", ce.CurrentState.HtmlDetails)); } } else { plainTextDetails.AppendLine(string.Format("Collector: {0}, State: N/A", ce.Name)); htmlTextTextDetails.AppendLine(string.Format("<p><b>Collector</b>: {0}, State: N/A</p>", ce.Name)); } monitorState.ExecutedOnHostComputer = System.Net.Dns.GetHostName(); monitorState.RawDetails = plainTextDetails.ToString(); monitorState.HtmlDetails = htmlTextTextDetails.ToString(); Console.WriteLine(" State : {0}", monitorState.State); Console.WriteLine(" Details : {0}", monitorState.RawDetails); } catch (Exception ex) { Console.WriteLine(" Error: {0}", ex); monitorState.State = CollectorState.Error; monitorState.RawDetails = ex.ToString(); } return(monitorState); }
private void RefreshMonitorPack(object o) { MonitorPack m = (MonitorPack)o; m.RefreshStates(); this.Invoke((MethodInvoker) delegate { WaitingPictureBox.SendToBack(); foreach (CollectorHost ch in m.CollectorHosts) { MonitorState ms = ch.CurrentState; txtAlerts.Text += string.Format("Collector host: {0}\r\n", ch.Name); txtAlerts.Text += string.Format("Time: {0}\r\n", ms.Timestamp.ToString("yyyy-MM-dd HH:mm:ss")); txtAlerts.Text += string.Format("Duration: {0}ms\r\n", ms.CallDurationMS); txtAlerts.Text += string.Format("Run on host: {0}\r\n", ms.ExecutedOnHostComputer); txtAlerts.Text += string.Format("State: {0}\r\n{1}\r\n", ms.State, XmlFormattingUtils.NormalizeXML(ms.ReadAllRawDetails('\t'))); } }); }
private void RefreshMonitorPack() { try { Cursor.Current = Cursors.WaitCursor; if (this.InvokeRequired) { this.Invoke((MethodInvoker) delegate() { Cursor.Current = Cursors.WaitCursor; mainRefreshTimer.Enabled = false; } ); } else { Cursor.Current = Cursors.WaitCursor; mainRefreshTimer.Enabled = false; } } catch { } try { if (monitorPack.Enabled) { if (monitorPack.BusyPolling) //still busy with previous polling instance { //Attempting to abort it. monitorPack.AbortPolling = true; DateTime abortStart = DateTime.Now; while (monitorPack.BusyPolling && abortStart.AddSeconds(5) > DateTime.Now) { Application.DoEvents(); } Cursor.Current = Cursors.WaitCursor; } Stopwatch sw = new Stopwatch(); sw.Start(); globalState = monitorPack.RefreshStates(); sw.Stop(); PCSetCollectorsQueryTime(sw.ElapsedMilliseconds); } else { globalState = MonitorStates.Disabled; } UpdateAppIcon(); if (this.InvokeRequired) { this.Invoke((MethodInvoker) delegate() { lastUpdateToolStripStatusLabel.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); } ); } else { lastUpdateToolStripStatusLabel.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); } } catch (Exception ex) { if (!ex.Message.Contains("Collection was modified; enumeration operation may not execute.")) { if (Properties.Settings.Default.DisablePollingOnError) { monitorPack.Enabled = false; } MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } finally { Cursor.Current = Cursors.Default; mainRefreshTimer.Enabled = mainTimerEnabled; } }
static void Main(string[] args) { bool useBackgroundPolling = false; bool showManagement = false; bool reportOnlyStates = true; string currentPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); string registeredAgentsPath = currentPath;// +@"\RegisteredAgents.qmral"; string pingAgentAssembly = currentPath + @"\QMPing.dll"; string fileCountAgentAssembly = currentPath + @"\QMFileCount.dll"; string serviceStateAgentAssembly = currentPath + @"\QMServiceState.dll"; string bizTalkSuspendedCountAgentAssembly = currentPath + @"\QMBizTalkSuspendedCount.dll"; string logFileAgentAssembly = currentPath + @"\QMLogFile.dll"; string configurationFile = currentPath + @"\workConfig.qmconfig"; MonitorPack monitorPack = new MonitorPack(); #region Agent registrations try { monitorPack.AgentsAssemblyPath = registeredAgentsPath; } catch { monitorPack.AgentRegistrations = new List <AgentRegistration>(); monitorPack.AgentRegistrations.AddRange(new AgentRegistration[] { new AgentRegistration() { Name = "Ping", AssemblyPath = pingAgentAssembly, ClassName = "QuickMon.Ping", IsCollector = true, IsNotifier = false }, new AgentRegistration() { Name = "FileCount", AssemblyPath = fileCountAgentAssembly, ClassName = "QuickMon.FileCount", IsCollector = true, IsNotifier = false }, new AgentRegistration() { Name = "ServiceState", AssemblyPath = serviceStateAgentAssembly, ClassName = "QuickMon.ServiceState", IsCollector = true, IsNotifier = false }, new AgentRegistration() { Name = "BizTalkSuspendedCount", AssemblyPath = bizTalkSuspendedCountAgentAssembly, ClassName = "QuickMon.BizTalkSuspendedCount", IsCollector = true, IsNotifier = false }, new AgentRegistration() { Name = "LogFile", AssemblyPath = logFileAgentAssembly, ClassName = "QuickMon.LogFile", IsCollector = false, IsNotifier = true } } ); //SerializationUtils.SerializeXMLToFile<List<AgentRegistration>>(registeredAgentsFile, monitorPack.AgentRegistrations); } #endregion monitorPack.Load(configurationFile); if (useBackgroundPolling) { //monitorPack.RaiseAlert += new RaiseAlertDelegate(monitorPack_RaiseAlert); monitorPack.PollingFreq = 10000; monitorPack.StartPolling(); Console.WriteLine("Press any key to stop polling"); Console.ReadKey(); monitorPack.IsPolling = false; Console.WriteLine("Done"); } else if (showManagement) { Management.MonitorPackManagement monitorPackManagement = new Management.MonitorPackManagement(); monitorPackManagement.ShowMonitorPack(monitorPack); } else if (reportOnlyStates) { ConsoleKeyInfo cki = new ConsoleKeyInfo(' ', ConsoleKey.Spacebar, false, false, false); monitorPack.RaiseCurrentState += new RaiseCurrentStateDelegate(monitorPack_RaiseCurrentState); while (cki.Key != ConsoleKey.Escape) { Console.WriteLine(new string('-', 79)); MonitorStates globalState = monitorPack.RefreshStates(); Console.WriteLine("Global state: {0}", globalState); Console.WriteLine("Last time: {0}", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); Console.WriteLine(new string('-', 79)); Console.WriteLine("Press ESC to end"); cki = ConsoleHelper.ReadKeyWithTimeOut(20000); } } else { //monitorPack.RaiseAlert += new RaiseAlertDelegate(monitorPack_RaiseAlert); MonitorStates globalState = monitorPack.RefreshStates(); Console.WriteLine(new string('-', 79)); Console.WriteLine(string.Format("Current global state: {0}", globalState)); string level = " "; foreach (CollectorEntry ce in (from c in monitorPack.Collectors where c.ParentCollectorId.Length == 0 select c)) { ShowCollectorEntryStatus(monitorPack.Collectors, ce, level); } Console.WriteLine("Press any key to continue or wait 30 seconds"); ConsoleKeyInfo cki = ConsoleHelper.ReadKeyWithTimeOut(30000); if (cki.Key == ConsoleKey.S) { monitorPack.Save(currentPath + @"\Test.qmconfig"); } } }
private void RefreshPack(MonitorPack mEntry) { mEntry.RefreshStates(); }
public MonitorState GetState(QuickMon.RemoteCollectorHost entry) { StringBuilder consoleOutPut = new StringBuilder(); MonitorState monitorState = new MonitorState(); /*** For Console debugging **/ consoleOutPut.AppendFormat("{0}: Running collector host: {1}\r\n", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), entry.Name); try { OperationContext context = OperationContext.Current; System.ServiceModel.Channels.MessageProperties messageProperties = context.IncomingMessageProperties; System.ServiceModel.Channels.RemoteEndpointMessageProperty endpointProperty = messageProperties[System.ServiceModel.Channels.RemoteEndpointMessageProperty.Name] as System.ServiceModel.Channels.RemoteEndpointMessageProperty; consoleOutPut.AppendFormat(" Requested from {0}:{1}\r\n", endpointProperty.Address, endpointProperty.Port); } catch (Exception ex) { consoleOutPut.AppendFormat(" Error getting caller info: {0}\r\n", ex.Message); } consoleOutPut.AppendFormat("{0}\r\n", new string('*', 79)); Console.WriteLine(consoleOutPut.ToString()); consoleOutPut = new StringBuilder(); /*** For Console debugging **/ try { string collectorHostConfig = entry.ToCollectorHostXml(); string tempMonitorPack = "<monitorPack version=\"5.0.0.0\" name=\"\" typeName=\"\" enabled=\"True\" defaultNotifier=\"\" runCorrectiveScripts=\"False\" collectorStateHistorySize=\"1\" pollingFreqSecOverride=\"0\">" + "<collectorHosts>" + collectorHostConfig + "</collectorHosts>\r\n" + "<notifierHosts>\r\n" + "</notifierHosts>\r\n" + "</monitorPack>"; MonitorPack m = new MonitorPack(); m.LoadXml(tempMonitorPack); m.ApplicationUserNameCacheMasterKey = ApplicationUserNameCacheMasterKey; m.ApplicationUserNameCacheFilePath = ApplicationUserNameCacheFilePath; m.BlockedCollectorAgentTypes.AddRange(BlockedCollectorAgentTypes.ToArray()); m.ScriptsRepositoryDirectory = ScriptsRepositoryDirectory; if (m.CollectorHosts.Count == 1) { m.RefreshStates(); //Since there is only one CollectorHost CollectorHost ch = m.CollectorHosts[0]; monitorState = ch.CurrentState; monitorState.RanAs = ch.CurrentState.RanAs; } else { monitorState.CurrentValue = "There was a problem loading the Collector Host config on the remote host!"; monitorState.RawDetails = collectorHostConfig; monitorState.HtmlDetails = collectorHostConfig.EscapeXml(); monitorState.State = CollectorState.Error; } //If hosted in console test app consoleOutPut.AppendFormat("{0}: Results for collector host: {1}\r\n", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), entry.Name); consoleOutPut.AppendFormat(" State : {0}\r\n", monitorState.State); consoleOutPut.AppendFormat(" Ran as : {0}\r\n", monitorState.RanAs); consoleOutPut.AppendFormat(" Details : {0}\r\n", monitorState.ReadAllRawDetails()); } catch (Exception ex) { consoleOutPut.AppendFormat(" Error: {0}\r\n", ex); monitorState.CurrentValue = ex.Message; monitorState.State = CollectorState.Error; monitorState.RawDetails = ex.ToString(); monitorState.HtmlDetails = ex.ToString().EscapeXml(); } consoleOutPut.AppendLine(new string('*', 79)); Console.WriteLine(consoleOutPut.ToString()); monitorState.ExecutedOnHostComputer = System.Net.Dns.GetHostName(); return(monitorState); }
private void ReadCallback(IAsyncResult result) { try { using (NetworkStream networkStream = clientSocket.GetStream()) { int read = networkStream.EndRead(result); MonitorState packResult = new MonitorState() { State = CollectorState.NotAvailable, RawDetails = "", HtmlDetails = "" }; string data = ""; if (read > 0) { byte[] buffer = result.AsyncState as byte[]; data = Encoding.UTF8.GetString(buffer, 0, read); //do the job with the data here if (data.StartsWith("<monitorPack") && data.EndsWith("</monitorPack>")) { MonitorPack m = new MonitorPack(); StringBuilder plainTextDetails = new StringBuilder(); StringBuilder htmlTextTextDetails = new StringBuilder(); m.RaiseMonitorPackError += m_RaiseMonitorPackError; m.LoadXml(data); RaiseDisplayMonitorPackName(m.Name); packResult.State = m.RefreshStates(); htmlTextTextDetails.AppendLine("<ul>"); foreach (CollectorEntry ce in (from c in m.Collectors where c.CurrentState != null select c)) { if (ce.CurrentState == null) { plainTextDetails.AppendLine(string.Format("\tCollector: {0}, State: N/A", ce.Name)); htmlTextTextDetails.AppendLine(string.Format("<li>Collector: {0}, State: N/A</li>", ce.Name)); } else if (ce.CurrentState.State == CollectorState.Good) { plainTextDetails.AppendLine(string.Format("\tCollector: {0}, State: {1}", ce.Name, ce.CurrentState.State)); htmlTextTextDetails.AppendLine(string.Format("<li>Collector: {0}, State: {1}</li>", ce.Name, ce.CurrentState.State)); } else { plainTextDetails.AppendLine(string.Format("\tCollector: {0}, State: {1}", ce.Name, ce.CurrentState.State)); if (ce.CurrentState.RawDetails != null && ce.CurrentState.RawDetails.Length > 0) { plainTextDetails.AppendLine(string.Format("\t\tDetails: {0}", ce.CurrentState.RawDetails.Replace("\r\n", "\r\n\t\t\t"))); } htmlTextTextDetails.AppendLine(string.Format("<li>Collector: {0}, State: {1}</li>", ce.Name, ce.CurrentState.State)); if (ce.CurrentState.HtmlDetails != null && ce.CurrentState.HtmlDetails.Length > 0) { htmlTextTextDetails.AppendLine(string.Format("<br/>Details: {0}", ce.CurrentState.HtmlDetails)); } } } htmlTextTextDetails.AppendLine("</ul>"); packResult.RawDetails = plainTextDetails.ToString(); packResult.HtmlDetails = htmlTextTextDetails.ToString(); RaiseInfoMessage(string.Format("MonitorPack: '{0}' - state: {1}", m.Name, packResult.State)); m = null; } else { RaiseErrorMessage("Input request data invalid!\r\n" + summarizeErrData(data)); packResult.State = CollectorState.Error; packResult.RawDetails = "Input request data invalid!\r\n" + summarizeErrData(data); packResult.HtmlDetails = "Input request data invalid!\r\n" + summarizeErrData(data.Replace("<", "<").Replace(">", ">")); } //send the data back to client. Byte[] sendBytes = Encoding.UTF8.GetBytes(packResult.ToXml()); networkStream.Write(sendBytes, 0, sendBytes.Length); networkStream.Flush(); } } } catch (Exception ex) { if ((ex is System.IO.IOException && ex.Message.Contains("Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host")) || ex is System.InvalidOperationException && ex.Message.Contains("The operation is not allowed on non-connected sockets")) { RaiseInfoMessage(string.Format("Client {0} disconnecting.", clientNo)); } else { if (clientSocket != null && clientSocket.Client != null && clientSocket.Client.RemoteEndPoint is System.Net.IPEndPoint) { RaiseErrorMessage(string.Format("Error processing request from {0}\r\nError: {1}", ((System.Net.IPEndPoint)clientSocket.Client.RemoteEndPoint).Address.ToString(), ex)); } else { RaiseErrorMessage(string.Format("Error from unknown client: {0}", ex)); } } } }
private void cmdRunTest_Click(object sender, EventArgs e) { string configXml = "<monitorPack version=\"4.0.0\" name=\"Test\" typeName=\"TestType\" enabled=\"True\" " + "defaultNotifier=\"Default notifiers\" runCorrectiveScripts=\"True\" " + "stateHistorySize=\"100\" pollingFreqSecOverride=\"12\">\r\n" + "<configVars />\r\n" + "<collectorHosts>\r\n"; configXml += "<collectorHost uniqueId=\"PingNowhere\" name=\"Ping Nowhere\" enabled=\"True\" expandOnStart=\"True\" dependOnParentId=\"\" " + "agentCheckSequence=\"All\" childCheckBehaviour=\"OnlyRunOnSuccess\" " + "enableRemoteExecute=\"False\" " + "forceRemoteExcuteOnChildCollectors=\"False\" remoteAgentHostAddress=\"\" remoteAgentHostPort=\"48181\" " + "blockParentRemoteAgentHostSettings=\"False\" runLocalOnRemoteHostConnectionFailure=\"True\" >\r\n" + "<collectorAgents>\r\n" + "<collectorAgent type=\"PingCollector\">\r\n" + "<config>\r\n" + "<entries>\r\n" + "<entry pingMethod=\"Ping\" address=\"NowhereSpecific\" />\r\n" + (chkLocalhost.Checked ? "<entry pingMethod=\"Ping\" address=\"localhost\" />\r\n" : "") + "</entries>\r\n" + "</config>\r\n" + "</collectorAgent>\r\n" + "</collectorAgents>\r\n" + "</collectorHost>\r\n"; configXml += "</collectorHosts>" + "<notifierHosts>\r\n"; if (chkEventLog.Checked) { configXml += "<notifierHost name=\"EventLogNotifier\" enabled=\"True\" alertLevel=\"Warning\" detailLevel=\"Detail\" " + "attendedOptionOverride=\"OnlyAttended\">\r\n" + "<notifierAgents>\r\n" + "<notifierAgent type=\"EventLogNotifier\">\r\n" + "<config><eventLog computer=\".\" eventSource=\"QuickMon4\" successEventID=\"0\" warningEventID=\"1\" errorEventID=\"2\" /></config>\r\n" + "</notifierAgent>\r\n" + "</notifierAgents>\r\n" + "</notifierHost>\r\n"; } if (chkLogFile.Checked) { configXml += "<notifierHost name=\"Log file\" enabled=\"True\" alertLevel=\"Info\" detailLevel=\"Detail\" " + "attendedOptionOverride=\"OnlyAttended\">\r\n" + "<notifierAgents>\r\n" + "<notifierAgent type=\"LogFileNotifier\">\r\n" + "<config><logFile path=\"" + txtLogFile.Text + "\" createNewFileSizeKB=\"0\" /></config>\r\n" + "</notifierAgent>\r\n" + "</notifierAgents>\r\n" + "</notifierHost>\r\n"; } if (chkSMTP.Checked) { configXml += "<notifierHost name=\"Email\" enabled=\"True\" alertLevel=\"Info\" detailLevel=\"Detail\" " + "attendedOptionOverride=\"OnlyAttended\">\r\n" + "<notifierAgents>\r\n" + "<notifierAgent name=\"Email\" type=\"SMTPNotifier\">\r\n" + "<config>\r\n" + "<smtp hostServer=\"" + txtSMTPServer.Text + "\" useDefaultCredentials=\"True\" domain=\"\" userName=\"\" password=\"\" " + "fromAddress=\"" + txtEmailAddress.Text + "\" toAddress=\"" + txtEmailAddress.Text + "\" senderAddress=\"" + txtEmailAddress.Text + "\" replyToAddress=\"" + txtEmailAddress.Text + "\" mailPriority=\"0\" useTLS=\"False\" isBodyHtml=\"True\" port=\"25\" subject=\"QuickMon %AlertLevel% - %CollectorName%\" body=\"QuickMon alert raised for <b>'%CollectorName%'</b><br />
<b>Date Time:</b> %DateTime%<br />
<b>Current state:</b> %CurrentState%<br />
<b>Agents:</b> %CollectorAgents%<br />
<b>Details</b><blockquote>%Details%</blockquote>\" />\r\n" + "</config>\r\n" + "</notifierAgent>\r\n" + "</notifierAgents>\r\n" + "</notifierHost>\r\n"; } if (chkAudio.Checked) { configXml += "<notifierHost name=\"AudioNotifier\" enabled=\"True\" alertLevel=\"Warning\" detailLevel=\"Detail\" " + "attendedOptionOverride=\"OnlyAttended\">\r\n" + "<notifierAgents>\r\n" + "<notifierAgent type=\"AudioNotifier\">\r\n" + "<config>\r\n" + "<audioConfig>\r\n" + "<goodState enabled=\"false\" useSystemSounds=\"true\" soundPath=\"\" systemSound=\"1\" soundRepeatCount=\"1\" soundVolumePerc=\"-1\" />\r\n" + "<warningState enabled=\"true\" useSystemSounds=\"true\" soundPath=\"\" systemSound=\"2\" soundRepeatCount=\"1\" soundVolumePerc=\"-1\" />\r\n" + "<errorState enabled=\"true\" useSystemSounds=\"true\" soundPath=\"\" systemSound=\"3\" soundRepeatCount=\"1\" soundVolumePerc=\"-1\" />\r\n" + "</audioConfig>\r\n" + "</config>\r\n" + "</notifierAgent>\r\n" + "</notifierAgents>\r\n" + "</notifierHost>\r\n"; } configXml += "</notifierHosts>\r\n" + "</monitorPack>"; MonitorPack m = new MonitorPack(); m.ConcurrencyLevel = (int)nudConcurency.Value; m.LoadXml(configXml); m.RefreshStates(); txtAlerts.Text = ""; foreach (CollectorHost ch in m.CollectorHosts) { MonitorState ms = ch.CurrentState; txtAlerts.Text += string.Format("Collector host: {0}\r\n", ch.Name); txtAlerts.Text += string.Format("Time: {0}\r\n", ms.Timestamp.ToString("yyyy-MM-dd HH:mm:ss")); txtAlerts.Text += string.Format("Duration: {0}ms\r\n", ms.CallDurationMS); txtAlerts.Text += string.Format("Run on host: {0}\r\n", ms.ExecutedOnHostComputer); txtAlerts.Text += string.Format("State: {0}\r\n{1}\r\n", ms.State, XmlFormattingUtils.NormalizeXML(ms.ReadAllRawDetails('\t'))); txtAlerts.Text += "Alerts\r\n"; foreach (string alert in ms.AlertsRaised) { txtAlerts.Text += "\t" + alert; } } }