Skip to content
Snippets Groups Projects
Commit 8a0c8d9e authored by Lars Janssen's avatar Lars Janssen
Browse files

added group by * and "mean_" prefix to generateFilterForAVGData

parent 7b1ab2bc
No related branches found
No related tags found
No related merge requests found
...@@ -102,16 +102,16 @@ func main() { ...@@ -102,16 +102,16 @@ func main() {
// It creates two databases. // It creates two databases.
normalDB := settings.InfluxDbDatabase normalDB := settings.InfluxDbDatabase
avgDB := normalDB + "_avg" avgDB := normalDB + "_avg"
//rpName := "one_day" rpName := "one_day"
cqName := "avg_values" cqName := "avg_values"
postStrings := []string{ postStrings := []string{
"CREATE DATABASE " + normalDB, "CREATE DATABASE " + normalDB,
"CREATE DATABASE " + avgDB, "CREATE DATABASE " + avgDB,
//"CREATE RETENTION POLICY " + rpName + " ON " + normalDB + "CREATE RETENTION POLICY " + rpName + " ON " + normalDB +
// " DURATION 24h REPLICATION 1 DEFAULT", " DURATION 24h REPLICATION 1 DEFAULT",
"CREATE CONTINUOUS QUERY " + cqName + " ON " + normalDB + " BEGIN" + "CREATE CONTINUOUS QUERY " + cqName + " ON " + normalDB + " BEGIN" +
" SELECT mean(*) INTO " + avgDB + " SELECT mean(*) INTO " + avgDB +
"..:MEASUREMENT FROM /.*/ GROUP BY time(12h) END", "..:MEASUREMENT FROM /.*/ GROUP BY time(12h),* END",
} }
for i := 0; i < len(postStrings); i++ { for i := 0; i < len(postStrings); i++ {
postTODB(postStrings[i], settings) postTODB(postStrings[i], settings)
......
...@@ -174,6 +174,11 @@ func generateFilterForAVGData(s *QueryServer, filter string) string { ...@@ -174,6 +174,11 @@ func generateFilterForAVGData(s *QueryServer, filter string) string {
// Currently, there is only one modification needed so this is a bit redundant. // Currently, there is only one modification needed so this is a bit redundant.
filterModifications := make(map[string]string) filterModifications := make(map[string]string)
filterModifications[s.settings.InfluxDbDatabase] = s.settings.InfluxDbDatabase + averageSuffix filterModifications[s.settings.InfluxDbDatabase] = s.settings.InfluxDbDatabase + averageSuffix
filterModifications[dbMeasurementBrokerFileRequests] = "mean_" + dbMeasurementBrokerFileRequests
filterModifications[dbMeasurementFtsTransfers] = "mean_" + dbMeasurementFtsTransfers
filterModifications[dbMeasurementFileInput] = "mean_" + dbMeasurementFileInput
filterModifications[dbMeasurementRdsCacheMemoryUsage] = "mean_" + dbMeasurementRdsCacheMemoryUsage
filterModifications[dbMeasurementRdsFileRequests] = "mean_" + dbMeasurementRdsFileRequests
alteredFilter := filter alteredFilter := filter
// Do all the filterModifications // Do all the filterModifications
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment