Example #1
0
        private static void Main(string[] args)
        {
            var          counters     = new SimpleCounters();
            var          moreCounters = new AdvancedCounters();
            INabbixAgent agent        = new NabbixAgent(10052, counters, moreCounters);

            // 100,000 requests/s for an extended period of time will run out of memory.

            const int numThreads = 16;

            Thread[] threads = new Thread[numThreads];

            for (int i = 0; i < numThreads; i++)
            {
                threads[i] = IncrementCountersOnBackgroundThread(10, counters, moreCounters);
            }

            Console.ReadKey();
            _stopped = true;
            foreach (var thread in threads)
            {
                thread.Join();
            }

            agent.Stop();
        }
Example #2
0
        private static void Main()
        {
            // Create the instance of our counter
            var counters = new MyCounter();

            // Start the agent.
            var agent = new NabbixAgent(10052, counters);

            // Increment the counter. Normally done on API or method call.
            counters.Increment();

            // Shutdown
            Console.ReadKey();
            agent.Stop();
        }
Example #3
0
 public void Dispose()
 {
     _agent.Stop();
 }