Пример #1
0
        public void init()
        {
            try
            {
                modules modules = ((AppConfig)ConfigurationManager.GetSection("munin")).modules;
                foreach (module m in modules)
                {
                    if (m.enabled)
                    {
                        switch (m.name)
                        {
                        case "checkPerfCount":
                            try
                            {
                                performanceCounters perfCounters = ((AppConfig)ConfigurationManager.GetSection("munin")).perfCounters;
                                foreach (performanceCounter perfCounter in perfCounters)
                                {
                                    Plugins.checkPerfCount check = new Plugins.checkPerfCount(perfCounter);
                                    if (check.isOK())
                                    {
                                        activePlugins.Add(check);
                                    }
                                }
                            }
                            catch (System.Configuration.ConfigurationErrorsException ex)
                            {
                                NodeService.log(ex.Message);
                            }
                            break;

                        case "checkExternal":
                            try
                            {
                                externals exs = ((AppConfig)ConfigurationManager.GetSection("munin")).externals;
                                foreach (external x in exs)
                                {
                                    Plugins.checkExternal check = new Plugins.checkExternal(x);
                                    activePlugins.Add(check);
                                }
                            }
                            catch (System.Configuration.ConfigurationErrorsException ex)
                            {
                                NodeService.log(ex.Message);
                            }
                            break;

                        default:
                            moduleConfigs.Add(m);
                            activePlugins.Add((Plugins.NodePlugin)Activator.CreateInstance(null, String.Format("MuninNodeDotNet.Plugins.{0}", m.name)).Unwrap());
                            break;
                        }
                    }
                }
            }
            catch (System.Configuration.ConfigurationErrorsException ex)
            {
                NodeService.log(ex.Message);
            }
        }
Пример #2
0
		public void init()
		{
			try
			{
				modules modules = ((AppConfig)ConfigurationManager.GetSection("munin")).modules;
				foreach (module m in modules)
				{
					if (m.enabled)
					{
						switch (m.name)
						{
							case "checkPerfCount":
								try
								{
									performanceCounters perfCounters = ((AppConfig)ConfigurationManager.GetSection("munin")).perfCounters;
									foreach (performanceCounter perfCounter in perfCounters)
									{
										Plugins.checkPerfCount check = new Plugins.checkPerfCount(perfCounter);
										if (check.isOK())
										{
											activePlugins.Add(check);
										}
									}
								}
								catch (System.Configuration.ConfigurationErrorsException ex)
								{
									NodeService.log(ex.Message);
								}
								break;
							case "checkExternal":
								try
								{
									externals exs = ((AppConfig)ConfigurationManager.GetSection("munin")).externals;
									foreach (external x in exs)
									{
										Plugins.checkExternal check = new Plugins.checkExternal(x);
										activePlugins.Add(check);
									}
								}
								catch (System.Configuration.ConfigurationErrorsException ex)
								{
									NodeService.log(ex.Message);
								}
								break;
							default:
								moduleConfigs.Add(m);
								activePlugins.Add((Plugins.NodePlugin)Activator.CreateInstance(null, String.Format("MuninNodeDotNet.Plugins.{0}", m.name)).Unwrap());
								break;
						}
					}
				}
			}
			catch (System.Configuration.ConfigurationErrorsException ex)
			{
				NodeService.log(ex.Message);
			}
		}