influxdb2 support #1

Merged
nellemann merged 5 commits from influxdb2 into main 2023-05-19 18:39:20 +00:00
4 changed files with 24 additions and 7 deletions
Showing only changes of commit 39af1e3c00 - Show all commits

View file

@ -2,8 +2,9 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
## 1.4.4 - 2023-04-xx ## 1.4.4 - 2023-05-xx
- Initial support for InfluxDB v2 - Initial support for InfluxDB v2 API, requires InfluxDB 1.8+
- Increase influx writer buffer limit
## 1.4.3 - 2023-03-21 ## 1.4.3 - 2023-03-21
- Fix and improve processor utilization dashboards. - Fix and improve processor utilization dashboards.

View file

@ -66,6 +66,13 @@ Read the [readme-grafana.md](doc/readme-grafana.md) file for instructions and he
This is most likely due to timezone, date and/or NTP not being configured correctly on the HMC and/or host running HMCi. This is most likely due to timezone, date and/or NTP not being configured correctly on the HMC and/or host running HMCi.
You can check the timestamp of the most recent data by querying InfluxDB with the ```influx``` CLI client, and take note of the timezone when comparing:
```sql
use hmci;
precision rfc3339;
SELECT * FROM server_details GROUP BY * ORDER BY DESC LIMIT 1;
```
### Compatibility with nextract Plus ### Compatibility with nextract Plus
@ -126,6 +133,7 @@ If you rename a partition, the metrics in InfluxDB will still be available by th
DELETE WHERE lparname = 'name'; DELETE WHERE lparname = 'name';
``` ```
## Development Information ## Development Information
You need Java (JDK) version 8 or later to build hmci. You need Java (JDK) version 8 or later to build hmci.

View file

@ -17,10 +17,10 @@ group = projectGroup
version = projectVersion version = projectVersion
dependencies { dependencies {
annotationProcessor 'info.picocli:picocli-codegen:4.7.1' annotationProcessor 'info.picocli:picocli-codegen:4.7.3'
implementation 'info.picocli:picocli:4.7.1' implementation 'info.picocli:picocli:4.7.3'
implementation 'org.slf4j:slf4j-api:2.0.6' implementation 'org.slf4j:slf4j-api:2.0.7'
implementation 'org.slf4j:slf4j-simple:2.0.6' implementation 'org.slf4j:slf4j-simple:2.0.7'
implementation 'com.squareup.okhttp3:okhttp:4.10.0' // Also used by InfluxDB Client implementation 'com.squareup.okhttp3:okhttp:4.10.0' // Also used by InfluxDB Client
implementation 'com.influxdb:influxdb-client-java:6.8.0' implementation 'com.influxdb:influxdb-client-java:6.8.0'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.14.2' implementation 'com.fasterxml.jackson.core:jackson-databind:2.14.2'

View file

@ -19,6 +19,7 @@ import biz.nellemann.hmci.dto.toml.InfluxConfiguration;
import com.influxdb.client.InfluxDBClient; import com.influxdb.client.InfluxDBClient;
import com.influxdb.client.InfluxDBClientFactory; import com.influxdb.client.InfluxDBClientFactory;
import com.influxdb.client.WriteApi; import com.influxdb.client.WriteApi;
import com.influxdb.client.WriteOptions;
import com.influxdb.client.write.Point; import com.influxdb.client.write.Point;
import com.influxdb.client.domain.WritePrecision; import com.influxdb.client.domain.WritePrecision;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -70,8 +71,15 @@ public final class InfluxClient {
Runtime.getRuntime().addShutdownHook(new Thread(influxDBClient::close)); Runtime.getRuntime().addShutdownHook(new Thread(influxDBClient::close));
// Todo: Handle events - https://github.com/influxdata/influxdb-client-java/tree/master/client#handle-the-events // Todo: Handle events - https://github.com/influxdata/influxdb-client-java/tree/master/client#handle-the-events
writeApi = influxDBClient.makeWriteApi(); //writeApi = influxDBClient.makeWriteApi();
writeApi = influxDBClient.makeWriteApi(
WriteOptions.builder()
.bufferLimit(20_000)
.flushInterval(5_000)
.build());
connected = true; connected = true;
} catch(Exception e) { } catch(Exception e) {
sleep(15 * 1000); sleep(15 * 1000);
if(loginErrors++ > 3) { if(loginErrors++ > 3) {