Browse Source

really last fix for native access version ;)

master
Sebastian Denz 4 years ago
parent
commit
459051bbce
  1. 2
      cmd/alltxt2csv/main.go
  2. 6
      cmd/pskreporter-exporter/mysql.go
  3. 2
      cmd/wsjtx-exporter/main.go
  4. 7
      cmd/wsjtx-exporter/mysql.go
  5. 2
      cmd/wsjtx-exporter/prometheus.go
  6. 23
      todo.md

2
cmd/alltxt2csv/main.go

@ -13,7 +13,7 @@ import (
"sync" "sync"
// "github.com/mmcloughlin/geohash" // "github.com/mmcloughlin/geohash"
// "github.com/tzneal/ham-go/dxcc" // "github.com/tzneal/ham-go/dxcc"
"github.com/denzs/wsjtx_dashboards/shared/wsjtx" "github.com/denzs/wsjtx-dashboards/shared/wsjtx"
) )
var station string var station string

6
cmd/pskreporter-exporter/mysql.go

@ -3,7 +3,7 @@ package main
import ( import (
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
"database/sql" "database/sql"
"time" // "time"
_ "github.com/go-sql-driver/mysql" _ "github.com/go-sql-driver/mysql"
// "github.com/denzs/wsjtx_dashboards/shared/wsjtx" // "github.com/denzs/wsjtx_dashboards/shared/wsjtx"
) )
@ -17,10 +17,10 @@ func handleMysql(r report) {
// log.Infof("handleMysql(%+v)",r) // 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() 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 { if err != nil {
log.WithFields(log.Fields{"err":err.Error()}).Warn("error while executing prepared statement..") log.WithFields(log.Fields{"err":err.Error()}).Warn("error while executing prepared statement..")

2
cmd/wsjtx-exporter/main.go

@ -5,7 +5,7 @@ import (
"fmt" "fmt"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
"net/http" "net/http"
"github.com/denzs/wsjtx_dashboards/shared/wsjtx" "github.com/denzs/wsjtx-dashboards/shared/wsjtx"
"github.com/hpcloud/tail" "github.com/hpcloud/tail"
"github.com/prometheus/client_golang/prometheus/promhttp" "github.com/prometheus/client_golang/prometheus/promhttp"
"os" "os"

7
cmd/wsjtx-exporter/mysql.go

@ -4,7 +4,7 @@ import (
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
"database/sql" "database/sql"
_ "github.com/go-sql-driver/mysql" _ "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) { func handleMysql(result wsjtx.Result) {
@ -14,10 +14,10 @@ func handleMysql(result wsjtx.Result) {
} }
defer db.Close() 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() 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 { if err != nil {
log.WithFields(log.Fields{"err":err.Error()}).Warn("error while executing prepared statement..") log.WithFields(log.Fields{"err":err.Error()}).Warn("error while executing prepared statement..")
@ -70,6 +70,7 @@ func init_db() {
func dbConn() (db *sql.DB, err bool){ func dbConn() (db *sql.DB, err bool){
//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) db, er := sql.Open("mysql", mysql_user + ":" + mysql_pass + "@tcp(" + mysql_host + ")/" + mysql_db)
if er != nil { if er != nil {
log.Error("db not reachable: %s",err) log.Error("db not reachable: %s",err)

2
cmd/wsjtx-exporter/prometheus.go

@ -2,7 +2,7 @@ package main
import ( import (
"fmt" "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"
"github.com/prometheus/client_golang/prometheus/promauto" "github.com/prometheus/client_golang/prometheus/promauto"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"

23
todo.md

@ -5,6 +5,10 @@
* alternativ findposition mechanik implementieren (automatischer rewind auf basis des letzten mysql eintrages) * alternativ findposition mechanik implementieren (automatischer rewind auf basis des letzten mysql eintrages)
* smarter move um sich als windows dienst einzutragen * smarter move um sich als windows dienst einzutragen
* 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 * research how to reduce result set effectively in mysql
* primary key um band ergaenzen? * primary key um band ergaenzen?
@ -14,8 +18,25 @@
* database * database
* propably more indices * 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 * 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? * create table aus binaries nehmen?
* kontrolle sollte beim db admin liegen * kontrolle sollte beim db admin liegen