Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
j.hoerdt
sensor2graph
Commits
737d983f
Commit
737d983f
authored
Dec 15, 2021
by
neop
Browse files
try out authentication again
parent
19b51f67
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/sensor2graph/Main.java
View file @
737d983f
...
...
@@ -80,9 +80,12 @@ public class Main {
influxDBClient
=
InfluxDBClientFactory
.
create
(
InfluxDBClientOptions
.
builder
()
.
url
(
Main
.
influxdb_uri
)
.
authenticateToken
(
"hunter2"
.
toCharArray
())
.
bucket
(
"bucket0"
)
.
org
(
"openforecast"
)
.
authenticateToken
(
String
.
format
(
"%s:%s"
,
System
.
getenv
(
"SENSOR2GRAPH_INFLUXDB_PASS"
),
System
.
getenv
(
"SENSOR2GRAPH_INFLUXDB_USER"
)
).
toCharArray
())
.
bucket
(
Main
.
influxdb_database_name
)
.
org
(
"-"
)
.
okHttpClient
(
new
OkHttpClient
().
newBuilder
()
.
connectTimeout
(
10
,
TimeUnit
.
MINUTES
)
...
...
@@ -109,21 +112,22 @@ public class Main {
}
private
static
void
run
()
throws
Exception
{
//
System.out.println("starting influx query");
//
var tables = influxDBClient.getQueryApi().query("from(bucket:\"
bucket0
\") |> range(start: -
100
00d1
h
, stop: -
1d)"
);
System
.
out
.
println
(
"starting influx query"
);
var
tables
=
influxDBClient
.
getQueryApi
().
query
(
String
.
format
(
"from(bucket:\"
%s
\") |> range(start: -
6
00d1
m
, stop: -
600d)"
,
Main
.
influxdb_database_name
)
);
// for (var fluxTable : tables) {
// System.out.println("table " + fluxTable);
// for (var record : fluxTable.getRecords()) {
// System.out.println(String.format("%s %s: %s %s", record.getTime(), record.getMeasurement(), record.getField(), record.getValue()));
// record.getValues().forEach((key, value) -> System.out.println(key + ":" + value));
// }
// }
// System.out.println("finished influx query");
try_uploading_failed_sensors
();
upload_all_days
();
try_uploading_failed_sensors
();
System
.
out
.
println
(
"hello"
);
for
(
var
fluxTable
:
tables
)
{
System
.
out
.
println
(
"table "
+
fluxTable
);
for
(
var
record
:
fluxTable
.
getRecords
())
{
System
.
out
.
println
(
String
.
format
(
"%s %s: %s %s"
,
record
.
getTime
(),
record
.
getMeasurement
(),
record
.
getField
(),
record
.
getValue
()));
record
.
getValues
().
forEach
((
key
,
value
)
->
System
.
out
.
println
(
key
+
":"
+
value
));
}
}
System
.
out
.
println
(
"finished influx query"
);
// try_uploading_failed_sensors();
// upload_all_days();
// try_uploading_failed_sensors();
}
private
static
void
try_uploading_failed_sensors
()
throws
Exception
{
...
...
@@ -229,7 +233,7 @@ public class Main {
}
private
static
void
initialize_config_vars
()
throws
Exception
{
private
static
void
initialize_config_vars
()
throws
Exception
{
Properties
config
=
load_user_defined_properties_with_defaults
(
get_default_properties
());
already_uploaded_days_file
=
config
.
getProperty
(
"already_uploaded_days_file"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment