From 6a515aaef098cda0a1fe1a2d12e96a41cad1e6ab Mon Sep 17 00:00:00 2001 From: bert hubert Date: Sun, 6 Dec 2020 14:30:33 +0100 Subject: [PATCH] stop filtering out E14/E18, add support for DVS, add support for remote influxdb --- reporter.cc | 64 ++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 53 insertions(+), 11 deletions(-) diff --git a/reporter.cc b/reporter.cc index 6de9daf..cba6cbf 100644 --- a/reporter.cc +++ b/reporter.cc @@ -84,6 +84,8 @@ private: struct IntervalStat { std::optional unhealthy; + std::optional dataunhealthy; + std::optional osnma; std::optional sisa; bool ripe{false}; bool expired{false}; @@ -95,6 +97,7 @@ struct IntervalStat map> g_stats; int main(int argc, char **argv) +try { MiniCurl mc; MiniCurl::MiniCurlHeaders mch; @@ -112,6 +115,7 @@ int main(int argc, char **argv) int gnssid=2; int rtcmsrc=300; int galwn=-1; + string influxserver="http://127.0.0.1:8086"; app.add_flag("--version", doVERSION, "show program version and copyright"); app.add_option("--period,-p", periodarg, "period over which to report (1h, 1w)"); app.add_option("--begin,-b", beginarg, "Beginning"); @@ -122,6 +126,7 @@ int main(int argc, char **argv) app.add_option("--sigid,-s", sigid, "Signal identifier. 1 or 5 for Galileo."); app.add_option("--gnssid,-g", gnssid, "gnssid, 0 GPS, 2 Galileo"); app.add_option("--influxdb", influxDBName, "Name of influxdb database"); + app.add_option("--influxserver", influxserver, "Address of influx server"); try { app.parse(argc, argv); } catch(const CLI::Error &e) { @@ -148,13 +153,16 @@ int main(int argc, char **argv) // auto res = mc.getURL(url + mc.urlEncode("select distinct(value) from sisa where "+period+" and sigid='"+to_string(sigid)+"' group by gnssid,sv,sigid,time(10m)")); - - - string url="http://127.0.0.1:8086/query?db="+influxDBName+"&epoch=s&q="; + if(influxserver.find("http")) + influxserver="http://"+influxserver; + if(influxserver.empty() || influxserver[influxserver.size()-1]!='/') + influxserver+="/"; + string url=influxserver+"query?db="+influxDBName+"&epoch=s&q="; string sisaname = (gnssid==2) ? "sisa" : "gpsura"; string query="select distinct(value) from "+sisaname+" where "+period+" and sigid='"+to_string(sigid)+"' group by gnssid,sv,sigid,time(10m)"; cout<<"query: "< maxcounts; + map maxcounts; for(const auto& dc : dishcount) { auto& bin = maxcounts[dc.first - (dc.first % 3600)]; if(bin < dc.second.size()) @@ -554,10 +593,6 @@ int main(int argc, char **argv) ///////////////////// - g_stats.erase({2,14,1}); - g_stats.erase({2,18,1}); - g_stats.erase({2,14,5}); - g_stats.erase({2,18,5}); /* g_stats[{2,19,1}]; */ @@ -616,7 +651,10 @@ int main(int argc, char **argv) else if(*i.second.unhealthy==3) testing++; else { - if(i.second.sisa) { + if(i.second.dataunhealthy && *i.second.dataunhealthy) { // this is 'working without guarantee' + unhealthy++; + } + else if(i.second.sisa) { if(*i.second.sisa == 255) napa++; else @@ -715,5 +753,9 @@ int main(int argc, char **argv) cout<