Merged development into master
This commit is contained in:
commit
1b4f392c4b
11
README.md
11
README.md
|
@ -51,7 +51,16 @@ Below are screenshots of the provided Grafana dashboards (found in the **doc/**
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
### InfluxDB
|
### Start InfluxDB and Grafana at boot on RedHat 7+
|
||||||
|
|
||||||
|
systemctl enable influxdb
|
||||||
|
systemctl start influxdb
|
||||||
|
|
||||||
|
systemctl enable grafana-server
|
||||||
|
systemctl start grafana-server
|
||||||
|
|
||||||
|
|
||||||
|
### InfluxDB Retention Policy
|
||||||
|
|
||||||
Per default the *hmci* influx database has no retention policy, so data will be kept forever. It is recommended to set a retention policy, which is shown below.
|
Per default the *hmci* influx database has no retention policy, so data will be kept forever. It is recommended to set a retention policy, which is shown below.
|
||||||
|
|
||||||
|
|
11
build.gradle
11
build.gradle
|
@ -16,22 +16,20 @@ repositories {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
annotationProcessor 'info.picocli:picocli-codegen:4.5.2'
|
annotationProcessor 'info.picocli:picocli-codegen:4.6.0'
|
||||||
implementation 'info.picocli:picocli:4.5.2'
|
implementation 'info.picocli:picocli:4.6.0'
|
||||||
implementation 'org.jsoup:jsoup:1.13.1'
|
implementation 'org.jsoup:jsoup:1.13.1'
|
||||||
implementation 'com.squareup.okhttp3:okhttp:4.9.0'
|
implementation 'com.squareup.okhttp3:okhttp:4.9.0'
|
||||||
implementation 'com.squareup.moshi:moshi:1.11.0'
|
implementation 'com.squareup.moshi:moshi:1.11.0'
|
||||||
implementation 'com.serjltt.moshi:moshi-lazy-adapters:2.2'
|
implementation 'com.serjltt.moshi:moshi-lazy-adapters:2.2'
|
||||||
implementation 'org.tomlj:tomlj:1.0.0'
|
implementation 'org.tomlj:tomlj:1.0.0'
|
||||||
implementation 'org.influxdb:influxdb-java:2.21'
|
implementation 'org.influxdb:influxdb-java:2.21'
|
||||||
implementation 'org.slf4j:slf4j-api:1.7.+'
|
implementation 'org.slf4j:slf4j-api:1.7.30'
|
||||||
runtimeOnly 'ch.qos.logback:logback-classic:1.+'
|
runtimeOnly 'org.slf4j:slf4j-simple:1.7.30'
|
||||||
|
|
||||||
testImplementation('org.spockframework:spock-core:2.0-M4-groovy-3.0')
|
testImplementation('org.spockframework:spock-core:2.0-M4-groovy-3.0')
|
||||||
testImplementation('com.squareup.okhttp3:mockwebserver:4.9.0')
|
testImplementation('com.squareup.okhttp3:mockwebserver:4.9.0')
|
||||||
testImplementation("org.slf4j:slf4j-simple:1.7.+")
|
testImplementation("org.slf4j:slf4j-simple:1.7.+")
|
||||||
//implementation platform('org.testcontainers:testcontainers-bom:1.14.3') //import bom
|
|
||||||
//testCompile "org.testcontainers:influxdb:1.14.3"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
application {
|
application {
|
||||||
|
@ -114,6 +112,7 @@ jar {
|
||||||
'Build-Version' : versioning.info.tag ?: (versioning.info.branch + "-" + versioning.info.build),
|
'Build-Version' : versioning.info.tag ?: (versioning.info.branch + "-" + versioning.info.build),
|
||||||
'Build-Revision' : versioning.info.commit,
|
'Build-Revision' : versioning.info.commit,
|
||||||
'Build-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ss.SSSZ").toString(),
|
'Build-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ss.SSSZ").toString(),
|
||||||
|
'Add-Opens' : 'java.base/java.lang.invoke' // To ignore "Illegal reflective access by retrofit2.Platform" warnings
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
id = hmci
|
id = hmci
|
||||||
group = biz.nellemann.hmci
|
group = biz.nellemann.hmci
|
||||||
version = 0.2.7
|
version = 1.0.1
|
||||||
|
|
|
@ -30,6 +30,8 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import static java.lang.Thread.sleep;
|
||||||
|
|
||||||
class InfluxClient {
|
class InfluxClient {
|
||||||
|
|
||||||
private final static Logger log = LoggerFactory.getLogger(InfluxClient.class);
|
private final static Logger log = LoggerFactory.getLogger(InfluxClient.class);
|
||||||
|
@ -57,6 +59,10 @@ class InfluxClient {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean connected = false;
|
||||||
|
int errors = 0;
|
||||||
|
|
||||||
|
do {
|
||||||
try {
|
try {
|
||||||
log.debug("Connecting to InfluxDB - " + url);
|
log.debug("Connecting to InfluxDB - " + url);
|
||||||
influxDB = InfluxDBFactory.connect(url, username, password);
|
influxDB = InfluxDBFactory.connect(url, username, password);
|
||||||
|
@ -67,11 +73,20 @@ class InfluxClient {
|
||||||
influxDB.enableBatch(options);
|
influxDB.enableBatch(options);
|
||||||
batchPoints = BatchPoints.database(database).precision(TimeUnit.SECONDS).build();
|
batchPoints = BatchPoints.database(database).precision(TimeUnit.SECONDS).build();
|
||||||
|
|
||||||
|
connected = true;
|
||||||
|
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
log.error("login() error - " + e.getMessage());
|
sleep(15*1000);
|
||||||
|
if(errors++ > 3) {
|
||||||
|
log.error("login() error, giving up - " + e.getMessage());
|
||||||
throw new Exception(e);
|
throw new Exception(e);
|
||||||
|
} else {
|
||||||
|
log.warn("login() error, retrying - " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} while(!connected);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
synchronized void logoff() {
|
synchronized void logoff() {
|
||||||
|
|
|
@ -17,7 +17,6 @@ package biz.nellemann.hmci;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
@ -38,11 +37,10 @@ class Insights {
|
||||||
|
|
||||||
Insights(Configuration configuration) {
|
Insights(Configuration configuration) {
|
||||||
this.configuration = configuration;
|
this.configuration = configuration;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
influxClient = new InfluxClient(configuration.influx);
|
influxClient = new InfluxClient(configuration.influx);
|
||||||
influxClient.login();
|
influxClient.login();
|
||||||
} catch(Exception e) {
|
} catch (Exception e) {
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
5
src/main/resources/simplelogger.properties
Normal file
5
src/main/resources/simplelogger.properties
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
org.slf4j.simpleLogger.logFile=System.out
|
||||||
|
org.slf4j.simpleLogger.showDateTime=true
|
||||||
|
org.slf4j.simpleLogger.showShortLogName=true
|
||||||
|
org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss.SSS
|
||||||
|
org.slf4j.simpleLogger.levelInBrackets=true
|
Loading…
Reference in a new issue