Exemplo n.º 1
0
 public static void AddAgentMetadata(DataTable table)
 {
     AddMetadata(table, LogTables.makeServerLogsTable("json"));
     AddMetadata(table, LogTables.makeServerLogsTable("plain"));
     AddMetadata(table, ThreadTables.makeThreadInfoTable());
     AddMetadata(table, CounterSampler.makeCounterSamplesTable());
 }
Exemplo n.º 2
0
        /// <summary>
        /// Starts up the agent.
        /// </summary>
        public void Start()
        {
            Log.Info("Initializing TabMon..");

            // Assert that runtime options are valid.
            if (!TabMonOptions.Instance.Valid())
            {
                Log.Fatal("Invalid TabMon options specified!\nAborting..");
                return;
            }

            // Spin up counter sampler.
            try
            {
                sampler = new CounterSampler(options.Hosts, options.TableName);
            }
            catch (Exception ex)
            {
                Log.ErrorFormat("Failed to initialize counter sampler using counters from configuration file: {0}\nAborting..", ex.Message);
                return;
            }

            // Kick off the polling timer.
            Log.Info("TabMon initialized!  Starting performance counter polling..");
            timer = new Timer(callback: OnTimer, state: null, dueTime: 0, period: options.PollInterval * 1000);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Starts up the agent.
        /// </summary>
        public void Start()
        {
            Log.Info("Initializing TabMon..");

            // Assert that runtime options are valid.
            if (!TabMonOptions.Instance.Valid())
            {
                Log.Fatal("Invalid TabMon options specified!\nAborting..");
                return;
            }

            // Read Counters.config & create counters.
            Log.Info(String.Format(@"Loading performance counters from {0}\{1}..", Directory.GetCurrentDirectory(), PathToCountersConfig));
            ICollection <ICounter> counters;

            try
            {
                counters = CounterConfigLoader.Load(PathToCountersConfig, options.Hosts);
            }
            catch (ConfigurationErrorsException ex)
            {
                Log.Error(String.Format("Failed to correctly load '{0}': {1}\nAborting..", PathToCountersConfig, ex.Message));
                return;
            }
            Log.Debug(String.Format("Successfully loaded {0} {1} from configuration file.", counters.Count, "counter".Pluralize(counters.Count)));

            // Spin up counter sampler.
            sampler = new CounterSampler(counters, options.TableName);

            // Kick off the polling timer.
            Log.Info("TabMon initialized!  Starting performance counter polling..");
            timer = new Timer(callback: Poll, state: null, dueTime: 0, period: options.PollInterval * 1000);
        }
        /// <summary>
        /// Starts up the agent.
        /// </summary>
        public void Start()
        {
            Log.Info("Initializing PaletteInsightAgent..");

            // Assert that runtime options are valid.
            if (!PaletteInsightAgentOptions.Instance.Valid())
            {
                Log.Fatal("Invalid PaletteInsightAgent options specified!\nAborting..");
                return;
            }

            // NOTE: License check disabled as this project became open-source
            //// Check the license every day
            //var oneDayInMs = 24 * 60 * 60 * 1000;
            //licenseCheckTimer = new Timer(callback: licenseGuard.PollLicense, state: options.LicenseKey, dueTime: oneDayInMs, period: oneDayInMs);

            // only start the JMX if we want to
            if (USE_COUNTERSAMPLES)
            {
                ICollection <ICounter> counters;
                try
                {
                    counters = CounterConfigLoader.Load(PathToCountersYaml);
                }
                catch (ConfigurationErrorsException ex)
                {
                    Log.Error("Failed to correctly load '{0}': {1}\nAborting..", PathToCountersYaml, ex.Message);
                    return;
                }

                // Spin up counter sampler.
                sampler = new CounterSampler(counters);

                // Kick off the polling timer.
                Log.Info("PaletteInsightAgent initialized!  Starting performance counter polling..");
                counterSampleTimer = new Timer(callback: PollCounters, state: null, dueTime: 0, period: options.PollInterval * 1000);
            }


            if (USE_LOGPOLLER)
            {
                // Start the log poller agent
                logPollerAgent.start();
                logPollTimer = new Timer(callback: PollLogs, state: null, dueTime: 0, period: options.LogPollInterval * 1000);
            }

            if (USE_THREADINFO)
            {
                // Kick off the thread polling timer
                int dueTime = CalculateDueTime(options.ThreadInfoPollInterval);
                Log.Debug("Due time until the next best timing for thread info poll start: {0} msec", dueTime);
                threadInfoTimer = new Timer(callback: PollThreadInfo, state: null, dueTime: dueTime, period: options.ThreadInfoPollInterval * 1000);
            }

            // send the metadata if there is a tableau repo behind us
            if (IsConnectionToTableauRepoRequired())
            {
                // On start get the schema of the repository tables
                var table = tableauRepo.GetSchemaTable();

                // Add the metadata of the agent table to the schema table
                DataTableUtils.AddAgentMetadata(table);

                // Serialize schema table so that it gets uploaded with all other tables
                OutputSerializer.Write(table, true);

                // Do the same for index data
                table = tableauRepo.GetIndices();
                OutputSerializer.Write(table, true);
            }

            output          = WebserviceOutput.MakeWebservice(options.WebserviceConfig);
            webserviceTimer = new Timer(callback: UploadData, state: output, dueTime: 0, period: options.UploadInterval * 1000);

            if (USE_TABLEAU_REPO)
            {
                // Poll Tableau repository data as well
                repoTablesPollTimer = new Timer(callback: PollFullTables, state: output, dueTime: 0, period: options.RepoTablesPollInterval * 1000);
            }

            if (USE_STREAMING_TABLES)
            {
                streamingTablesPollTimer = new Timer(callback: PollStreamingTables, state: output, dueTime: 0, period: options.StreamingTablesPollInterval * 1000);
            }
        }