protected override void ProcessRecord()
 {
     var performanceCounterSetup = new PerformanceCounterSetup(Host);
     if (performanceCounterSetup.DoesCategoryExist())
     {
         performanceCounterSetup.DeleteCategory();
     }
     else
     {
         WriteWarning("NServiceBus Performance Counters were not installed");
     }
 }
        protected override void ProcessRecord()
        {
            var performanceCounterSetup = new PerformanceCounterSetup(Host);

            if (performanceCounterSetup.DoesCategoryExist())
            {
                performanceCounterSetup.DeleteCategory();
            }
            else
            {
                WriteWarning("NServiceBus Performance Counters were not installed");
            }
        }
        void Create()
        {
            var setup = new PerformanceCounterSetup(Host);
            var allCountersExist = setup.CheckCounters();
            if (allCountersExist)
            {
                return;
            }

            if (setup.DoesCategoryExist())
            {
                var exception = new Exception("Existing category is not configured correctly. Use the -Force option to delete and re-create");
                var errorRecord = new ErrorRecord(exception, "FailedToCreateCategory", ErrorCategory.NotSpecified, null);
                ThrowTerminatingError(errorRecord);
            }
            setup.SetupCounters();
        }
        void Create()
        {
            var setup            = new PerformanceCounterSetup(Host);
            var allCountersExist = setup.CheckCounters();

            if (allCountersExist)
            {
                return;
            }

            if (setup.DoesCategoryExist())
            {
                var exception   = new Exception("Existing category is not configured correctly. Use the -Force option to delete and re-create");
                var errorRecord = new ErrorRecord(exception, "FailedToCreateCategory", ErrorCategory.NotSpecified, null);
                ThrowTerminatingError(errorRecord);
            }
            setup.SetupCounters();
        }
Exemple #5
0
        void Create()
        {
            var allCountersExist = PerformanceCounterSetup.CheckCounters();

            if (allCountersExist)
            {
                Host.UI.WriteLine("Did not create counters since they already exist");
                return;
            }

            if (PerformanceCounterSetup.DoesCategoryExist())
            {
                var exception   = new Exception("Existing category is not configured correctly. Use the -Force option to delete and re-create");
                var errorRecord = new ErrorRecord(exception, "FailedToCreateCategory", ErrorCategory.NotSpecified, null);
                ThrowTerminatingError(errorRecord);
            }

            Host.UI.WriteLine("Creating counters");
            PerformanceCounterSetup.SetupCounters();
        }