protected override void ProcessRecord()
        {
            var countersAreGood = PerformanceCounterSetup.CheckCounters();

            WriteVerbose(countersAreGood
                             ? "NServiceBus Performance Counters are setup and ready for use with NServiceBus."
                             : "NServiceBus Performance Counters are not properly configured.");

            WriteObject(countersAreGood);
        }
        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();
        }
Example #4
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();
        }