Exemple #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();
        }
Exemple #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();
        }
Exemple #3
0
 public NabbixAgentTests()
 {
     _agent = new NabbixAgent("127.0.0.1", 0, new MyCounter());
     _agent.Start();
 }