public override IPluginResponse Execute(IPluginRequest pluginRequest) { //Set member variables for execution. this.pluginRequest = pluginRequest; this.logsetHash = pluginRequest.LogsetHash; this.pluginResponse = CreatePluginResponse(); this.workerHostnameMap = ConfigDataHelper.GetWorkerHostnameMap(MongoDatabase); // Create output database. using (var outputDatabase = GetOutputDatabaseConnection()) { CreateTables(outputDatabase); } //Process collections. ProcessCollections(GetMongoCollections()); // Check if we persisted any data. if (!PersistedData()) { Log.Info("Failed to persist any data from Vizqlserver logs!"); pluginResponse.GeneratedNoData = true; } return(pluginResponse); }
public override IPluginResponse Execute(IPluginRequest pluginRequest) { pluginResponse = CreatePluginResponse(); Log.Info("Retrieving configuration information for workers.."); workerHostnameMap = ConfigDataHelper.GetWorkerHostnameMap(MongoDatabase); netstatCollection = MongoDatabase.GetCollection <BsonDocument>(NetstatCollectionName); logsetHash = pluginRequest.LogsetHash; List <NetstatEntry> netstatEntries = new List <NetstatEntry>(); foreach (int workerIndex in workerHostnameMap.Keys) { Log.InfoFormat("Retrieving netstat information for worker {0}..", workerIndex); IEnumerable <NetstatEntry> entriesForWorker = GetNetstatEntriesForWorker(workerIndex); netstatEntries.AddRange(entriesForWorker); } Log.InfoFormat("Writing netstat information to database.."); CreateTables(); PersistNetstatEntries(netstatEntries); Log.Info("Finished processing netstat data!"); // Check if we persisted any data. if (!PersistedData()) { Log.Info("Failed to persist any netstat data!"); pluginResponse.GeneratedNoData = true; } return(pluginResponse); }
public ConfigReader(IMongoDatabase mongoDatabase) { this.mongoDatabase = mongoDatabase; configDocument = LoadConfigDocument(); config = LoadConfig(); fileLastModifiedTimestamp = GetConfigModificationTimestamp(); workerHostnameMap = ConfigDataHelper.GetWorkerHostnameMap(mongoDatabase); }
protected virtual bool ProcessCollections(IList <IMongoCollection <BsonDocument> > collections) { var workerHostnameMap = ConfigDataHelper.GetWorkerHostnameMap(MongoDatabase); var totalVizqlSessions = Queries.GetUniqueSessionIdCount(collections); using (var persister = new ServerSessionPersister(ExtractFactory)) using (GetPersisterStatusWriter(persister, totalVizqlSessions)) { foreach (var collection in collections) { ProcessCollection(collection, persister, workerHostnameMap); } return(persister.ItemsPersisted > 0); } }