Exemple #1
0
        public static ActionResult InstallPerformanceCounters(Session session)
        {
            session.Log("Installing NSB performance counters.");

            try
            {
                CaptureOut(() =>
                {
                    if (PerformanceCounterSetup.SetupCounters(true))
                    {
                        session.Log("NSB performance counters installed.");
                    }
                    else
                    {
                        session.Log("NSB performance counters already installed.");
                    }
                }, session);

                return(ActionResult.Success);
            }
            catch (Exception)
            {
                return(ActionResult.Failure);
            }
        }
Exemple #2
0
        public void Install(WindowsIdentity identity)
        {
            Console.WriteLine("Starting installation of PerformanceCounters ");

            PerformanceCounterSetup.SetupCounters(true);

            Console.WriteLine("Installation of PerformanceCounters successful.");
        }
 public void TearDown()
 {
     PerformanceCounter.CloseSharedResources();
     if (PerformanceCounterCategory.Exists("NServiceBus"))
     {
         PerformanceCounterSetup.DeleteCategory();
     }
 }
        public void DoAllCountersExist_returns_false_when_some_counters_are_missing_exist()
        {
            var counters = new CounterCreationDataCollection
            {
                new CounterCreationData("Critical Time", "Age of the oldest message in the queue.", PerformanceCounterType.NumberOfItems32),
            };

            PerformanceCounterCategory.Create("NServiceBus", "NServiceBus statistics", PerformanceCounterCategoryType.MultiInstance, counters);
            PerformanceCounter.CloseSharedResources();
            Assert.IsFalse(PerformanceCounterSetup.CheckCounters());
        }
 public void DoAllCountersExist_returns_true_when_all_exist()
 {
     PerformanceCounterSetup.SetupCounters();
     PerformanceCounter.CloseSharedResources();
     Assert.IsTrue(PerformanceCounterSetup.CheckCounters());
 }
 public void DoAllCountersExist_returns_false_when_category_missing()
 {
     Assert.IsFalse(PerformanceCounterSetup.CheckCounters());
 }