diff --git a/monitoring/monitoring_server/src/asapo_monitoring_server/main/main.go b/monitoring/monitoring_server/src/asapo_monitoring_server/main/main.go
index a143f1243f513e4600b98ceb1f18394690ee0438..720b69c2403c584ec60a9ee9d6d7429fdc3aa5a7 100644
--- a/monitoring/monitoring_server/src/asapo_monitoring_server/main/main.go
+++ b/monitoring/monitoring_server/src/asapo_monitoring_server/main/main.go
@@ -76,9 +76,11 @@ func main() {
 		return
 	}
 	// InfluxDB 1 fix, create database
-	createDB := func(databaseName string) {
+	// Does multiple HTTP posts to DB
+	// It creates two databases, one retention policy and one continuous query on settings.InfluxdbDatabase
+	postTODB := func(queryPostString string) {
 		data := url.Values{}
-		data.Set("q", "CREATE DATABASE "+databaseName)
+		data.Set("q", queryPostString)
 
 		res, err := http.Post(
 			settings.InfluxDbUrl+"/query", "application/x-www-form-urlencoded",
@@ -92,12 +94,25 @@ func main() {
 			rawResponse, _ := ioutil.ReadAll(res.Body)
 			strResponse := string(rawResponse)
 
-			log.Fatal("failed to create database, status code was " + strconv.Itoa(res.StatusCode) + ": " + strResponse)
+			log.Fatal("failed to do the post, post was: " + queryPostString +
+				" and status code was " + strconv.Itoa(res.StatusCode) + ": " + strResponse)
 			return
 		}
 	}
-	createDB(settings.InfluxDbDatabase)
-	createDB(settings.InfluxDbDatabase + "_avg")
+	normalDB := settings.InfluxDbDatabase
+	avgDB := settings.InfluxDbDatabase + "_avg"
+	postStrings := []string{
+		"CREATE DATABASE " + normalDB,
+		"CREATE DATABASE " + avgDB,
+		"CREATE RETENTION POLICY one_day ON " + normalDB +
+			" DURATION 24h REPLICATION 1 DEFAULT",
+		"CREATE CONTINUOUS QUERY ON " + normalDB + // TODO avoid probable error if rp and qc are already excising
+			"BEGIN SELECT mean(*) INTO " + avgDB +
+			".one_day.:MEASUREMENT FROM /.*/ GROUP BY time(12h) END",
+	}
+	for i := 0; i < len(postStrings); i++ {
+		postTODB(postStrings[i])
+	}
 
 	log.SetLevel(logLevel)