Exemplo n.º 1
0
        private Tuple<string, OutputLevel> CreateMemoryCounter()
        {
            var name = "memory";

            var counters = new List<ICounter> { new Counter("Memory", "*") };
            var response = new CounterGroup(name, 10, 0, counters, new ITag[] { }, CollectorEngineType.Safe);
            return ConvertErrorsToWarnings(CreateFile(name, response));
        }
Exemplo n.º 2
0
        private Tuple<string, OutputLevel> CreateProcessorCounter()
        {
            var name = "processor";

            var counters = new List<ICounter> { new Counter("Processor", "% Processor Time", "*", null, null) };
            var response = new CounterGroup(name, 10, 0, counters, new ITag[] { }, CollectorEngineType.Safe);
            return ConvertErrorsToWarnings(CreateFile(name, response));
        }
Exemplo n.º 3
0
        private Tuple<string,OutputLevel> CreateFile(string name, CounterGroup response)
        {
            var config = _configBusiness.LoadFiles(new string[] { });
            var counterGroups = _counterBusiness.GetPerformanceCounterGroups(config).ToArray();

            if (counterGroups.Any(x => x.Name == response.Name))
            {
                return new Tuple<string, OutputLevel>(string.Format("There is already a counter group named {0}.", response.Name), OutputLevel.Error);
            }

            if (!_configBusiness.CreateConfig(name + ".xml", new List<ICounterGroup> { response }))
            {
                return new Tuple<string, OutputLevel>(string.Format("Did not create {0}, the file {0}.xml" + " already exists.", name), OutputLevel.Error);
            }

            return new Tuple<string, OutputLevel>(string.Format("Created counter config {0}.", name), OutputLevel.Information);
        }
Exemplo n.º 4
0
 public Tuple<string, Tuple<string, OutputLevel>> CreateCounter(string groupName, int secondsInterval, int refreshInstanceInterval, List<ICounter> counters, CollectorEngineType collectorEngineType)
 {
     var response = new CounterGroup(groupName, secondsInterval, refreshInstanceInterval, counters, new ITag[] { }, collectorEngineType);
     var message = CreateFile(groupName, response);
     return new Tuple<string, Tuple<string, OutputLevel>>(groupName, message);
 }
Exemplo n.º 5
0
 public Tuple<string, Tuple<string, OutputLevel>> CreateCounter(string groupName, int secondsInterval, List<ICounter> counters)
 {
     var response = new CounterGroup(groupName, secondsInterval, counters, new ITag[] { });
     var message = CreateFile(groupName, response);
     return new Tuple<string, Tuple<string, OutputLevel>>(groupName, message);
 }