private void LogCorrectiveScriptAction(CollectorEntry collector, bool error) { CollectorMessage details = new CollectorMessage(); details.PlainText = string.Format("Due to an alert raised on the collector '{0}' the following corrective script was executed: '{1}'", collector.Name, error ? collector.CorrectiveScriptOnErrorPath : collector.CorrectiveScriptOnWarningPath); //details.LastValue = collector.LastMonitorDetails.LastValue; Stopwatch sw = new Stopwatch(); sw.Start(); foreach (NotifierEntry notifierEntry in (from n in Notifiers where n.Enabled && ( ((int)n.AlertLevel <= (int)AlertLevel.Warning && !error) || ((int)n.AlertLevel <= (int)AlertLevel.Error && error) ) && (n.AlertForCollectors.Count == 0 || n.AlertForCollectors.Contains(collector.Name)) select n)) { try { PCRaiseNotifiersCalled(); notifierEntry.Notifier.RecordMessage(error ? AlertLevel.Error : AlertLevel.Warning, collector.CollectorRegistrationName, collector.Name, collector.LastMonitorState, collector.CurrentState, details); } catch (Exception ex) { RaiseRaiseNotifierError(notifierEntry, ex.ToString()); } } sw.Stop(); PCSetNotifiersSendTime(sw.ElapsedMilliseconds); }
private void monitorPack_RaiseCollectorError(CollectorEntry collector, string errorMessage) { EventLog.WriteEntry(serviceEventSource, string.Format("Collector error\r\n" + "Collector name: {0}\r\n" + "Last details: {1}\r\n" + "Error details: {2}", collector.Name, collector.LastMonitorDetails, errorMessage), EventLogEntryType.Error, 2); }
private void configureCollectorToolStripMenuItem_Click(object sender, EventArgs e) { if (tvwCollectors.SelectedNode != null && tvwCollectors.SelectedNode.Tag != null && tvwCollectors.SelectedNode.Tag is CollectorEntry) { CollectorEntry collectorEntry = (CollectorEntry)tvwCollectors.SelectedNode.Tag; QuickMon.Management.EditCollectorEntry editCollectorEntry = new QuickMon.Management.EditCollectorEntry(); editCollectorEntry.AllowCollectorChange = false; editCollectorEntry.SelectedEntry = collectorEntry; if (editCollectorEntry.ShowDialog(monitorPack) == System.Windows.Forms.DialogResult.OK) { collectorEntry = editCollectorEntry.SelectedEntry; monitorPack.ApplyCollectorConfig(collectorEntry); tvwCollectors.SelectedNode.Tag = collectorEntry; tvwCollectors.SelectedNode.Text = collectorEntry.Name; if (!collectorEntry.Enabled) { if (!collectorEntry.IsFolder) { tvwCollectors.SelectedNode.ImageIndex = 1; tvwCollectors.SelectedNode.SelectedImageIndex = 1; } tvwCollectors.SelectedNode.ForeColor = Color.Gray; } else { tvwCollectors.SelectedNode.ForeColor = SystemColors.WindowText; if (!collectorEntry.IsFolder) { collectorEntry.RefreshDetailsIfOpen(); } } } } }
private void tvwCollectors_AfterSelect(object sender, TreeViewEventArgs e) { if (tvwCollectors.SelectedNode != null && tvwCollectors.SelectedNode.ImageIndex > 0) { showDetailsToolStripMenuItem.Enabled = tvwCollectors.SelectedNode.ImageIndex != folderImgIndex; showCollectorDetailsToolStripMenuItem.Enabled = tvwCollectors.SelectedNode.ImageIndex != folderImgIndex; configureCollectorToolStripMenuItem.Enabled = true; configureCollectorToolStripMenuItem1.Enabled = true; if (tvwCollectors.SelectedNode.Tag != null && tvwCollectors.SelectedNode.Tag is CollectorEntry) { CollectorEntry collector = (CollectorEntry)tvwCollectors.SelectedNode.Tag; disableCollectorToolStripMenuItem.Enabled = true; if (collector.Enabled) { disableCollectorToolStripMenuItem.Text = "Disable collector"; } else { disableCollectorToolStripMenuItem.Text = "Enable collector"; } } } else { showDetailsToolStripMenuItem.Enabled = false; showCollectorDetailsToolStripMenuItem.Enabled = false; disableCollectorToolStripMenuItem.Enabled = false; configureCollectorToolStripMenuItem.Enabled = false; configureCollectorToolStripMenuItem1.Enabled = false; } }
private void SetTreeNodeState(TreeNode treeNode, CollectorEntry collector, MonitorStates currentState) { if (currentState == MonitorStates.Disabled || currentState == MonitorStates.NotAvailable) { treeNode.ImageIndex = 1; treeNode.SelectedImageIndex = 1; } else if (currentState == MonitorStates.Good) { treeNode.ImageIndex = 2; treeNode.SelectedImageIndex = 2; PCRaiseCollectorSuccessState(); } else if (currentState == MonitorStates.Warning) { treeNode.ImageIndex = 3; treeNode.SelectedImageIndex = 3; PCRaiseCollectorWarningState(); } else { treeNode.ImageIndex = 4; treeNode.SelectedImageIndex = 4; PCRaiseCollectorErrorState(); } if (collector.Enabled) { treeNode.ForeColor = SystemColors.WindowText; } else { treeNode.ForeColor = Color.Gray; } }
private void LoadCollectorNode(TreeNode root, CollectorEntry collector) { TreeNode collectorNode; if (collector.IsFolder) { collectorNode = new TreeNode(collector.Name, 5, 5); } else { collectorNode = new TreeNode(collector.Name, 1, 1); } collectorNode.Tag = collector; collector.Tag = collectorNode; collectorNode.ForeColor = collector.Enabled ? SystemColors.WindowText : Color.Gray; foreach (CollectorEntry childCollector in (from c in monitorPack.Collectors where c.ParentCollectorId == collector.UniqueId select c)) { LoadCollectorNode(collectorNode, childCollector); } root.Nodes.Add(collectorNode); if (collector.Enabled) { collectorNode.Expand(); } }
public static System.Windows.Forms.DialogResult EditCollectorEntry(CollectorEntry collectorEntry, MonitorPack monitorPack) { QuickMon.Forms.EditCollectorConfig editCollectorEntry = new Forms.EditCollectorConfig(); editCollectorEntry.SelectedEntry = collectorEntry; editCollectorEntry.KnownRemoteHosts = KnownRemoteHosts; return(editCollectorEntry.ShowDialog(monitorPack)); }
public static CollectorEntry FromConfig(XmlElement xmlCollectorEntry) { CollectorEntry collectorEntry = new CollectorEntry(); collectorEntry.LastStateChange = DateTime.Now; collectorEntry.Name = xmlCollectorEntry.ReadXmlElementAttr("name", "").Trim(); collectorEntry.UniqueId = xmlCollectorEntry.ReadXmlElementAttr("uniqueID", DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss")); collectorEntry.Enabled = bool.Parse(xmlCollectorEntry.ReadXmlElementAttr("enabled", "True")); collectorEntry.IsFolder = bool.Parse(xmlCollectorEntry.ReadXmlElementAttr("isFolder", "False")); collectorEntry.ParentCollectorId = xmlCollectorEntry.ReadXmlElementAttr("dependOnParent"); collectorEntry.CorrectiveScriptDisabled = bool.Parse(xmlCollectorEntry.ReadXmlElementAttr("correctiveScriptDisabled", "False")); collectorEntry.CorrectiveScriptOnWarningPath = xmlCollectorEntry.ReadXmlElementAttr("correctiveScriptOnWarningPath"); collectorEntry.CorrectiveScriptOnErrorPath = xmlCollectorEntry.ReadXmlElementAttr("correctiveScriptOnErrorPath"); //Service windows config collectorEntry.ServiceWindows = new ServiceWindows(); XmlNode serviceWindowsNode = xmlCollectorEntry.SelectSingleNode("serviceWindows"); if (serviceWindowsNode != null) //Load service windows info { collectorEntry.ServiceWindows.CreateFromConfig(serviceWindowsNode.OuterXml); } if (!collectorEntry.IsFolder) { collectorEntry.CollectorRegistrationName = xmlCollectorEntry.ReadXmlElementAttr("collector", "No collector"); collectorEntry.CollectOnParentWarning = bool.Parse(xmlCollectorEntry.ReadXmlElementAttr("collectOnParentWarning", "False")); collectorEntry.RepeatAlertInXMin = int.Parse(xmlCollectorEntry.ReadXmlElementAttr("repeatAlertInXMin", "0")); collectorEntry.AlertOnceInXMin = int.Parse(xmlCollectorEntry.ReadXmlElementAttr("alertOnceInXMin", "0")); collectorEntry.DelayErrWarnAlertForXSec = int.Parse(xmlCollectorEntry.ReadXmlElementAttr("delayErrWarnAlertForXSec", "0")); collectorEntry.LastAlertTime = new DateTime(2000, 1, 1); //long ago collectorEntry.LastGoodState = new DateTime(2000, 1, 1); //long ago collectorEntry.LastMonitorState = MonitorStates.NotAvailable; XmlNode configNode = xmlCollectorEntry.SelectSingleNode("config"); if (configNode != null) { collectorEntry.Configuration = configNode.OuterXml; } else { collectorEntry.LastMonitorState = MonitorStates.ConfigurationError; collectorEntry.Configuration = ""; } } else { collectorEntry.CollectorRegistrationName = "Folder"; collectorEntry.Configuration = ""; collectorEntry.LastMonitorState = MonitorStates.Folder; } collectorEntry.LastMonitorDetails = new CollectorMessage(); return(collectorEntry); }
/// <summary> /// Creates a new copy of the current Collector Entry /// </summary> /// <returns>CollectorEntry instance</returns> public CollectorEntry Clone(bool newId = false) { CollectorEntry clone = FromConfig(ToConfig()); if (newId) { clone.UniqueId = Guid.NewGuid().ToString(); } clone.CollectorRegistrationDisplayName = this.CollectorRegistrationDisplayName; //have to add it afterwards since config does not specify it return(clone); }
public static CollectorEntry CreateNewCollector(CollectorEntry parentCollectorEntry = null) { CollectorEntry newCollectorEntry = null; SelectNewAgentType selectNewAgentType = new SelectNewAgentType(); selectNewAgentType.InitialRegistrationName = ""; if (selectNewAgentType.ShowCollectorSelection() == System.Windows.Forms.DialogResult.OK) { LastLaunchAddEntryOption = selectNewAgentType.SelectedPreset == null; LastShowRawEditOnStartOption = selectNewAgentType.ImportConfigAfterSelect; newCollectorEntry = new CollectorEntry(); if (parentCollectorEntry != null) { newCollectorEntry.ParentCollectorId = parentCollectorEntry.UniqueId; } RegisteredAgent ar = null; if (selectNewAgentType.SelectedPreset != null) { ar = RegisteredAgentCache.GetRegisteredAgentByClassName(selectNewAgentType.SelectedPreset.AgentClassName); } else if (selectNewAgentType.SelectedAgent != null) { ar = selectNewAgentType.SelectedAgent; } else { return(null); } if (ar == null) //in case agent is not loaded or available { return(null); } else if (ar.ClassName != "QuickMon.Collectors.Folder") { string initialConfig = ""; if (selectNewAgentType.SelectedPreset != null) { initialConfig = MacroVariables.FormatVariables(selectNewAgentType.SelectedPreset.Config); newCollectorEntry.Name = selectNewAgentType.SelectedPreset.Description; } newCollectorEntry.CreateAndConfigureEntry(ar.ClassName, initialConfig, true, false); } else { newCollectorEntry.IsFolder = true; newCollectorEntry.CollectorRegistrationDisplayName = ar.DisplayName; newCollectorEntry.CollectorRegistrationName = ar.Name; } } return(newCollectorEntry); }
public List <CollectorEntry> GetAllChildCollectors(CollectorEntry parentCE) { List <CollectorEntry> list = new List <CollectorEntry>(); List <CollectorEntry> listChildren = new List <CollectorEntry>(); listChildren = GetChildCollectors(parentCE); foreach (CollectorEntry child in listChildren) { list.Add(child); list.AddRange(GetAllChildCollectors(child)); } return(list); }
public static System.Data.DataSet GetRemoteHostAgentDetails(CollectorEntry entry, string hostAddressOverride, int portNumberOverride) { BasicHttpBinding myBinding = new BasicHttpBinding(); EndpointAddress myEndpoint = new EndpointAddress(string.Format("http://{0}:{1}/QMRemoteAgent", hostAddressOverride, portNumberOverride)); ChannelFactory <ICollectorEntryRelay> myChannelFactory = new ChannelFactory <ICollectorEntryRelay>(myBinding, myEndpoint); ICollectorEntryRelay relay = myChannelFactory.CreateChannel(); CollectorEntryRequest colReq = new CollectorEntryRequest(); colReq.FromCollectorEntry(entry); colReq.ParentCollectorId = ""; //Since this mechanism do no support nested collectors return(relay.GetDetails(colReq)); }
public void ApplyCollectorConfig(CollectorEntry collectorEntry) { if (collectorEntry == null) { return; } AgentRegistration currentCollector = null; if (collectorEntry.IsFolder) { collectorEntry.Collector = null; } else { //first clear/release any existing references if (collectorEntry.Collector != null) { collectorEntry.Collector = null; } if (AgentRegistrations != null) { currentCollector = (from o in AgentRegistrations where o.IsCollector && o.Name == collectorEntry.CollectorRegistrationName select o).FirstOrDefault(); } if (currentCollector != null) { collectorEntry.Collector = CollectorEntry.CreateCollectorEntry(currentCollector.AssemblyPath, currentCollector.ClassName); XmlDocument configDoc = new XmlDocument(); configDoc.LoadXml(collectorEntry.Configuration); try { collectorEntry.Collector.ReadConfiguration(configDoc); } catch (Exception ex) { collectorEntry.LastMonitorState = MonitorStates.ConfigurationError; collectorEntry.Enabled = false; collectorEntry.LastMonitorDetails.PlainText = ex.Message; } } else { collectorEntry.LastMonitorState = MonitorStates.ConfigurationError; collectorEntry.Enabled = false; collectorEntry.LastMonitorDetails.PlainText = string.Format("Collector '{0}' cannot be loaded as the type '{1}' is not registered!", collectorEntry.Name, collectorEntry.CollectorRegistrationName); RaiseRaiseMonitorPackError(string.Format("Collector '{0}' cannot be loaded as the type '{1}' is not registered!", collectorEntry.Name, collectorEntry.CollectorRegistrationName)); } } }
private void RaiseCollectorExecutionTime(CollectorEntry collector, long msTime) { try { if (CollectorExecutionTimeEvent != null) { CollectorExecutionTimeEvent(collector, msTime); } } catch (Exception ex) { System.Diagnostics.Trace.WriteLine(string.Format("Error in RaiseCollectorExecutionTime: {0}", ex.Message)); } }
private void monitorPack_RaiseCollectorError(CollectorEntry collector, string errorMessage) { string lastCollectorDetails = "N/A"; if (collector != null && collector.LastMonitorState != null) { lastCollectorDetails = collector.LastMonitorState.RawDetails; } EventLog.WriteEntry(Globals.ServiceEventSourceName, string.Format("Collector error\r\n" + "Collector name: {0}\r\n" + "Last details: {1}\r\n" + "Error details: {2}", collector.Name, lastCollectorDetails, errorMessage), EventLogEntryType.Error, 2); }
private void RaiseCollectorCalled(CollectorEntry collector) { try { if (CollectorCalled != null) { CollectorCalled(collector); } } catch (Exception ex) { System.Diagnostics.Trace.WriteLine(string.Format("Error in RaiseCollectorCalled: {0}", ex.Message)); } }
private void RaiseRaiseCurrentStateDelegate(CollectorEntry collector, MonitorStates currentState) { try { if (RaiseCurrentState != null) { RaiseCurrentState(collector, currentState); } } catch (Exception ex) { System.Diagnostics.Trace.WriteLine(string.Format("Error in RaiseRaiseCurrentStateDelegate: {0}", ex.Message)); } }
private void monitorPack_RaiseCurrentState(CollectorEntry collector, MonitorStates currentState) { if (this.InvokeRequired) { this.Invoke((MethodInvoker) delegate { UpdateTreeNodeStates(collector, currentState); }); } else { UpdateTreeNodeStates(collector, currentState); } }
private void RaiseRaiseCollectorError(CollectorEntry collector, string errorMessage) { try { if (RaiseCollectorError != null) { RaiseCollectorError(collector, errorMessage); } } catch (Exception ex) { System.Diagnostics.Trace.WriteLine(string.Format("Error in RaiseRaiseCollectorError: {0}", ex.Message)); } }
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 showCollectorDetailsToolStripMenuItem_Click(object sender, EventArgs e) { try { if (tvwCollectors.SelectedNode != null && tvwCollectors.SelectedNode.ImageIndex != folderImgIndex && tvwCollectors.SelectedNode.Tag != null && tvwCollectors.SelectedNode.Tag is CollectorEntry) { CollectorEntry collectorEntry = (CollectorEntry)tvwCollectors.SelectedNode.Tag; collectorEntry.ShowDetails(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private bool UpdateCollectorNode(TreeNode treeNode, CollectorEntry collector, MonitorStates currentState) { foreach (TreeNode childNode in treeNode.Nodes) { if (childNode.Text == collector.Name) { SetTreeNodeState(childNode, collector, currentState); return(true); } if (UpdateCollectorNode(childNode, collector, currentState)) { return(true); } } return(false); }
private void monitorPack_RunRestorationScript(CollectorEntry collector) { try { if (collector != null && System.IO.File.Exists(collector.RestorationScriptPath)) { EventLog.WriteEntry(Globals.ServiceEventSourceName, string.Format("Running the restoration script '{0}' for collector '{1}'", collector.RestorationScriptPath, collector.Name) , EventLogEntryType.Information, 22); RunCorrectiveScript(collector.RestorationScriptPath); } } catch (Exception ex) { EventLog.WriteEntry(Globals.ServiceEventSourceName, "Corrective script error:" + ex.Message, EventLogEntryType.Error, 24); } }
private void monitorPack_RunCollectorCorrectiveErrorScript(CollectorEntry collector) { try { if (collector != null && System.IO.File.Exists(collector.CorrectiveScriptOnErrorPath)) { Process p = new Process(); p.StartInfo = new ProcessStartInfo(collector.CorrectiveScriptOnErrorPath); p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; p.Start(); } } catch (Exception ex) { toolStripStatusLabelStatus.Text = "Corrective script error:" + ex.Message; } }
public static CollectorEntry CreateAndEditNewCollector(MonitorPack monitorPack, CollectorEntry parentCollectorEntry = null) { CollectorEntry newCollectorEntry = CreateNewCollector(parentCollectorEntry); if (newCollectorEntry != null) { QuickMon.Forms.EditCollectorConfig editCollectorEntry = new Forms.EditCollectorConfig(); editCollectorEntry.SelectedEntry = newCollectorEntry; editCollectorEntry.KnownRemoteHosts = KnownRemoteHosts; editCollectorEntry.LaunchAddEntry = LastLaunchAddEntryOption; editCollectorEntry.ShowRawEditOnStart = LastShowRawEditOnStartOption; if (editCollectorEntry.ShowDialog(monitorPack) != System.Windows.Forms.DialogResult.OK) { newCollectorEntry = null; } } return(newCollectorEntry); }
private void CloseAllDetailWindows(TreeNode parent = null) { if (parent == null) { CloseAllDetailWindows(tvwCollectors.Nodes[0]); } else { foreach (TreeNode child in parent.Nodes) { if (child.Tag is CollectorEntry) { CollectorEntry childCollector = (CollectorEntry)child.Tag; childCollector.CloseDetails(); } CloseAllDetailWindows(child); } } }
private void monitorPack_CollectorExecutionTimeEvent(CollectorEntry collector, long msTime) { try { if (this.InvokeRequired) { this.Invoke((MethodInvoker) delegate() { if (tvwCollectors.SelectedNode != null && tvwCollectors.SelectedNode.Tag != null && tvwCollectors.SelectedNode.Tag is CollectorEntry) { CollectorEntry tvcollector = (CollectorEntry)tvwCollectors.SelectedNode.Tag; if (tvcollector.UniqueId == collector.UniqueId) { PCSetSelectedCollectorsQueryTime(msTime); return; } } else { PCSetSelectedCollectorsQueryTime(0); } } ); } else { if (tvwCollectors.SelectedNode != null && tvwCollectors.SelectedNode.Tag != null && tvwCollectors.SelectedNode.Tag is CollectorEntry) { CollectorEntry tvcollector = (CollectorEntry)tvwCollectors.SelectedNode.Tag; if (tvcollector.UniqueId == collector.UniqueId) { PCSetSelectedCollectorsQueryTime(msTime); return; } } else { PCSetSelectedCollectorsQueryTime(0); } } } catch { } }
private void RaiseRunCollectorCorrectiveErrorScript(CollectorEntry collector) { try { if (RunCorrectiveScripts && RunCollectorCorrectiveErrorScript != null && collector != null && !collector.CorrectiveScriptDisabled && collector.CorrectiveScriptOnErrorPath.Length > 0) { RunCollectorCorrectiveErrorScript(collector); LogCorrectiveScriptAction(collector, true); } } catch (Exception ex) { System.Diagnostics.Trace.WriteLine(string.Format("Error in RaiseRunCollectorCorrectiveErrorScript: {0}", ex.Message)); } }
public CollectorEntry Clone() { CollectorEntry clone = new CollectorEntry(); clone.Name = Name; clone.UniqueId = UniqueId; clone.ParentCollectorId = ParentCollectorId; clone.IsFolder = IsFolder; clone.CollectOnParentWarning = CollectOnParentWarning; clone.CollectorRegistrationName = CollectorRegistrationName; clone.Collector = Collector; clone.Configuration = Configuration; clone.Enabled = Enabled; clone.ServiceWindows = ServiceWindows; clone.CorrectiveScriptDisabled = CorrectiveScriptDisabled; clone.CorrectiveScriptOnWarningPath = CorrectiveScriptOnWarningPath; clone.CorrectiveScriptOnErrorPath = CorrectiveScriptOnErrorPath; clone.Tag = Tag; return(clone); }
private void monitorPack_RunCollectorCorrectiveErrorScript(CollectorEntry collector) { try { if (collector != null && System.IO.File.Exists(collector.CorrectiveScriptOnErrorPath)) { EventLog.WriteEntry(serviceEventSource, string.Format("Running the corrective script '{0}' for collector '{1}'", collector.CorrectiveScriptOnWarningPath, collector.Name) , EventLogEntryType.Information, 22); Process p = new Process(); p.StartInfo = new ProcessStartInfo(collector.CorrectiveScriptOnErrorPath); p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; p.Start(); } } catch (Exception ex) { EventLog.WriteEntry(serviceEventSource, "Corrective script error:" + ex.Message, EventLogEntryType.Error, 24); } }