From 39af1e3c00c92a758329aa91583bcb84bf37181a Mon Sep 17 00:00:00 2001 From: Mark Nellemann Date: Wed, 17 May 2023 16:29:37 +0200 Subject: [PATCH] Increase influx writer bufferlimit. --- CHANGELOG.md | 5 +++-- README.md | 8 ++++++++ build.gradle | 8 ++++---- src/main/java/biz/nellemann/hmci/InfluxClient.java | 10 +++++++++- 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f0821ca..5e5df86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,9 @@ All notable changes to this project will be documented in this file. -## 1.4.4 - 2023-04-xx -- Initial support for InfluxDB v2 +## 1.4.4 - 2023-05-xx +- Initial support for InfluxDB v2 API, requires InfluxDB 1.8+ +- Increase influx writer buffer limit ## 1.4.3 - 2023-03-21 - Fix and improve processor utilization dashboards. diff --git a/README.md b/README.md index 3966537..49228a8 100644 --- a/README.md +++ b/README.md @@ -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. +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 @@ -126,6 +133,7 @@ If you rename a partition, the metrics in InfluxDB will still be available by th DELETE WHERE lparname = 'name'; ``` + ## Development Information You need Java (JDK) version 8 or later to build hmci. diff --git a/build.gradle b/build.gradle index 231df03..fef67e4 100644 --- a/build.gradle +++ b/build.gradle @@ -17,10 +17,10 @@ group = projectGroup version = projectVersion dependencies { - annotationProcessor 'info.picocli:picocli-codegen:4.7.1' - implementation 'info.picocli:picocli:4.7.1' - implementation 'org.slf4j:slf4j-api:2.0.6' - implementation 'org.slf4j:slf4j-simple:2.0.6' + annotationProcessor 'info.picocli:picocli-codegen:4.7.3' + implementation 'info.picocli:picocli:4.7.3' + implementation 'org.slf4j:slf4j-api:2.0.7' + implementation 'org.slf4j:slf4j-simple:2.0.7' implementation 'com.squareup.okhttp3:okhttp:4.10.0' // Also used by InfluxDB Client implementation 'com.influxdb:influxdb-client-java:6.8.0' implementation 'com.fasterxml.jackson.core:jackson-databind:2.14.2' diff --git a/src/main/java/biz/nellemann/hmci/InfluxClient.java b/src/main/java/biz/nellemann/hmci/InfluxClient.java index d094ce4..5d49660 100644 --- a/src/main/java/biz/nellemann/hmci/InfluxClient.java +++ b/src/main/java/biz/nellemann/hmci/InfluxClient.java @@ -19,6 +19,7 @@ import biz.nellemann.hmci.dto.toml.InfluxConfiguration; import com.influxdb.client.InfluxDBClient; import com.influxdb.client.InfluxDBClientFactory; import com.influxdb.client.WriteApi; +import com.influxdb.client.WriteOptions; import com.influxdb.client.write.Point; import com.influxdb.client.domain.WritePrecision; import org.slf4j.Logger; @@ -70,8 +71,15 @@ public final class InfluxClient { Runtime.getRuntime().addShutdownHook(new Thread(influxDBClient::close)); // 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; + } catch(Exception e) { sleep(15 * 1000); if(loginErrors++ > 3) {