Sebastian Denz
4 years ago
24 changed files with 329 additions and 113 deletions
@ -0,0 +1,2 @@ |
|||||
|
import/ |
||||
|
.swp |
@ -1,8 +1,8 @@ |
|||||
from golang:1.15.0 |
from golang:1.15.0 |
||||
|
|
||||
RUN mkdir /pskreporter_exporter |
RUN mkdir /pskreporter-exporter |
||||
ADD . /pskreporter_exporter |
ADD . /pskreporter-exporter |
||||
WORKDIR /pskreporter_exporter/cmd/pskreporter_exporter |
WORKDIR /pskreporter-exporter/cmd/pskreporter-exporter |
||||
RUN go build |
RUN go build |
||||
|
|
||||
CMD ["/pskreporter_exporter/cmd/pskreporter_exporter/pskreporter_exporter"] |
CMD ["/pskreporter-exporter/cmd/pskreporter-exporter/pskreporter-exporter"] |
||||
|
@ -1,8 +1,8 @@ |
|||||
from golang:1.15.0 |
from golang:1.15.0 |
||||
|
|
||||
RUN mkdir /wsjtx_exporter |
RUN mkdir /wsjtx-exporter |
||||
ADD . /wsjtx_exporter |
ADD . /wsjtx-exporter |
||||
WORKDIR /wsjtx_exporter/cmd/wsjtx_exporter |
WORKDIR /wsjtx-exporter/cmd/wsjtx-exporter |
||||
RUN go build |
RUN go build |
||||
|
|
||||
CMD ["/wsjtx_exporter/cmd/wsjtx_exporter/wsjtx_exporter"] |
CMD ["/wsjtx-exporter/cmd/wsjtx-exporter/wsjtx-exporter"] |
||||
|
Binary file not shown.
@ -0,0 +1,56 @@ |
|||||
|
package main |
||||
|
|
||||
|
import ( |
||||
|
"fmt" |
||||
|
"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" |
||||
|
) |
||||
|
|
||||
|
var wsjtx_received_total *prometheus.CounterVec |
||||
|
//var wsjtx_received_call_total *prometheus.CounterVec
|
||||
|
|
||||
|
func handlePrometheus(result wsjtx.Result) { |
||||
|
incr_wsjtx_received_total(result) |
||||
|
// if promcalls {
|
||||
|
// incr_wsjtx_received_callsigns_total(result)
|
||||
|
// }
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
func incr_wsjtx_received_total(result wsjtx.Result) { |
||||
|
if(wsjtx_received_total == nil) { |
||||
|
log.Printf("init prometheus metric wsjtx_received_total..") |
||||
|
wsjtx_received_total = promauto.NewCounterVec(prometheus.CounterOpts{ Name: "wsjtx_received_total", Help: "DXCCs ordery by labels", |
||||
|
}, []string{"num","signal","name","continent","cqzone","ituzone","band","mode","geohash","station"},) |
||||
|
} |
||||
|
wsjtx_received_total.With(prometheus.Labels{"num":fmt.Sprintf("%d",result.Ent.DXCC),"signal":fmt.Sprintf("%d",result.Signal), |
||||
|
"band":result.Band, |
||||
|
"name":result.Ent.Entity, |
||||
|
"continent":result.Ent.Continent, |
||||
|
"cqzone":fmt.Sprintf("%d",result.Ent.CQZone), |
||||
|
"mode":result.Mode, |
||||
|
"geohash":result.GeoHash, |
||||
|
"station": station, |
||||
|
"ituzone":fmt.Sprintf("%d",result.Ent.ITUZone)}).Inc() |
||||
|
} |
||||
|
|
||||
|
|
||||
|
//func incr_wsjtx_received_callsigns_total(result wsjtx.Result) {
|
||||
|
// if(wsjtx_received_call_total == nil) {
|
||||
|
// log.Printf("inicreating wsjtx_received_call_total..")
|
||||
|
// wsjtx_received_call_total = promauto.NewCounterVec(prometheus.CounterOpts{ Name: "wsjtx_received_call_total", Help: "DXCCs ordery by labels",
|
||||
|
// }, []string{"num","signal","name","continent","cqzone","ituzone","band","call","mode","geohash","station"},)
|
||||
|
// }
|
||||
|
// wsjtx_received_call_total.With(prometheus.Labels{"num":fmt.Sprintf("%d",result.Ent.DXCC),"signal":fmt.Sprintf("%d",result.Signal),
|
||||
|
// "band":result.Band,
|
||||
|
// "name":result.Ent.Entity,
|
||||
|
// "continent":result.Ent.Continent,
|
||||
|
// "cqzone":fmt.Sprintf("%d",result.Ent.CQZone),
|
||||
|
// "mode":result.Mode,
|
||||
|
// "call":result.Call,
|
||||
|
// "geohash":result.GeoHash,
|
||||
|
// "station": station,
|
||||
|
// "ituzone":fmt.Sprintf("%d",result.Ent.ITUZone)}).Inc()
|
||||
|
//}
|
Binary file not shown.
@ -1,56 +0,0 @@ |
|||||
package main |
|
||||
|
|
||||
import ( |
|
||||
"fmt" |
|
||||
"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" |
|
||||
) |
|
||||
|
|
||||
var wsjtx_received_total *prometheus.CounterVec |
|
||||
var wsjtx_received_call_total *prometheus.CounterVec |
|
||||
|
|
||||
func handlePrometheus(result wsjtx.Result) { |
|
||||
incr_wsjtx_received_total(result) |
|
||||
if promcalls { |
|
||||
incr_wsjtx_received_callsigns_total(result) |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
|
|
||||
func incr_wsjtx_received_total(result wsjtx.Result) { |
|
||||
if(wsjtx_received_total == nil) { |
|
||||
log.Printf("creating wsjtx_received_total...") |
|
||||
wsjtx_received_total = promauto.NewCounterVec(prometheus.CounterOpts{ Name: "wsjtx_received_total", Help: "DXCCs ordery by labels", |
|
||||
}, []string{"num","signal","name","continent","cqzone","ituzone","band","mode","geohash","station"},) |
|
||||
} |
|
||||
wsjtx_received_total.With(prometheus.Labels{"num":fmt.Sprintf("%d",result.Ent.DXCC),"signal":fmt.Sprintf("%d",result.Signal), |
|
||||
"band":result.Band, |
|
||||
"name":result.Ent.Entity, |
|
||||
"continent":result.Ent.Continent, |
|
||||
"cqzone":fmt.Sprintf("%d",result.Ent.CQZone), |
|
||||
"mode":result.Mode, |
|
||||
"geohash":result.GeoHash, |
|
||||
"station": station, |
|
||||
"ituzone":fmt.Sprintf("%d",result.Ent.ITUZone)}).Inc() |
|
||||
} |
|
||||
|
|
||||
|
|
||||
func incr_wsjtx_received_callsigns_total(result wsjtx.Result) { |
|
||||
if(wsjtx_received_call_total == nil) { |
|
||||
log.Printf("creating wsjtx_received_call_total...") |
|
||||
wsjtx_received_call_total = promauto.NewCounterVec(prometheus.CounterOpts{ Name: "wsjtx_received_call_total", Help: "DXCCs ordery by labels", |
|
||||
}, []string{"num","signal","name","continent","cqzone","ituzone","band","call","mode","geohash","station"},) |
|
||||
} |
|
||||
wsjtx_received_call_total.With(prometheus.Labels{"num":fmt.Sprintf("%d",result.Ent.DXCC),"signal":fmt.Sprintf("%d",result.Signal), |
|
||||
"band":result.Band, |
|
||||
"name":result.Ent.Entity, |
|
||||
"continent":result.Ent.Continent, |
|
||||
"cqzone":fmt.Sprintf("%d",result.Ent.CQZone), |
|
||||
"mode":result.Mode, |
|
||||
"call":result.Call, |
|
||||
"geohash":result.GeoHash, |
|
||||
"station": station, |
|
||||
"ituzone":fmt.Sprintf("%d",result.Ent.ITUZone)}).Inc() |
|
||||
} |
|
@ -0,0 +1,27 @@ |
|||||
|
# alltxt2csv |
||||
|
|
||||
|
converts ALL.TXT to csv file which can then be nicely imported into mysql. |
||||
|
|
||||
|
parameters: |
||||
|
``` |
||||
|
Usage of ./alltxt2csv: |
||||
|
-in string |
||||
|
path to wsjt-x ALL.txt |
||||
|
-out string |
||||
|
path to csv outfile |
||||
|
-station string |
||||
|
your callsign or wsjtx instance identifier (default "localstation") |
||||
|
-trace |
||||
|
log every line... yes really ;) |
||||
|
``` |
||||
|
## converting ALL.TXT to csv |
||||
|
|
||||
|
## import of csv |
||||
|
``` |
||||
|
alltxt2csv -in ~/.local/share/WSJT-X/ALL.TXT -out ~/dev/wsjtx_dashboards/import/DL3SD.csv -station DL3SD |
||||
|
``` |
||||
|
|
||||
|
* prepare IMPORT.SQL |
||||
|
|
||||
|
docker exec -ti db /usr/bin/mysql --local-infile=1 -pverysecret digimode_stats -e "SET GLOBAL local_infile=1;" |
||||
|
docker exec -ti db /usr/bin/mysql --local-infile=1 -pverysecret digimode_stats -e "\. /wsjtx/import/DL3SD.SQL" |
@ -0,0 +1,22 @@ |
|||||
|
# pskreporter-exporter |
||||
|
|
||||
|
poll pskreporter.info every 5 minutes to stores the results into mysql and/or export for prometheus. |
||||
|
|
||||
|
parameter: |
||||
|
``` |
||||
|
Usage of go/bin/pskreporter_exporter: |
||||
|
-db="digimode_stats": db name |
||||
|
-dbhost="db": name/ip of mysql host |
||||
|
-dbpass="secret": mysql password |
||||
|
-dbtable="pskreporter_stats": mysql table name |
||||
|
-dbuser="wsjtx": mysql username |
||||
|
-debug=false: enable debug logging |
||||
|
-metricpath="/metrics": path for prometheus metric endpoint |
||||
|
-mysql=false: activate mysql exporter |
||||
|
-port=2113: port for prometheus metric endpoint |
||||
|
-prometheus=false: activate prometheus exporter |
||||
|
-station="": callsign to monitor on pskreporter |
||||
|
-trace=false: log almost everything |
||||
|
``` |
||||
|
|
||||
|
unsure about using in combination with gridtracker... |
@ -0,0 +1,56 @@ |
|||||
|
# wsjtx-exporter |
||||
|
|
||||
|
follows WSJTX-X ALL.TXT file to store entries in mysql and export metrics for prometheus. |
||||
|
|
||||
|
parameters: |
||||
|
``` |
||||
|
Usage of go/bin/wsjtx-exporter: |
||||
|
-db string |
||||
|
db name (default "digimode_stats") |
||||
|
-dbhost string |
||||
|
name/ip of mysql host (default "db") |
||||
|
-dbpass string |
||||
|
mysql password (default "secret") |
||||
|
-dbtable string |
||||
|
mysql table name (default "wsjtx_all_txt") |
||||
|
-dbuser string |
||||
|
mysql username (default "wsjtx") |
||||
|
-metricpath string |
||||
|
path for prometheus metric endpoint (default "/metrics") |
||||
|
-mysql |
||||
|
activate mysql exporter |
||||
|
-pathin string |
||||
|
path to WSJT-X ALL.TXT (default "/wsjtx/ALL.TXT") |
||||
|
-port int |
||||
|
port for prometheus metric endpoint (default 2112) |
||||
|
-prometheus |
||||
|
activate prometheus exporter |
||||
|
-station string |
||||
|
your callsign or wsjtx instance identifier (default "localstation") |
||||
|
-trace |
||||
|
log almost everything |
||||
|
``` |
||||
|
|
||||
|
## systemd user unit for linux |
||||
|
|
||||
|
create ~/.config/systemd/user/wsjtx-exporter.service and adapt parameters to your needs! |
||||
|
|
||||
|
~/.config/systemd/user/wsjtx-exporter.service: |
||||
|
``` |
||||
|
[Unit] |
||||
|
Description=WSJT-X 'ALL.TXT' prometheues exporter |
||||
|
|
||||
|
[Service] |
||||
|
Restart=always |
||||
|
ExecStart=%h/go/bin/wsjtx-exporter -mysql -prometheus -dbhost 10.0.73.1 -dbuser dl3sd -dbpass tester -station DL3SD -pathin %h/.local/share/WSJT-X/ALL.TXT -trace |
||||
|
|
||||
|
[Install] |
||||
|
WantedBy=default.target |
||||
|
``` |
||||
|
|
||||
|
activate: |
||||
|
``` |
||||
|
systemctl --user daemon-reload |
||||
|
systemctl --user enable wsjtx-exporter.service |
||||
|
systemctl --user start wsjtx-exporter.service |
||||
|
``` |
@ -1,4 +1,4 @@ |
|||||
LOAD DATA LOCAL INFILE '/wsjtx/SEBO.CSV' |
LOAD DATA LOCAL INFILE '/wsjtx/DL3SD.CSV' |
||||
INTO TABLE wsjtx_all_txt |
INTO TABLE wsjtx_all_txt |
||||
FIELDS TERMINATED BY ',' |
FIELDS TERMINATED BY ',' |
||||
ENCLOSED BY '"' |
ENCLOSED BY '"' |
@ -0,0 +1,14 @@ |
|||||
|
CREATE TABLE IF NOT EXISTS pskreporter_stats ( |
||||
|
ts timestamp NOT NULL, |
||||
|
station VARCHAR(16) NOT NULL, |
||||
|
callsign VARCHAR(16) NOT NULL, |
||||
|
band VARCHAR(10) NOT NULL, |
||||
|
continent VARCHAR(32) NOT NULL, |
||||
|
mode VARCHAR(16) NOT NULL, |
||||
|
dxcc VARCHAR(128) NOT NULL, |
||||
|
geohash VARCHAR(16) NOT NULL, |
||||
|
report TINYINT NOT NULL, |
||||
|
cqzone INT NOT NULL, |
||||
|
ituzone INT NOT NULL, |
||||
|
UNIQUE KEY UC_pskreporter_stats (ts, station, callsign) |
||||
|
); |
@ -0,0 +1,16 @@ |
|||||
|
CREATE TABLE IF NOT EXISTS wsjtx_all_txt ( |
||||
|
ts timestamp NOT NULL, |
||||
|
station VARCHAR(16) NOT NULL, |
||||
|
callsign VARCHAR(16) NOT NULL, |
||||
|
band VARCHAR(10) NOT NULL, |
||||
|
continent VARCHAR(32) NOT NULL, |
||||
|
mode VARCHAR(16) NOT NULL, |
||||
|
dxcc VARCHAR(128) NOT NULL, |
||||
|
geohash VARCHAR(16) NOT NULL, |
||||
|
report TINYINT NOT NULL, |
||||
|
cqzone INT NOT NULL, |
||||
|
ituzone INT NOT NULL, |
||||
|
rx TINYINT NOT NULL, |
||||
|
PRIMARY KEY PK_wsjtx_all_txt (ts, station, callsign), |
||||
|
INDEX idx_dxcc (dxcc) |
||||
|
); |
@ -0,0 +1,44 @@ |
|||||
|
* wsjtx-exporter |
||||
|
* cqzone und ituzone nicht in db |
||||
|
* -back parameter implementieren |
||||
|
* remove calls metric? |
||||
|
* https://prometheus.io/docs/practices/naming/#labels |
||||
|
* cant reach database ist bei mir aufgetreten |
||||
|
* adressieren ;) |
||||
|
* systemd user unit |
||||
|
* windows aequivalent?? |
||||
|
* trace: sucessfully parsed.. loggt: fields.time |
||||
|
* bei kaputter Zeile: |
||||
|
Nov 26 20:10:47 sebo-OptiPlex-980 wsjtx_exporter[869]: goroutine 12 [running]: |
||||
|
Nov 26 20:10:47 sebo-OptiPlex-980 wsjtx_exporter[869]: github.com/denzs/wsjtx_dashboards/shared/wsjtx.ScanLine(0xc0000a4004, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...) |
||||
|
|
||||
|
* alltxt2csv |
||||
|
* direkt importfeature wieder aufnehmen..? |
||||
|
|
||||
|
* database |
||||
|
* propably more indices |
||||
|
|
||||
|
* create table aus binaries nehmen? |
||||
|
* kontrolle sollte beim db admin liegen |
||||
|
|
||||
|
* doc |
||||
|
** german docs.. |
||||
|
** server und/oder skript/readme |
||||
|
|
||||
|
* fix dashboards |
||||
|
* umgang mit refresh der variablen?? |
||||
|
|
||||
|
* provide dashboards to grafana |
||||
|
|
||||
|
* prometheues metric + value + TIMESTAMP!!!!!! |
||||
|
|
||||
|
* vendoring |
||||
|
|
||||
|
* add howto for ubuntu/win10 |
||||
|
|
||||
|
* push images to dockerhub |
||||
|
|
||||
|
* Mail an PSKReporter |
||||
|
|
||||
|
* Query to bunde multiple callsigns? |
||||
|
* How are the queries counted? rate per src ip or per query? |
Reference in new issue