From 04778d1827a487acaea9517c0824e4ef2fd3b146 Mon Sep 17 00:00:00 2001 From: Dan Rahm Date: Thu, 21 Sep 2017 14:22:33 -0700 Subject: [PATCH] - Added ComputerName and Address to the config. (#138) - Updated the TabMon.config file to reflect the changes. - Updated CounterSampler to use the address when databasing value. - Updated host object to use both the address and computer name. This change is reflected in ToString(). - Updated perfmon code to refer to the computer name. - Updated JMX code to refer to the address. - Refactored the PerfmonCounterConfigReader class to make it more readable, skip the collection of PerfMon counters on incorrect computer names, and make the errors more readable. - Removed the HostNameHelper since the computer name and address are now manually configured. --- TabMon/Config/TabMon.config | 2 +- TabMon/CounterConfig/CounterConfigLoader.cs | 4 +- .../CounterConfig/MBeanCounterConfigReader.cs | 4 +- .../PerfmonCounterConfigReader.cs | 82 ++++++++++++------- TabMon/Counters/Perfmon/PerfmonCounter.cs | 2 +- .../Counters/Perfmon/PerfmonCounterLoader.cs | 12 +-- TabMon/Helpers/Host.cs | 10 ++- TabMon/Helpers/HostNameHelper.cs | 45 ---------- TabMon/Resources/TabMonConfig.xsd | 7 +- TabMon/Sampler/CounterSampler.cs | 2 +- TabMon/TabMon.csproj | 1 - TabMon/TabMonConfig/TabMonConfigReader.cs | 3 +- TabMon/TabMonConfig/TabMonConfigSection.cs | 55 +++++++++---- .../ConfigurationSection.csd | 10 ++- .../ConfigurationSection.csd.cs | 55 +++++++++---- .../ConfigurationSection.csd.diagram | 8 +- .../ConfigurationSection.csd.xsd | 7 +- 17 files changed, 178 insertions(+), 131 deletions(-) delete mode 100644 TabMon/Helpers/HostNameHelper.cs diff --git a/TabMon/Config/TabMon.config b/TabMon/Config/TabMon.config index fa4d0ed..fe45cb6 100644 --- a/TabMon/Config/TabMon.config +++ b/TabMon/Config/TabMon.config @@ -8,7 +8,7 @@ - + diff --git a/TabMon/CounterConfig/CounterConfigLoader.cs b/TabMon/CounterConfig/CounterConfigLoader.cs index 92674b7..8809502 100644 --- a/TabMon/CounterConfig/CounterConfigLoader.cs +++ b/TabMon/CounterConfig/CounterConfigLoader.cs @@ -20,7 +20,7 @@ internal static class CounterConfigLoader private const string PathToCountersConfig = @"Config\Counters.config"; private const string PathToSchema = @"Resources\CountersConfig.xsd"; private static readonly ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private static XmlDocument loadedConfigDocument; + private static XmlDocument loadedConfigDocument; /// /// Loads the Counters.config file, validates it against the XSD schema, and news up the appropriate CounterConfigReader object for each root counter type node. @@ -54,7 +54,7 @@ public static ICollection Load(IEnumerable hosts, CounterLifecyc if (countersInNode.Count > 0) { Log.DebugFormat("Loaded {0} {1} {2} {3} on {4}.", - countersInNode.Count, counterLifecycleType.ToString().ToLowerInvariant(), counterType, "counter".Pluralize(countersInNode.Count), host.Name); + countersInNode.Count, counterLifecycleType.ToString().ToLowerInvariant(), counterType, "counter".Pluralize(countersInNode.Count), host.Address); counters.AddRange(countersInNode); } } diff --git a/TabMon/CounterConfig/MBeanCounterConfigReader.cs b/TabMon/CounterConfig/MBeanCounterConfigReader.cs index 690f73b..09412a8 100644 --- a/TabMon/CounterConfig/MBeanCounterConfigReader.cs +++ b/TabMon/CounterConfig/MBeanCounterConfigReader.cs @@ -43,7 +43,7 @@ public ICollection LoadCounters(XmlNode root, Host host, CounterLifecy // Retrieve a collection of all available clients within the specified port range, then new up counters using those. // This way, multiple counters can share a single client & connection. - var mbeanClientPool = MBeanClientFactory.CreateClients(host.Name, startPort, endPort); + var mbeanClientPool = MBeanClientFactory.CreateClients(host.Address, startPort, endPort); foreach (var mbeanClient in mbeanClientPool) { var countersForSource = BuildCountersForSourceNode(sourceNode, host, mbeanClient, startPort); @@ -123,7 +123,7 @@ private static ICounter BuildCounterFromCounterNode(XmlNode counterNode, IMBeanC catch (Exception ex) { Log.DebugFormat(@"Failed to register MBean counter {0}\{1}\{2}\{3}\{4}: {5}", - host.Name, sourceName, categoryName, counterName, instanceName, ex.Message); + host.Address, sourceName, categoryName, counterName, instanceName, ex.Message); return null; } } diff --git a/TabMon/CounterConfig/PerfmonCounterConfigReader.cs b/TabMon/CounterConfig/PerfmonCounterConfigReader.cs index 45a9c4b..9cd8d97 100644 --- a/TabMon/CounterConfig/PerfmonCounterConfigReader.cs +++ b/TabMon/CounterConfig/PerfmonCounterConfigReader.cs @@ -1,7 +1,9 @@ -using System; +using log4net; +using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; +using System.Reflection; using System.Xml; using TabMon.Counters; using TabMon.Counters.Perfmon; @@ -14,6 +16,8 @@ namespace TabMon.CounterConfig /// internal sealed class PerfmonCounterConfigReader : ICounterConfigReader { + private static readonly ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + /// /// Parses & loads all Perfmon counters for the given host using the XML tree. /// @@ -26,47 +30,63 @@ public ICollection LoadCounters(XmlNode root, Host host, CounterLifecy var counters = new Collection(); var perfmonCounterNodes = root.SelectNodes("./*/Counter"); - foreach (XmlNode counterNode in perfmonCounterNodes) + try { - // Set what we know. - var counterName = counterNode.Attributes["name"].Value; - var categoryName = counterNode.ParentNode.Attributes["name"].Value; - string unitOfMeasurement = null; - if (counterNode.Attributes.GetNamedItem("unit") != null) + foreach (XmlNode counterNode in perfmonCounterNodes) { - unitOfMeasurement = counterNode.Attributes["unit"].Value; + counters.AddRange(LoadCountersForNode(counterNode, host, lifeCycleTypeToLoad)); } + } + catch (System.IO.IOException ex) + { + Log.ErrorFormat("Unable to load PerfMon counters for host {0}: {1}Please verify that the computer name is configured correctly.", host, ex.Message); + } + + return counters; + } + + private ICollection LoadCountersForNode(XmlNode counterNode, Host host, CounterLifecycleType lifeCycleTypeToLoad) + { + var counters = new Collection(); + + // Set what we know. + var counterName = counterNode.Attributes["name"].Value; + var categoryName = counterNode.ParentNode.Attributes["name"].Value; + string unitOfMeasurement = null; + if (counterNode.Attributes.GetNamedItem("unit") != null) + { + unitOfMeasurement = counterNode.Attributes["unit"].Value; + } - // If any instance names are called out, shove them into a list of filters. - var instanceFilters = new HashSet(); - if (counterNode.HasChildNodes) + // If any instance names are called out, shove them into a list of filters. + var instanceFilters = new HashSet(); + if (counterNode.HasChildNodes) + { + var instanceNodes = counterNode.SelectNodes("./Instance"); + if (instanceNodes == null) { - var instanceNodes = counterNode.SelectNodes("./Instance"); - if (instanceNodes == null) - { - continue; - } + return counters; + } - foreach (var instanceNode in instanceNodes.Cast().Where(instanceNode => instanceNode.Attributes.GetNamedItem("name") != null)) + foreach (var instanceNode in instanceNodes.Cast().Where(instanceNode => instanceNode.Attributes.GetNamedItem("name") != null)) + { + string instanceName = instanceNode.Attributes["name"].Value; + CounterLifecycleType configuredCounterLifecycleType = GetConfiguredInstanceLifecycleType(instanceNode); + if (configuredCounterLifecycleType == lifeCycleTypeToLoad) { - string instanceName = instanceNode.Attributes["name"].Value; - CounterLifecycleType configuredCounterLifecycleType = GetConfiguredInstanceLifecycleType(instanceNode); - if (configuredCounterLifecycleType == lifeCycleTypeToLoad) - { - instanceFilters.Add(instanceName); - } + instanceFilters.Add(instanceName); } } + } - // Load an instance of this perfmon counter for each matching instance name that exists. - // If no instance name is specified, just load them all. - if (lifeCycleTypeToLoad == CounterLifecycleType.Persistent || instanceFilters.Count > 0) + // Load an instance of this perfmon counter for each matching instance name that exists. + // If no instance name is specified, just load them all. + if (lifeCycleTypeToLoad == CounterLifecycleType.Persistent || instanceFilters.Count > 0) + { + var counterInstances = PerfmonCounterLoader.LoadInstancesForCounter(host, lifeCycleTypeToLoad, categoryName, counterName, unitOfMeasurement, instanceFilters); + foreach (var counterInstance in counterInstances) { - var counterInstances = PerfmonCounterLoader.LoadInstancesForCounter(host, lifeCycleTypeToLoad, categoryName, counterName, unitOfMeasurement, instanceFilters); - foreach (var counterInstance in counterInstances) - { - counters.Add(counterInstance); - } + counters.Add(counterInstance); } } diff --git a/TabMon/Counters/Perfmon/PerfmonCounter.cs b/TabMon/Counters/Perfmon/PerfmonCounter.cs index 51b7b34..169a5d0 100644 --- a/TabMon/Counters/Perfmon/PerfmonCounter.cs +++ b/TabMon/Counters/Perfmon/PerfmonCounter.cs @@ -38,7 +38,7 @@ public PerfmonCounter(Host host, CounterLifecycleType lifecycleType, string coun Counter = counterName; Instance = instance; Unit = unit; - perfmonCounter = new PerformanceCounter(Category, Counter, Instance, Host.Name); + perfmonCounter = new PerformanceCounter(Category, Counter, Instance, Host.ComputerName); } ~PerfmonCounter() diff --git a/TabMon/Counters/Perfmon/PerfmonCounterLoader.cs b/TabMon/Counters/Perfmon/PerfmonCounterLoader.cs index f2b8599..19dd205 100644 --- a/TabMon/Counters/Perfmon/PerfmonCounterLoader.cs +++ b/TabMon/Counters/Perfmon/PerfmonCounterLoader.cs @@ -32,22 +32,22 @@ public static IList LoadInstancesForCounter(Host host, CounterLi IList counters = new List(); // If the requested category does not exist, log it and bail out. - if (!ExistsCategory(categoryName, host.Name)) + if (!ExistsCategory(categoryName, host.ComputerName)) { Log.WarnFormat("PerfMon counter category '{0}' on host '{1}' does not exist.", - categoryName, host.Name); + categoryName, host.ComputerName); return counters; } // If the requested counter does not exist, log it and bail out. - if (!ExistsCounter(counterName, categoryName, host.Name)) + if (!ExistsCounter(counterName, categoryName, host.ComputerName)) { Log.DebugFormat("PerfMon counter '{0}' in category '{1}' on host '{2}' does not exist.", - counterName, categoryName, host.Name); + counterName, categoryName, host.ComputerName); return counters; } - var category = new PerformanceCounterCategory(categoryName, host.Name); + var category = new PerformanceCounterCategory(categoryName, host.ComputerName); // Perfmon has both "single-instance" and "multi-instance" counter types -- we need to handle both appropriately. switch (category.CategoryType) @@ -65,7 +65,7 @@ public static IList LoadInstancesForCounter(Host host, CounterLi } break; default: - Log.ErrorFormat("Unable to determine category type of PerfMon counter '{0}' in category '{1}' on host '{2}' is unknown; skipping loading it.", counterName, categoryName, host.Name); + Log.ErrorFormat("Unable to determine category type of PerfMon counter '{0}' in category '{1}' on host '{2}' is unknown; skipping loading it.", counterName, categoryName, host.ComputerName); break; } diff --git a/TabMon/Helpers/Host.cs b/TabMon/Helpers/Host.cs index 7ff3964..26ed854 100644 --- a/TabMon/Helpers/Host.cs +++ b/TabMon/Helpers/Host.cs @@ -5,18 +5,20 @@ /// public sealed class Host { - public string Name { get; private set; } + public string Address { get; private set; } + public string ComputerName { get; private set; } public string Cluster { get; private set; } - public Host(string name, string cluster) + public Host(string address, string computerName, string cluster) { - Name = name; + Address = address; + ComputerName = computerName; Cluster = cluster; } public override string ToString() { - return Cluster + "\\" + Name; + return Cluster + "\\" + Address + "\\" + ComputerName; } } } diff --git a/TabMon/Helpers/HostNameHelper.cs b/TabMon/Helpers/HostNameHelper.cs deleted file mode 100644 index 2045fc7..0000000 --- a/TabMon/Helpers/HostNameHelper.cs +++ /dev/null @@ -1,45 +0,0 @@ -using log4net; -using System; -using System.Net; -using System.Reflection; - -namespace TabMon.Helpers -{ - /// - /// Helper class to handle resolving hostnames. - /// - public static class HostnameHelper - { - private static readonly ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - #region Public Methods - - /// - /// Given a hostname or IP address, attempts to resolve it to a simple machine name. - /// - /// A hostname or IP address which we may be unsure of the validity of. - /// A valid hostname without any trailing domain information, or else null if we failed to resolve. - public static string Resolve(string unresolvedHostName) - { - try - { - var hostEntry = Dns.GetHostEntry(unresolvedHostName); - var resolvedHostName = hostEntry.HostName; - // Strip off domain, if applicable. - if (resolvedHostName.Split('.').Length >= 2) - { - resolvedHostName = resolvedHostName.Substring(0, resolvedHostName.IndexOf('.')); - } - Log.Debug(String.Format("Successfully resolved '{0}' to '{1}'.", unresolvedHostName, resolvedHostName)); - return resolvedHostName; - } - catch (Exception ex) - { - Log.Error(String.Format("Could not resolve hostname for '{0}': {1}", unresolvedHostName, ex.Message)); - return null; - } - } - - #endregion - } -} \ No newline at end of file diff --git a/TabMon/Resources/TabMonConfig.xsd b/TabMon/Resources/TabMonConfig.xsd index a338543..44fe285 100644 --- a/TabMon/Resources/TabMonConfig.xsd +++ b/TabMon/Resources/TabMonConfig.xsd @@ -87,7 +87,12 @@ - + + + The computer name of the host to monitor. + + + The hostname or IP address of the host to monitor. diff --git a/TabMon/Sampler/CounterSampler.cs b/TabMon/Sampler/CounterSampler.cs index 33a9498..91a958e 100644 --- a/TabMon/Sampler/CounterSampler.cs +++ b/TabMon/Sampler/CounterSampler.cs @@ -150,7 +150,7 @@ private static DataRow MapToSchema(ICounterSample sample, DataTable tableSchema, var counter = sample.Counter; row["timestamp"] = pollTimestamp; row["cluster"] = counter.Host.Cluster; - row["machine"] = counter.Host.Name.ToLower(); + row["machine"] = counter.Host.Address; row["counter_type"] = counter.CounterType; row["source"] = counter.Source; row["category"] = counter.Category; diff --git a/TabMon/TabMon.csproj b/TabMon/TabMon.csproj index 6129cc6..5c250f1 100644 --- a/TabMon/TabMon.csproj +++ b/TabMon/TabMon.csproj @@ -147,7 +147,6 @@ - diff --git a/TabMon/TabMonConfig/TabMonConfigReader.cs b/TabMon/TabMonConfig/TabMonConfigReader.cs index acee10a..cdff472 100644 --- a/TabMon/TabMonConfig/TabMonConfigReader.cs +++ b/TabMon/TabMonConfig/TabMonConfigReader.cs @@ -73,8 +73,7 @@ public static void LoadOptions() var clusterName = cluster.Name; foreach (Host host in cluster) { - var resolvedHostname = HostnameHelper.Resolve(host.Name); - options.Hosts.Add(new Helpers.Host(resolvedHostname, clusterName)); + options.Hosts.Add(new Helpers.Host(host.Address, host.ComputerName, clusterName)); } } } diff --git a/TabMon/TabMonConfig/TabMonConfigSection.cs b/TabMon/TabMonConfig/TabMonConfigSection.cs index d2deb48..00f8df8 100644 --- a/TabMon/TabMonConfig/TabMonConfigSection.cs +++ b/TabMon/TabMonConfig/TabMonConfigSection.cs @@ -254,7 +254,7 @@ protected override bool IsElementName(string elementName) [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ConfigurationSectionDesigner.CsdFileGenerator", "2.0.1.7")] protected override object GetElementKey(global::System.Configuration.ConfigurationElement element) { - return ((global::TabMon.Config.Host)(element)).Name; + return ((global::TabMon.Config.Host)(element)).Address; } /// @@ -287,13 +287,13 @@ protected override object GetElementKey(global::System.Configuration.Configurati /// /// Gets the with the specified key. /// - /// The key of the to retrieve. + /// The key of the to retrieve. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ConfigurationSectionDesigner.CsdFileGenerator", "2.0.1.7")] - public global::TabMon.Config.Host this[object name] + public global::TabMon.Config.Host this[object address] { get { - return ((global::TabMon.Config.Host)(base.BaseGet(name))); + return ((global::TabMon.Config.Host)(base.BaseGet(address))); } } #endregion @@ -336,11 +336,11 @@ public void Remove(global::TabMon.Config.Host Host) /// /// Gets the with the specified key. /// - /// The key of the to retrieve. + /// The key of the to retrieve. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ConfigurationSectionDesigner.CsdFileGenerator", "2.0.1.7")] - public global::TabMon.Config.Host GetItemByKey(string name) + public global::TabMon.Config.Host GetItemByKey(string address) { - return ((global::TabMon.Config.Host)(base.BaseGet(((object)(name))))); + return ((global::TabMon.Config.Host)(base.BaseGet(((object)(address))))); } #endregion @@ -610,12 +610,39 @@ public override bool IsReadOnly() } #endregion - #region Name Property + #region ComputerName Property /// - /// The XML name of the property. + /// The XML name of the property. /// [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ConfigurationSectionDesigner.CsdFileGenerator", "2.0.1.7")] - internal const string NamePropertyName = "name"; + internal const string ComputerNamePropertyName = "computerName"; + + /// + /// Gets or sets the computer name of the host to monitor. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ConfigurationSectionDesigner.CsdFileGenerator", "2.0.1.7")] + [global::System.ComponentModel.DescriptionAttribute("The computer name of the host to monitor.")] + [global::System.Configuration.StringValidatorAttribute(InvalidCharacters="", MaxLength=2147483647, MinLength=1)] + [global::System.Configuration.ConfigurationPropertyAttribute(global::TabMon.Config.Host.ComputerNamePropertyName, IsRequired=true, IsKey=false, IsDefaultCollection=false, DefaultValue="YOURCOMPUTERNAME")] + public virtual string ComputerName + { + get + { + return ((string)(base[global::TabMon.Config.Host.ComputerNamePropertyName])); + } + set + { + base[global::TabMon.Config.Host.ComputerNamePropertyName] = value; + } + } + #endregion + + #region Address Property + /// + /// The XML name of the property. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ConfigurationSectionDesigner.CsdFileGenerator", "2.0.1.7")] + internal const string AddressPropertyName = "address"; /// /// Gets or sets the hostname or IP address of the host to monitor. @@ -623,16 +650,16 @@ public override bool IsReadOnly() [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ConfigurationSectionDesigner.CsdFileGenerator", "2.0.1.7")] [global::System.ComponentModel.DescriptionAttribute("The hostname or IP address of the host to monitor.")] [global::System.Configuration.StringValidatorAttribute(InvalidCharacters="", MaxLength=2147483647, MinLength=1)] - [global::System.Configuration.ConfigurationPropertyAttribute(global::TabMon.Config.Host.NamePropertyName, IsRequired=true, IsKey=true, IsDefaultCollection=false, DefaultValue="localhost")] - public virtual string Name + [global::System.Configuration.ConfigurationPropertyAttribute(global::TabMon.Config.Host.AddressPropertyName, IsRequired=true, IsKey=true, IsDefaultCollection=false, DefaultValue="localhost")] + public virtual string Address { get { - return ((string)(base[global::TabMon.Config.Host.NamePropertyName])); + return ((string)(base[global::TabMon.Config.Host.AddressPropertyName])); } set { - base[global::TabMon.Config.Host.NamePropertyName] = value; + base[global::TabMon.Config.Host.AddressPropertyName] = value; } } #endregion diff --git a/TabMonConfigSectionGenerator/ConfigurationSection.csd b/TabMonConfigSectionGenerator/ConfigurationSection.csd index 98690cf..06d476f 100644 --- a/TabMonConfigSectionGenerator/ConfigurationSection.csd +++ b/TabMonConfigSectionGenerator/ConfigurationSection.csd @@ -99,7 +99,15 @@ - + + + + + + + + + diff --git a/TabMonConfigSectionGenerator/ConfigurationSection.csd.cs b/TabMonConfigSectionGenerator/ConfigurationSection.csd.cs index d2deb48..00f8df8 100644 --- a/TabMonConfigSectionGenerator/ConfigurationSection.csd.cs +++ b/TabMonConfigSectionGenerator/ConfigurationSection.csd.cs @@ -254,7 +254,7 @@ protected override bool IsElementName(string elementName) [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ConfigurationSectionDesigner.CsdFileGenerator", "2.0.1.7")] protected override object GetElementKey(global::System.Configuration.ConfigurationElement element) { - return ((global::TabMon.Config.Host)(element)).Name; + return ((global::TabMon.Config.Host)(element)).Address; } /// @@ -287,13 +287,13 @@ protected override object GetElementKey(global::System.Configuration.Configurati /// /// Gets the with the specified key. /// - /// The key of the to retrieve. + /// The key of the to retrieve. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ConfigurationSectionDesigner.CsdFileGenerator", "2.0.1.7")] - public global::TabMon.Config.Host this[object name] + public global::TabMon.Config.Host this[object address] { get { - return ((global::TabMon.Config.Host)(base.BaseGet(name))); + return ((global::TabMon.Config.Host)(base.BaseGet(address))); } } #endregion @@ -336,11 +336,11 @@ public void Remove(global::TabMon.Config.Host Host) /// /// Gets the with the specified key. /// - /// The key of the to retrieve. + /// The key of the to retrieve. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ConfigurationSectionDesigner.CsdFileGenerator", "2.0.1.7")] - public global::TabMon.Config.Host GetItemByKey(string name) + public global::TabMon.Config.Host GetItemByKey(string address) { - return ((global::TabMon.Config.Host)(base.BaseGet(((object)(name))))); + return ((global::TabMon.Config.Host)(base.BaseGet(((object)(address))))); } #endregion @@ -610,12 +610,39 @@ public override bool IsReadOnly() } #endregion - #region Name Property + #region ComputerName Property /// - /// The XML name of the property. + /// The XML name of the property. /// [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ConfigurationSectionDesigner.CsdFileGenerator", "2.0.1.7")] - internal const string NamePropertyName = "name"; + internal const string ComputerNamePropertyName = "computerName"; + + /// + /// Gets or sets the computer name of the host to monitor. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ConfigurationSectionDesigner.CsdFileGenerator", "2.0.1.7")] + [global::System.ComponentModel.DescriptionAttribute("The computer name of the host to monitor.")] + [global::System.Configuration.StringValidatorAttribute(InvalidCharacters="", MaxLength=2147483647, MinLength=1)] + [global::System.Configuration.ConfigurationPropertyAttribute(global::TabMon.Config.Host.ComputerNamePropertyName, IsRequired=true, IsKey=false, IsDefaultCollection=false, DefaultValue="YOURCOMPUTERNAME")] + public virtual string ComputerName + { + get + { + return ((string)(base[global::TabMon.Config.Host.ComputerNamePropertyName])); + } + set + { + base[global::TabMon.Config.Host.ComputerNamePropertyName] = value; + } + } + #endregion + + #region Address Property + /// + /// The XML name of the property. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ConfigurationSectionDesigner.CsdFileGenerator", "2.0.1.7")] + internal const string AddressPropertyName = "address"; /// /// Gets or sets the hostname or IP address of the host to monitor. @@ -623,16 +650,16 @@ public override bool IsReadOnly() [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ConfigurationSectionDesigner.CsdFileGenerator", "2.0.1.7")] [global::System.ComponentModel.DescriptionAttribute("The hostname or IP address of the host to monitor.")] [global::System.Configuration.StringValidatorAttribute(InvalidCharacters="", MaxLength=2147483647, MinLength=1)] - [global::System.Configuration.ConfigurationPropertyAttribute(global::TabMon.Config.Host.NamePropertyName, IsRequired=true, IsKey=true, IsDefaultCollection=false, DefaultValue="localhost")] - public virtual string Name + [global::System.Configuration.ConfigurationPropertyAttribute(global::TabMon.Config.Host.AddressPropertyName, IsRequired=true, IsKey=true, IsDefaultCollection=false, DefaultValue="localhost")] + public virtual string Address { get { - return ((string)(base[global::TabMon.Config.Host.NamePropertyName])); + return ((string)(base[global::TabMon.Config.Host.AddressPropertyName])); } set { - base[global::TabMon.Config.Host.NamePropertyName] = value; + base[global::TabMon.Config.Host.AddressPropertyName] = value; } } #endregion diff --git a/TabMonConfigSectionGenerator/ConfigurationSection.csd.diagram b/TabMonConfigSectionGenerator/ConfigurationSection.csd.diagram index 2454fcc..078da73 100644 --- a/TabMonConfigSectionGenerator/ConfigurationSection.csd.diagram +++ b/TabMonConfigSectionGenerator/ConfigurationSection.csd.diagram @@ -86,14 +86,14 @@ - + - - + + - + diff --git a/TabMonConfigSectionGenerator/ConfigurationSection.csd.xsd b/TabMonConfigSectionGenerator/ConfigurationSection.csd.xsd index a338543..44fe285 100644 --- a/TabMonConfigSectionGenerator/ConfigurationSection.csd.xsd +++ b/TabMonConfigSectionGenerator/ConfigurationSection.csd.xsd @@ -87,7 +87,12 @@ - + + + The computer name of the host to monitor. + + + The hostname or IP address of the host to monitor.