Compare commits

..

No commits in common. "5b2a3ff9eab1407d2be0484a57f813504c648663" and "2967f6ef7545295ad70e546ab3c80183e3ee2255" have entirely different histories.

15 changed files with 629 additions and 382 deletions

View File

@ -2,11 +2,6 @@
All notable changes to this project will be documented in this file.
## 1.4.4 - 2023-05-20
- Support for InfluxDB v2, now requires InfluxDB 1.8 or later
- Increase influx writer buffer limit
- Various dashboard improvements
## 1.4.3 - 2023-03-21
- Fix and improve processor utilization dashboards.
- Minor code cleanup.

View File

@ -9,7 +9,7 @@ Metrics includes:
- *Managed Systems* - the physical Power servers
- *Logical Partitions* - the virtualized servers running AIX, Linux and/or IBM-i (AS/400)
- *Virtual I/O Servers* - the i/o partition(s) virtualizing network and storage
- *Energy* - watts and temperatures (needs to be enabled and is not available on all systems)
- *Energy* - watts and temperatures (needs to be enabled and is not available on multi-chassis systems)
![architecture](doc/HMCi.png)
@ -66,13 +66,6 @@ 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
@ -133,7 +126,6 @@ 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.
@ -149,7 +141,7 @@ Use the gradle build tool, which will download all required dependencies:
### Local Testing
#### InfluxDB v1.x
#### InfluxDB
Start a InfluxDB container:
@ -163,18 +155,6 @@ Create the *hmci* database:
docker exec -i influxdb influx -execute "CREATE DATABASE hmci"
```
#### InfluxDB v2.x
Start a InfluxDB container:
```shell
docker pull influxdb:latest
docker run --name=influxdb --rm -d -p 8086:8086 influxdb:latest
```
- Then use the Web UI to create an initial user (for the web UI), an organization and bucket: http://localhost:8086/
- Then create an API token with RW access to your bucket.
#### Grafana
@ -186,7 +166,4 @@ docker run --name grafana --link influxdb:influxdb --rm -d -p 3000:3000 grafana/
Setup Grafana to connect to the InfluxDB container by defining a new datasource on URL *http://influxdb:8086* named *hmci*.
If you are [connecting](https://docs.influxdata.com/influxdb/v2.7/tools/grafana/) to InfluxDB v2.x, then add a custom http header, enter bucket as database and disable authorization.
- Authorization = Token abcdef_random_token_from_nfluxdb==
Import dashboards from the [doc/dashboards/](doc/dashboards/) folder.

View File

@ -1,10 +1,13 @@
plugins {
id 'java'
id 'jacoco'
id 'groovy'
id 'application'
// Code coverage of tests
id 'jacoco'
id "net.nemerosa.versioning" version "2.15.1"
id "com.netflix.nebula.ospackage" version "11.2.0"
id "com.netflix.nebula.ospackage" version "10.0.0"
id "com.github.johnrengelman.shadow" version "7.1.2"
}
@ -17,18 +20,19 @@ group = projectGroup
version = projectVersion
dependencies {
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'
annotationProcessor 'info.picocli:picocli-codegen:4.7.1'
implementation 'info.picocli:picocli:4.7.1'
implementation 'org.influxdb:influxdb-java:2.23'
//implementation 'com.influxdb:influxdb-client-java:6.7.0'
implementation 'org.slf4j:slf4j-api:2.0.6'
implementation 'org.slf4j:slf4j-simple:2.0.6'
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.3'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.14.3'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-toml:2.14.3'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.14.2'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.14.2'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-toml:2.14.2'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.spockframework:spock-core:2.3-groovy-4.0'
testImplementation 'org.spockframework:spock-core:2.3-groovy-3.0'
testImplementation "org.mock-server:mockserver-netty-no-dependencies:5.14.0"
}
@ -83,7 +87,7 @@ buildDeb {
}
jacoco {
toolVersion = "0.8.9"
toolVersion = "0.8.8"
}
jacocoTestReport {

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 163 KiB

After

Width:  |  Height:  |  Size: 109 KiB

View File

@ -529,137 +529,6 @@
"title": "Processors",
"type": "row"
},
{
"datasource": {
"type": "influxdb",
"uid": "${DS_HMCI}"
},
"description": "",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 3,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineStyle": {
"fill": "solid"
},
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "normal"
},
"thresholdsStyle": {
"mode": "line"
}
},
"decimals": 2,
"links": [],
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
},
"unit": "short"
},
"overrides": []
},
"gridPos": {
"h": 11,
"w": 12,
"x": 0,
"y": 12
},
"id": 2,
"links": [],
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
},
"pluginVersion": "8.1.4",
"targets": [
{
"alias": "$tag_lparname",
"datasource": {
"type": "influxdb",
"uid": "${DS_HMCI}"
},
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"hide": false,
"measurement": "/^$ServerName$/",
"orderByTime": "ASC",
"policy": "default",
"query": "SELECT mean(\"utilizedProcUnits\") AS \"usage\" FROM \"lpar_processor\" WHERE (\"servername\" =~ /^$ServerName$/ AND \"lparname\" =~ /^$LPAR$/) AND $timeFilter GROUP BY time($interval), \"lparname\", \"servername\" fill(linear)",
"rawQuery": true,
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": []
}
],
"title": "Processor Units - Utilization Stacked",
"transformations": [],
"type": "timeseries"
},
{
"datasource": {
"type": "influxdb",
@ -728,11 +597,11 @@
},
"gridPos": {
"h": 11,
"w": 12,
"x": 12,
"w": 24,
"x": 0,
"y": 12
},
"id": 40,
"id": 2,
"links": [],
"options": {
"legend": {
@ -793,7 +662,7 @@
"tags": []
}
],
"title": "Processor Units - Utilization / Entitled",
"title": "Processor Units - Utilization / Entitled Percentage",
"transformations": [],
"type": "timeseries"
},
@ -2641,7 +2510,7 @@
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "normal"
"mode": "percent"
},
"thresholdsStyle": {
"mode": "off"
@ -2653,6 +2522,10 @@
"steps": [
{
"color": "green"
},
{
"color": "red",
"value": 80
}
]
},
@ -2744,11 +2617,11 @@
]
}
],
"title": "Memory Assigned - Stacked",
"title": "Memory Assigned",
"type": "timeseries"
}
],
"refresh": "30s",
"refresh": false,
"schemaVersion": 37,
"style": "dark",
"tags": [
@ -2787,7 +2660,7 @@
"type": "influxdb",
"uid": "${DS_HMCI}"
},
"definition": "SHOW TAG VALUES FROM \"lpar_processor\" WITH KEY = \"lparname\" WHERE servername =~ /$ServerName/ ",
"definition": "SHOW TAG VALUES FROM \"lpar_processor\" WITH KEY = \"lparname\" WHERE servername =~ /$ServerName/",
"hide": 0,
"includeAll": true,
"label": "Logical Partition",
@ -2795,7 +2668,7 @@
"multiFormat": "regex values",
"name": "LPAR",
"options": [],
"query": "SHOW TAG VALUES FROM \"lpar_processor\" WITH KEY = \"lparname\" WHERE servername =~ /$ServerName/ ",
"query": "SHOW TAG VALUES FROM \"lpar_processor\" WITH KEY = \"lparname\" WHERE servername =~ /$ServerName/",
"refresh": 1,
"refresh_on_load": false,
"regex": "",
@ -2838,6 +2711,6 @@
"timezone": "browser",
"title": "HMCi - Power LPAR Overview",
"uid": "Xl7oHESGz",
"version": 9,
"version": 3,
"weekStart": ""
}

View File

@ -107,21 +107,6 @@
"transparent": true,
"type": "text"
},
{
"collapsed": false,
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 3
},
"id": 15,
"panels": [],
"repeat": "ServerName",
"repeatDirection": "h",
"title": "$ServerName",
"type": "row"
},
{
"datasource": {
"type": "influxdb",
@ -155,7 +140,7 @@
"h": 7,
"w": 24,
"x": 0,
"y": 4
"y": 3
},
"id": 7,
"options": {
@ -265,7 +250,7 @@
"h": 11,
"w": 8,
"x": 0,
"y": 11
"y": 10
},
"id": 4,
"options": {
@ -468,7 +453,7 @@
"h": 11,
"w": 16,
"x": 8,
"y": 11
"y": 10
},
"id": 12,
"options": {
@ -644,7 +629,7 @@
"h": 10,
"w": 8,
"x": 0,
"y": 22
"y": 21
},
"id": 13,
"options": {
@ -794,7 +779,7 @@
"h": 10,
"w": 16,
"x": 8,
"y": 22
"y": 21
},
"id": 5,
"options": {
@ -889,13 +874,13 @@
"type": "influxdb",
"uid": "${DS_HMCI}"
},
"definition": "SHOW TAG VALUES FROM \"server_energy_power\" WITH KEY = \"servername\" WHERE time > now() - 24h",
"definition": "SHOW TAG VALUES FROM \"server_processor\" WITH KEY = \"servername\" WHERE time > now() - 24h",
"hide": 0,
"includeAll": true,
"multi": true,
"includeAll": false,
"multi": false,
"name": "ServerName",
"options": [],
"query": "SHOW TAG VALUES FROM \"server_energy_power\" WITH KEY = \"servername\" WHERE time > now() - 24h",
"query": "SHOW TAG VALUES FROM \"server_processor\" WITH KEY = \"servername\" WHERE time > now() - 24h",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
@ -927,6 +912,6 @@
"timezone": "",
"title": "HMCi - Power System Energy",
"uid": "oHcrgD1Mk",
"version": 7,
"version": 2,
"weekStart": ""
}

View File

@ -11,6 +11,12 @@
],
"__elements": {},
"__requires": [
{
"type": "panel",
"id": "bargauge",
"name": "Bar gauge",
"version": ""
},
{
"type": "panel",
"id": "gauge",
@ -29,6 +35,12 @@
"name": "InfluxDB",
"version": "1.0.0"
},
{
"type": "panel",
"id": "stat",
"name": "Stat",
"version": ""
},
{
"type": "panel",
"id": "text",
@ -121,7 +133,7 @@
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 4,
"fillOpacity": 10,
"gradientMode": "opacity",
"hideFrom": {
"legend": false,
@ -147,6 +159,7 @@
"decimals": 2,
"links": [],
"mappings": [],
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
@ -161,7 +174,7 @@
"overrides": []
},
"gridPos": {
"h": 7,
"h": 6,
"w": 12,
"x": 0,
"y": 3
@ -173,17 +186,17 @@
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": false
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "none"
"sort": "desc"
}
},
"pluginVersion": "8.1.4",
"targets": [
{
"alias": "$col ($tag_servername)",
"alias": "$col",
"datasource": {
"type": "influxdb",
"uid": "${DS_HMCI}"
@ -298,7 +311,7 @@
]
}
],
"title": "System Processors",
"title": "System Processor Utilization",
"type": "timeseries"
},
{
@ -319,23 +332,20 @@
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 4,
"gradientMode": "none",
"fillOpacity": 10,
"gradientMode": "opacity",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineStyle": {
"fill": "solid"
},
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
@ -353,6 +363,10 @@
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
@ -361,7 +375,7 @@
"overrides": []
},
"gridPos": {
"h": 7,
"h": 6,
"w": 12,
"x": 12,
"y": 3
@ -373,7 +387,7 @@
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": false
"showLegend": true
},
"tooltip": {
"mode": "multi",
@ -383,7 +397,7 @@
"pluginVersion": "8.1.4",
"targets": [
{
"alias": " $col ($tag_servername)",
"alias": "$col",
"datasource": {
"type": "influxdb",
"uid": "${DS_HMCI}"
@ -462,7 +476,7 @@
]
}
],
"title": "System Memory",
"title": "System Memory Utilization",
"type": "timeseries"
},
{
@ -483,7 +497,7 @@
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 4,
"fillOpacity": 10,
"gradientMode": "opacity",
"hideFrom": {
"legend": false,
@ -492,11 +506,11 @@
},
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 3,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
@ -516,6 +530,10 @@
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
@ -525,9 +543,9 @@
},
"gridPos": {
"h": 9,
"w": 12,
"w": 15,
"x": 0,
"y": 10
"y": 9
},
"id": 19,
"links": [],
@ -536,17 +554,17 @@
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": false
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "none"
"sort": "desc"
}
},
"pluginVersion": "8.1.4",
"targets": [
{
"alias": "$tag_poolname ($tag_servername)",
"alias": "$tag_poolname",
"datasource": {
"type": "influxdb",
"uid": "${DS_HMCI}"
@ -615,7 +633,7 @@
]
}
],
"title": "Shared Processor Pools",
"title": "Shared Processor Pools - Core Utilization",
"type": "timeseries"
},
{
@ -625,9 +643,6 @@
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"decimals": 2,
"mappings": [],
"max": 1,
@ -639,13 +654,9 @@
"color": "green",
"value": null
},
{
"color": "#EAB839",
"value": 0.75
},
{
"color": "red",
"value": 0.85
"value": 80
}
]
},
@ -655,12 +666,15 @@
},
"gridPos": {
"h": 9,
"w": 8,
"x": 12,
"y": 10
"w": 5,
"x": 15,
"y": 9
},
"id": 29,
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
@ -669,13 +683,12 @@
"fields": "",
"values": false
},
"showThresholdLabels": false,
"showThresholdMarkers": true
"textMode": "auto"
},
"pluginVersion": "9.1.6",
"targets": [
{
"alias": "$tag_poolname ($tag_servername)",
"alias": "$tag_poolname",
"datasource": {
"type": "influxdb",
"uid": "${DS_HMCI}"
@ -703,7 +716,7 @@
"measurement": "server_sharedProcessorPool",
"orderByTime": "ASC",
"policy": "default",
"query": "SELECT mean(\"utilizedProcUnits\") / mean(\"assignedProcUnits\") AS \"Utilization\" FROM \"server_sharedProcessorPool\" WHERE (\"servername\" =~ /^$ServerName$/) AND $timeFilter GROUP BY time($__interval), \"poolname\", \"servername\" fill(none)",
"query": "SELECT mean(\"utilizedProcUnits\") / mean(\"assignedProcUnits\") AS \"Utilization\" FROM \"server_sharedProcessorPool\" WHERE (\"servername\" =~ /^$ServerName$/) AND $timeFilter GROUP BY time($__interval), \"poolname\" fill(none)",
"rawQuery": true,
"refId": "A",
"resultFormat": "time_series",
@ -730,8 +743,8 @@
]
}
],
"title": "Shared Processor Pools",
"type": "gauge"
"title": "Shared Processor Pools - Utilization",
"type": "stat"
},
{
"datasource": {
@ -742,10 +755,10 @@
"defaults": {
"decimals": 2,
"mappings": [],
"max": 1,
"max": 100,
"min": 0,
"thresholds": {
"mode": "absolute",
"mode": "percentage",
"steps": [
{
"color": "green",
@ -753,11 +766,11 @@
},
{
"color": "orange",
"value": 0.75
"value": 70
},
{
"color": "red",
"value": 0.85
"value": 85
}
]
},
@ -769,7 +782,7 @@
"h": 9,
"w": 4,
"x": 20,
"y": 10
"y": 9
},
"id": 30,
"options": {
@ -787,7 +800,7 @@
"pluginVersion": "9.1.6",
"targets": [
{
"alias": "$tag_servername",
"alias": "",
"datasource": {
"type": "influxdb",
"uid": "${DS_HMCI}"
@ -815,7 +828,7 @@
"measurement": "server_sharedProcessorPool",
"orderByTime": "ASC",
"policy": "default",
"query": "SELECT mean(\"utilizedProcUnits\") / mean(\"totalProcUnits\") AS \"Utilization\" FROM \"server_processor\" WHERE (\"servername\" =~ /^$ServerName$/) AND $timeFilter GROUP BY \"servername\", time($__interval) fill(none)",
"query": "SELECT mean(\"utilizedProcUnits\") / mean(\"totalProcUnits\") AS \"Utilization\" FROM \"server_processor\" WHERE (\"servername\" =~ /^$ServerName$/) AND $timeFilter GROUP BY time($__interval) fill(none)",
"rawQuery": true,
"refId": "A",
"resultFormat": "time_series",
@ -842,7 +855,7 @@
]
}
],
"title": "System Processors",
"title": "System Processors - Utilization",
"type": "gauge"
},
{
@ -907,7 +920,7 @@
"h": 9,
"w": 12,
"x": 0,
"y": 19
"y": 18
},
"id": 27,
"links": [],
@ -916,7 +929,7 @@
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": false
"showLegend": true
},
"tooltip": {
"mode": "multi",
@ -926,7 +939,7 @@
"pluginVersion": "8.1.4",
"targets": [
{
"alias": "$col ($tag_servername)",
"alias": "$col",
"datasource": {
"type": "influxdb",
"uid": "${DS_HMCI}"
@ -995,6 +1008,24 @@
"type": "alias"
}
],
[
{
"params": [
"availableProcUnits"
],
"type": "field"
},
{
"params": [],
"type": "mean"
},
{
"params": [
"available"
],
"type": "alias"
}
],
[
{
"params": [
@ -1023,7 +1054,7 @@
]
}
],
"title": "Physical Processor Pool",
"title": "Physical Processor Pool - Core Utilization",
"type": "timeseries"
},
{
@ -1088,7 +1119,7 @@
"h": 9,
"w": 12,
"x": 12,
"y": 19
"y": 18
},
"id": 35,
"links": [],
@ -1097,7 +1128,7 @@
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": false
"showLegend": true
},
"tooltip": {
"mode": "multi",
@ -1107,7 +1138,7 @@
"pluginVersion": "8.1.4",
"targets": [
{
"alias": "$tag_poolname ($tag_servername)",
"alias": "$tag_poolname",
"datasource": {
"type": "influxdb",
"uid": "${DS_HMCI}"
@ -1126,12 +1157,6 @@
],
"type": "tag"
},
{
"params": [
"servername"
],
"type": "tag"
},
{
"params": [
"none"
@ -1174,7 +1199,7 @@
]
}
],
"title": "Shared Processor Pools",
"title": "Shared Processor Pools - Core Utilization",
"type": "timeseries"
},
{
@ -1270,7 +1295,7 @@
"h": 9,
"w": 12,
"x": 0,
"y": 28
"y": 27
},
"id": 11,
"links": [],
@ -1279,7 +1304,7 @@
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": false
"showLegend": true
},
"tooltip": {
"mode": "multi",
@ -1289,7 +1314,7 @@
"pluginVersion": "8.1.4",
"targets": [
{
"alias": "vlan $tag_vlanId ($tag_servername)",
"alias": "vlan $tag_vlanId",
"datasource": {
"type": "influxdb",
"uid": "${DS_HMCI}"
@ -1314,12 +1339,6 @@
],
"type": "tag"
},
{
"params": [
"servername"
],
"type": "tag"
},
{
"params": [
"none"
@ -1356,7 +1375,7 @@
]
}
],
"title": "Network Throughput - Transferred By VLAN",
"title": "Network Throughput - By VLAN",
"type": "timeseries"
},
{
@ -1423,7 +1442,7 @@
"h": 9,
"w": 12,
"x": 12,
"y": 28
"y": 27
},
"id": 16,
"links": [],
@ -1432,7 +1451,7 @@
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": false
"showLegend": true
},
"tooltip": {
"mode": "multi",
@ -1442,7 +1461,7 @@
"pluginVersion": "8.1.4",
"targets": [
{
"alias": "$tag_location ($tag_servername)",
"alias": "$tag_location $col",
"datasource": {
"type": "influxdb",
"uid": "${DS_HMCI}"
@ -1467,12 +1486,6 @@
],
"type": "tag"
},
{
"params": [
"servername"
],
"type": "tag"
},
{
"params": [
"none"
@ -1509,7 +1522,450 @@
]
}
],
"title": "Physical Fiber Channel Adapters - Transmitted",
"title": "Physical Fiber Channel Adapters",
"type": "timeseries"
},
{
"datasource": {
"type": "influxdb",
"uid": "${DS_HMCI}"
},
"description": "",
"fieldConfig": {
"defaults": {
"color": {
"mode": "continuous-BlYlRd"
},
"decimals": 1,
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "celsius"
},
"overrides": []
},
"gridPos": {
"h": 10,
"w": 12,
"x": 0,
"y": 36
},
"id": 26,
"options": {
"displayMode": "lcd",
"minVizHeight": 10,
"minVizWidth": 0,
"orientation": "horizontal",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"showUnfilled": true
},
"pluginVersion": "9.1.6",
"targets": [
{
"alias": "$col",
"datasource": {
"type": "influxdb",
"uid": "${DS_HMCI}"
},
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"system"
],
"type": "tag"
},
{
"params": [
"none"
],
"type": "fill"
}
],
"measurement": "server_energy_thermal",
"orderByTime": "ASC",
"policy": "default",
"query": "SELECT mean(\"cpuTemperature*\") FROM \"server_energy_thermal\" WHERE (\"servername\" =~ /^$ServerName$/) AND $timeFilter GROUP BY time($__interval), \"system\", \"servername\" fill(linear)",
"rawQuery": false,
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"cpuTemperature_1"
],
"type": "field"
},
{
"params": [],
"type": "mean"
},
{
"params": [
"CPU-1"
],
"type": "alias"
}
],
[
{
"params": [
"cpuTemperature_2"
],
"type": "field"
},
{
"params": [],
"type": "mean"
},
{
"params": [
"CPU-2"
],
"type": "alias"
}
],
[
{
"params": [
"cpuTemperature_3"
],
"type": "field"
},
{
"params": [],
"type": "mean"
},
{
"params": [
"CPU-3"
],
"type": "alias"
}
],
[
{
"params": [
"cpuTemperature_4"
],
"type": "field"
},
{
"params": [],
"type": "mean"
},
{
"params": [
"CPU-4"
],
"type": "alias"
}
]
],
"tags": [
{
"key": "servername",
"operator": "=~",
"value": "/^$ServerName$/"
}
]
}
],
"title": "CPU Temperature",
"type": "bargauge"
},
{
"datasource": {
"type": "influxdb",
"uid": "${DS_HMCI}"
},
"description": "",
"fieldConfig": {
"defaults": {
"color": {
"mode": "continuous-BlYlRd"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 20,
"gradientMode": "scheme",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "smooth",
"lineWidth": 3,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 10,
"w": 6,
"x": 12,
"y": 36
},
"id": 34,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"pluginVersion": "8.1.4",
"targets": [
{
"alias": "$tag_servername",
"datasource": {
"type": "influxdb",
"uid": "${DS_HMCI}"
},
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"servername"
],
"type": "tag"
},
{
"params": [
"none"
],
"type": "fill"
}
],
"measurement": "server_energy_thermal",
"orderByTime": "ASC",
"policy": "default",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"inletTemperature_1"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": [
{
"key": "servername",
"operator": "=~",
"value": "/^$ServerName$/"
}
]
}
],
"title": "Inlet Temperature",
"type": "timeseries"
},
{
"datasource": {
"type": "influxdb",
"uid": "${DS_HMCI}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "continuous-GrYlRd"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 20,
"gradientMode": "scheme",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "smooth",
"lineWidth": 3,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 10,
"w": 6,
"x": 18,
"y": 36
},
"id": 22,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"pluginVersion": "8.1.4",
"targets": [
{
"alias": "$tag_servername",
"datasource": {
"type": "influxdb",
"uid": "${DS_HMCI}"
},
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"servername"
],
"type": "tag"
},
{
"params": [
"none"
],
"type": "fill"
}
],
"measurement": "server_energy_power",
"orderByTime": "ASC",
"policy": "default",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"powerReading"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": [
{
"key": "servername",
"operator": "=~",
"value": "/^$ServerName$/"
}
]
}
],
"title": "Power Consumption",
"type": "timeseries"
}
],
@ -1530,9 +1986,9 @@
},
"definition": "SHOW TAG VALUES FROM \"server_processor\" WITH KEY = \"servername\" WHERE time > now() - 24h",
"hide": 0,
"includeAll": true,
"includeAll": false,
"label": "Server",
"multi": true,
"multi": false,
"multiFormat": "regex values",
"name": "ServerName",
"options": [],
@ -1579,6 +2035,6 @@
"timezone": "browser",
"title": "HMCi - Power System Overview",
"uid": "ClJhHPIGz",
"version": 10,
"version": 3,
"weekStart": ""
}

View File

@ -1390,8 +1390,7 @@
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
"color": "green"
}
]
},
@ -1564,8 +1563,7 @@
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
"color": "green"
},
{
"color": "red",
@ -1708,7 +1706,7 @@
},
"definition": "SHOW TAG VALUES FROM \"server_processor\" WITH KEY = \"servername\" WHERE time > now() - 24h",
"hide": 0,
"includeAll": true,
"includeAll": false,
"label": "Server",
"multi": true,
"multiFormat": "regex values",
@ -1781,6 +1779,6 @@
"timezone": "browser",
"title": "HMCi - Power VIO Overview",
"uid": "DDNEv5vGz",
"version": 3,
"version": 2,
"weekStart": ""
}

View File

@ -3,23 +3,14 @@
###
### Define one InfluxDB to save metrics into
### There must be only one and it should be named [influx]
###
# InfluxDB v1.x example
#[influx]
#url = "http://localhost:8086"
#username = "root"
#password = ""
#database = "hmci"
# InfluxDB v2.x example
[influx]
url = "http://localhost:8086"
org = "myOrg"
token = "rAnd0mT0k3nG3neRaT3dByInF1uxDb=="
bucket = "hmci"
username = "root"
password = ""
database = "hmci"
###

View File

@ -7,7 +7,6 @@ When installed Grafana listens on [http://localhost:3000](http://localhost:3000)
- Configure Grafana to use InfluxDB as a new datasource
- Name the datasource **hmci** to make it obvious what it contains.
- You would typically use *http://localhost:8086* without any credentials.
- For InfluxDB 2.x add a custom header: Authorization = Token myTokenFromInfluxDB
- The name of the database would be *hmci* (or another name you used when creating it)
- **NOTE:** set *Min time interval* to *30s* or *1m* depending on your HMCi *refresh* setting.

View File

@ -1,10 +0,0 @@
# InfluxDB Notes
## Delete data
To delete *all* data before a specific date, run:
```sql
DELETE WHERE time < '2023-01-01'
```

View File

@ -1,3 +1,3 @@
projectId = hmci
projectGroup = biz.nellemann.hmci
projectVersion = 1.4.4
projectVersion = 1.4.3

View File

@ -16,82 +16,65 @@
package biz.nellemann.hmci;
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.influxdb.BatchOptions;
import org.influxdb.InfluxDB;
import org.influxdb.InfluxDBFactory;
import org.influxdb.dto.Point;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import static java.lang.Thread.sleep;
public final class InfluxClient {
private final static Logger log = LoggerFactory.getLogger(InfluxClient.class);
final private String url;
final private String org; // v2 only
final private String token;
final private String bucket; // Bucket in v2, Database in v1
private InfluxDBClient influxDBClient;
private WriteApi writeApi;
final private String username;
final private String password;
final private String database;
private InfluxDB influxDB;
InfluxClient(InfluxConfiguration config) {
this.url = config.url;
if(config.org != null) {
this.org = config.org;
} else {
this.org = "hmci"; // In InfluxDB 1.x, there is no concept of organization.
}
if(config.token != null) {
this.token = config.token;
} else {
this.token = config.username + ":" + config.password;
}
if(config.bucket != null) {
this.bucket = config.bucket;
} else {
this.bucket = config.database;
}
this.username = config.username;
this.password = config.password;
this.database = config.database;
}
synchronized void login() throws RuntimeException, InterruptedException {
if(influxDBClient != null) {
if(influxDB != null) {
return;
}
boolean connected = false;
int loginErrors = 0;
do {
try {
log.debug("Connecting to InfluxDB - {}", url);
influxDBClient = InfluxDBClientFactory.create(url, token.toCharArray(), org, bucket);
influxDBClient.version(); // This ensures that we actually try to connect to the db
Runtime.getRuntime().addShutdownHook(new Thread(influxDBClient::close));
influxDB = InfluxDBFactory.connect(url, username, password).setDatabase(database);
influxDB.version(); // This ensures that we actually try to connect to the db
// Todo: Handle events - https://github.com/influxdata/influxdb-client-java/tree/master/client#handle-the-events
//writeApi = influxDBClient.makeWriteApi();
writeApi = influxDBClient.makeWriteApi(
WriteOptions.builder()
.bufferLimit(20_000)
.flushInterval(5_000)
.build());
influxDB.enableBatch(
BatchOptions.DEFAULTS
.flushDuration(5000)
.threadFactory(runnable -> {
Thread thread = new Thread(runnable);
thread.setDaemon(true);
return thread;
})
);
Runtime.getRuntime().addShutdownHook(new Thread(influxDB::close));
connected = true;
} catch(Exception e) {
sleep(15 * 1000);
if(loginErrors++ > 3) {
@ -107,10 +90,10 @@ public final class InfluxClient {
synchronized void logoff() {
if(influxDBClient != null) {
influxDBClient.close();
if(influxDB != null) {
influxDB.close();
}
influxDBClient = null;
influxDB = null;
}
@ -118,7 +101,7 @@ public final class InfluxClient {
log.debug("write() - measurement: {} {}", name, measurements.size());
if(!measurements.isEmpty()) {
processMeasurementMap(measurements, name).forEach((point) -> {
writeApi.writePoint(point);
influxDB.write(point);
});
}
}
@ -128,11 +111,11 @@ public final class InfluxClient {
List<Point> listOfPoints = new ArrayList<>();
measurements.forEach( (m) -> {
log.trace("processMeasurementMap() - timestamp: {}, tags: {}, fields: {}", m.timestamp, m.tags, m.fields);
Point point = new Point(name)
.time(m.timestamp.getEpochSecond(), WritePrecision.S)
.addTags(m.tags)
.addFields(m.fields);
listOfPoints.add(point);
Point.Builder builder = Point.measurement(name)
.time(m.timestamp.getEpochSecond(), TimeUnit.SECONDS)
.tag(m.tags)
.fields(m.fields);
listOfPoints.add(builder.build());
});
return listOfPoints;
}

View File

@ -3,10 +3,6 @@ package biz.nellemann.hmci.dto.toml;
public class InfluxConfiguration {
public String url;
public String org;
public String token;
public String bucket;
public String username;
public String password;
public String database;