diff --git a/cmd/alltxt2csv/main.go b/cmd/alltxt2csv/main.go index f802d98..6784728 100644 --- a/cmd/alltxt2csv/main.go +++ b/cmd/alltxt2csv/main.go @@ -13,7 +13,7 @@ import ( "sync" // "github.com/mmcloughlin/geohash" // "github.com/tzneal/ham-go/dxcc" - "github.com/denzs/wsjtx_dashboards/shared/wsjtx" + "github.com/denzs/wsjtx-dashboards/shared/wsjtx" ) var station string diff --git a/cmd/pskreporter-exporter/mysql.go b/cmd/pskreporter-exporter/mysql.go index ef015e9..f2b15bb 100644 --- a/cmd/pskreporter-exporter/mysql.go +++ b/cmd/pskreporter-exporter/mysql.go @@ -3,7 +3,7 @@ package main import ( log "github.com/sirupsen/logrus" "database/sql" - "time" +// "time" _ "github.com/go-sql-driver/mysql" // "github.com/denzs/wsjtx_dashboards/shared/wsjtx" ) @@ -17,10 +17,10 @@ func handleMysql(r report) { // log.Infof("handleMysql(%+v)",r) - stmt, err := db.Prepare("INSERT INTO " + mysql_table + " (ts, station, callsign, band, mode, report, dxcc, geohash, continent, cqzone, ituzone) VALUES(?,?,?,?,?,?,?,?,?,?,?)") + stmt, err := db.Prepare("INSERT INTO " + mysql_table + " (ts, station, callsign, band, mode, report, dxcc, geohash, continent, cqzone, ituzone) VALUES(FROM_UNIXTIME(?),?,?,?,?,?,?,?,?,?,?)") defer stmt.Close() - _, err = stmt.Exec(time.Unix(r.lastReport, 0), station, r.CallSign, r.Band, r.Mode, r.Signal, r.Dxcc, r.GeoHash, r.Continent, r.CQZone, r.ITUZone) + _, err = stmt.Exec(r.lastReport, station, r.CallSign, r.Band, r.Mode, r.Signal, r.Dxcc, r.GeoHash, r.Continent, r.CQZone, r.ITUZone) if err != nil { log.WithFields(log.Fields{"err":err.Error()}).Warn("error while executing prepared statement..") diff --git a/cmd/wsjtx-exporter/main.go b/cmd/wsjtx-exporter/main.go index acb1260..df25b04 100644 --- a/cmd/wsjtx-exporter/main.go +++ b/cmd/wsjtx-exporter/main.go @@ -5,7 +5,7 @@ import ( "fmt" log "github.com/sirupsen/logrus" "net/http" - "github.com/denzs/wsjtx_dashboards/shared/wsjtx" + "github.com/denzs/wsjtx-dashboards/shared/wsjtx" "github.com/hpcloud/tail" "github.com/prometheus/client_golang/prometheus/promhttp" "os" diff --git a/cmd/wsjtx-exporter/mysql.go b/cmd/wsjtx-exporter/mysql.go index 91b6268..6c43562 100644 --- a/cmd/wsjtx-exporter/mysql.go +++ b/cmd/wsjtx-exporter/mysql.go @@ -4,7 +4,7 @@ import ( log "github.com/sirupsen/logrus" "database/sql" _ "github.com/go-sql-driver/mysql" - "github.com/denzs/wsjtx_dashboards/shared/wsjtx" + "github.com/denzs/wsjtx-dashboards/shared/wsjtx" ) func handleMysql(result wsjtx.Result) { @@ -14,10 +14,10 @@ func handleMysql(result wsjtx.Result) { } defer db.Close() - stmt, err := db.Prepare("INSERT INTO wsjtx_all_txt(ts, station, callsign, band, mode, report, dxcc, geohash, continent, cqzone, ituzone, rx) VALUES(?,?,?,?,?,?,?,?,?,?,?,?)") + stmt, err := db.Prepare("INSERT INTO wsjtx_all_txt(ts, station, callsign, band, mode, report, dxcc, geohash, continent, cqzone, ituzone, rx) VALUES(FROM_UNIXTIME(?),?,?,?,?,?,?,?,?,?,?,?)") defer stmt.Close() - _, err = stmt.Exec(result.Timestamp, station, result.Call, result.Band, result.Mode, result.Signal, result.Ent.Entity, result.GeoHash, result.Ent.Continent, result.Ent.CQZone, result.Ent.ITUZone, result.Rx) + _, err = stmt.Exec(result.Timestamp.Unix(), station, result.Call, result.Band, result.Mode, result.Signal, result.Ent.Entity, result.GeoHash, result.Ent.Continent, result.Ent.CQZone, result.Ent.ITUZone, result.Rx) if err != nil { log.WithFields(log.Fields{"err":err.Error()}).Warn("error while executing prepared statement..") @@ -70,7 +70,8 @@ func init_db() { func dbConn() (db *sql.DB, err bool){ - db, er := sql.Open("mysql", mysql_user+":"+mysql_pass+"@tcp("+mysql_host+")/"+mysql_db) + //db, er := sql.Open("mysql", mysql_user + ":" + mysql_pass + "@tcp(" + mysql_host + ")/" + mysql_db + "?parseTime=true&time_zone=%27UTC%27") + db, er := sql.Open("mysql", mysql_user + ":" + mysql_pass + "@tcp(" + mysql_host + ")/" + mysql_db) if er != nil { log.Error("db not reachable: %s",err) return nil, true diff --git a/cmd/wsjtx-exporter/prometheus.go b/cmd/wsjtx-exporter/prometheus.go index f201a9a..6ac26e9 100644 --- a/cmd/wsjtx-exporter/prometheus.go +++ b/cmd/wsjtx-exporter/prometheus.go @@ -2,7 +2,7 @@ package main import ( "fmt" - "github.com/denzs/wsjtx_dashboards/shared/wsjtx" + "github.com/denzs/wsjtx-dashboards/shared/wsjtx" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" log "github.com/sirupsen/logrus" diff --git a/todo.md b/todo.md index 780c253..b30da65 100644 --- a/todo.md +++ b/todo.md @@ -5,7 +5,11 @@ * alternativ findposition mechanik implementieren (automatischer rewind auf basis des letzten mysql eintrages) * smarter move um sich als windows dienst einzutragen -* research how to reduce result set effectively in mysql +* Username=Station (=~ Callsign) right?!? + +* dashboards + * build combined rx/tx panels (at least map and diagram.. maybe lotw/cqrlog) :) + * research how to reduce result set effectively in mysql * primary key um band ergaenzen? @@ -14,8 +18,25 @@ * database * propably more indices +* endpoint + * no db -> client should wait! + +* mod_gzip nac vorne raus? + +* LOGBOOK + * integrate cqrlog db + * make some awesome queries!! :D + * userfriendly cqrlog backup import + * upload folder via webdav via user auth erreichbar + * logbook import job via systemd timer oder event oder so? + * MySQL - * timestamp vs datetime aus sicht von grafana + * timestamp vs datetime aus sicht von grafana UND UEBERHAUPT VON MYSQL SELBER UND UEBERHAUPT ALLEN?! ALTER WTF!! + * select ts zeigt korrekte/utc time an + * select unix_timestamp(ts) gibt zwar n int, aber 1h hinter utc + * cet 05:00 + * utc 04:00 + * unix_timestamp(tx) 03:00 als int ^^ * create table aus binaries nehmen? * kontrolle sollte beim db admin liegen