Fix README

This commit is contained in:
Mark Nellemann 2020-09-02 09:40:46 +02:00
commit 4887e25374
2 changed files with 22 additions and 18 deletions

View file

@ -16,6 +16,18 @@ HMCi is a small utility to fetch metrics from one or more HMC's and push those t
You can download [Grafana](https://www.power-devops.com/grafana) and [InfluxDB](https://www.power-devops.com/influxdb) ppc64le packages for most Linux distributions and AIX from the [Power DevOps](https://www.power-devops.com/) site.
#### Notes
Examples on how to change the default InfluxDB retention policy:
ALTER RETENTION POLICY "autogen" ON "hmci" DURATION 156w
ALTER RETENTION POLICY "autogen" ON "hmci" DURATION 90d
#### InfluxDB and Grafana Packages
You can download [Grafana ppc64le](https://www.power-devops.com/grafana) and [InfluxDB ppc64le](https://www.power-devops.com/influxdb) packages for most Linux distributions and AIX on the [Power DevOps](https://www.power-devops.com/) site.
Binaries for amd64/x86 are available from the [Grafana website](https://grafana.com/grafana/download) and [InfluxDB website](https://portal.influxdata.com/downloads/) and also directly from your Linux distribution repository in some cases.
## Development Information
@ -23,12 +35,12 @@ You need JDK version 8 or later.
### Build & Test
Use the gradle-wrapper build tool
Use the gradle build tool, which will download all required dependencies.
./gradlew clean build
### InfluxDB for local testing
#### InfluxDB for local testing
Start the InfluxDB container
@ -39,7 +51,7 @@ To use the Influx client from the same container
docker exec -it influxdb influx
### Grafana for local testing
#### Grafana for local testing
Start the Grafana container, linking it to the InfluxDB container

View file

@ -37,6 +37,7 @@ class InfluxClient {
InfluxDB influxDB
BatchPoints batchPoints
InfluxClient(String url, String username, String password, String database) {
this.url = url
this.username = username
@ -44,6 +45,7 @@ class InfluxClient {
this.database = database
}
void login() {
if(!influxDB) {
try {
@ -51,9 +53,8 @@ class InfluxClient {
createDatabase()
// Enable batch writes to get better performance.
BatchOptions options = BatchOptions.DEFAULTS.actions(300).flushDuration(500);
influxDB.enableBatch(options);
//BatchOptions options = BatchOptions.DEFAULTS.actions(300).flushDuration(500);
influxDB.enableBatch(BatchOptions.DEFAULTS);
//influxDB.setLogLevel(InfluxDB.LogLevel.BASIC);
batchPoints = BatchPoints.database(database).precision(TimeUnit.SECONDS).build();
@ -65,6 +66,7 @@ class InfluxClient {
}
}
void logoff() {
influxDB?.close();
influxDB = null
@ -72,18 +74,9 @@ class InfluxClient {
void createDatabase() {
// Create a database...
influxDB.query(new Query("CREATE DATABASE " + database));
// Create our database... with a default retention of 156w == 3 years
influxDB.query(new Query("CREATE DATABASE " + database + " WITH DURATION 156w"));
influxDB.setDatabase(database);
/*
// ... and a retention policy, if necessary.
String retentionPolicyName = "HMCI_ONE_YEAR";
influxDB.query(new Query("CREATE RETENTION POLICY " + retentionPolicyName
+ " ON " + database + " DURATION 365d REPLICATION 1 DEFAULT"));
influxDB.setRetentionPolicy(retentionPolicyName);
*/
}
@ -96,7 +89,6 @@ class InfluxClient {
logoff()
login()
}
//influxDB.flush()
}