Merged development into tracefiles

This commit is contained in:
Mark Nellemann 2021-06-11 02:13:27 +02:00
commit cc74b2e662
15 changed files with 1087 additions and 827 deletions

View file

@ -7,5 +7,5 @@ trim_trailing_whitespace = true
indent_style = space
indent_size = 4
[*.yml]
[*.{yml,json}]
indent_size = 2

View file

@ -53,7 +53,7 @@ Install InfluxDB on an *LPAR* or other server, which is network accessible by th
### Grafana Configuration
- Configure Grafana to use InfluxDB as a new datasource
- set *Min time interval* to *30s* or *1m* depending on your HMCi *refresh* setting.
- **NOTE:** set *Min time interval* to *30s* or *1m* depending on your HMCi *refresh* setting.
- Import example dashboards from the *doc/* folder into Grafana as a starting point and get creative making your own cool dashboards :)
## Notes
@ -87,10 +87,9 @@ ALTER RETENTION POLICY "autogen" ON "hmci" DURATION 90d
Below are screenshots of the provided Grafana dashboards (found in the **doc/** folder), which can be used as a starting point.
- [hmci-resources.png](https://bitbucket.org/mnellemann/hmci/downloads/hmci-resources.png)
- [hmci-energy.png](https://bitbucket.org/mnellemann/hmci/downloads/hmci-energy.png)
- [hmci-vois.png](https://bitbucket.org/mnellemann/hmci/downloads/hmci-vios.png)
- [hmci-lpars](https://bitbucket.org/mnellemann/hmci/downloads/hmci-lpars.png)
- [hmci-systems.png](https://bitbucket.org/mnellemann/hmci/downloads/hmci-systems-dashboard.png)
- [hmci-vois.png](https://bitbucket.org/mnellemann/hmci/downloads/hmci-vios-dashboard.png)
- [hmci-lpars](https://bitbucket.org/mnellemann/hmci/downloads/hmci-lpars-dashboard.png)
## Known problems

View file

@ -6,13 +6,14 @@ plugins {
// Code coverage of tests
id 'jacoco'
id "com.github.johnrengelman.shadow" version "6.1.0"
id "com.github.johnrengelman.shadow" version "7.0.0"
id "net.nemerosa.versioning" version "2.14.0"
id "nebula.ospackage" version "8.4.1"
id "nebula.ospackage" version "8.5.6"
}
repositories {
jcenter()
mavenCentral()
mavenLocal()
}
dependencies {
@ -27,13 +28,13 @@ dependencies {
implementation 'org.slf4j:slf4j-api:1.7.30'
implementation '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-groovy-3.0'
testImplementation 'com.squareup.okhttp3:mockwebserver:4.9.1'
testImplementation "org.slf4j:slf4j-simple:1.7.30"
}
application {
mainClassName = 'biz.nellemann.hmci.Application'
mainClass.set('biz.nellemann.hmci.Application')
}
test {

View file

@ -1,16 +1,8 @@
{
"__inputs": [
{
"name": "DS_HMCI",
"label": "HMCi",
"description": "",
"type": "datasource",
"pluginId": "influxdb",
"pluginName": "InfluxDB"
},
{
"name": "DS_INFLUXDB",
"label": "InfluxDB",
"name": "DS_INFLUXDB-HMCI",
"label": "InfluxDB-hmci",
"description": "",
"type": "datasource",
"pluginId": "influxdb",
@ -22,12 +14,12 @@
"type": "grafana",
"id": "grafana",
"name": "Grafana",
"version": "7.4.2"
"version": "8.0.0"
},
{
"type": "panel",
"id": "graph",
"name": "Graph",
"name": "Graph (old)",
"version": ""
},
{
@ -61,7 +53,7 @@
"gnetId": null,
"graphTooltip": 0,
"id": null,
"iteration": 1617197417499,
"iteration": 1623356314349,
"links": [],
"panels": [
{
@ -69,11 +61,10 @@
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_HMCI}",
"datasource": "${DS_INFLUXDB-HMCI}",
"description": "",
"fieldConfig": {
"defaults": {
"custom": {},
"links": [],
"unit": "watt"
},
@ -105,7 +96,7 @@
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "7.4.2",
"pluginVersion": "8.0.0",
"pointradius": 2,
"points": false,
"renderer": "flot",
@ -208,10 +199,9 @@
}
},
{
"datasource": "${DS_HMCI}",
"datasource": "${DS_INFLUXDB-HMCI}",
"fieldConfig": {
"defaults": {
"custom": {},
"mappings": [],
"thresholds": {
"mode": "absolute",
@ -256,7 +246,7 @@
"text": {},
"textMode": "auto"
},
"pluginVersion": "7.4.2",
"pluginVersion": "8.0.0",
"targets": [
{
"alias": "$tag_servername",
@ -315,7 +305,7 @@
},
{
"collapsed": false,
"datasource": "${DS_INFLUXDB}",
"datasource": "${DS_INFLUXDB-HMCI}",
"gridPos": {
"h": 1,
"w": 24,
@ -329,14 +319,13 @@
"type": "row"
},
{
"datasource": "${DS_HMCI}",
"datasource": "${DS_INFLUXDB-HMCI}",
"description": "Inlet air temperature.",
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"custom": {},
"links": [],
"mappings": [],
"thresholds": {
@ -382,7 +371,7 @@
"text": {},
"textMode": "auto"
},
"pluginVersion": "7.4.2",
"pluginVersion": "8.0.0",
"targets": [
{
"alias": "$tag_servername - $tag_name",
@ -444,16 +433,11 @@
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_HMCI}",
"datasource": "${DS_INFLUXDB-HMCI}",
"description": "",
"fieldConfig": {
"defaults": {
"custom": {},
"links": [],
"thresholds": {
"mode": "absolute",
"steps": []
},
"unit": "celsius"
},
"overrides": []
@ -486,7 +470,7 @@
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "7.4.2",
"pluginVersion": "8.0.0",
"pointradius": 2,
"points": false,
"renderer": "flot",
@ -653,7 +637,7 @@
}
],
"refresh": "1m",
"schemaVersion": 27,
"schemaVersion": 30,
"style": "dark",
"tags": [
"POWER"
@ -663,7 +647,7 @@
{
"allValue": null,
"current": {},
"datasource": "${DS_HMCI}",
"datasource": "${DS_INFLUXDB-HMCI}",
"definition": "SHOW TAG VALUES FROM \"server_processor\" WITH KEY = \"servername\" WHERE time > now() - 24h",
"description": null,
"error": null,
@ -679,7 +663,6 @@
"skipUrlSync": false,
"sort": 0,
"tagValuesQuery": "",
"tags": [],
"tagsQuery": "",
"type": "query",
"useTags": false
@ -706,5 +689,5 @@
"timezone": "",
"title": "IBM Power - HMCi - System Energy",
"uid": "oHcrgD1Mk",
"version": 20
"version": 2
}

View file

@ -1,8 +1,8 @@
{
"__inputs": [
{
"name": "DS_HMCI",
"label": "HMCi",
"name": "DS_INFLUXDB-HMCI",
"label": "InfluxDB-hmci",
"description": "",
"type": "datasource",
"pluginId": "influxdb",
@ -20,12 +20,12 @@
"type": "grafana",
"id": "grafana",
"name": "Grafana",
"version": "7.4.2"
"version": "8.0.0"
},
{
"type": "panel",
"id": "graph",
"name": "Graph",
"name": "Graph (old)",
"version": ""
},
{
@ -60,11 +60,11 @@
"gnetId": 1465,
"graphTooltip": 0,
"id": null,
"iteration": 1617197467456,
"iteration": 1623369402365,
"links": [],
"panels": [
{
"datasource": "${DS_HMCI}",
"datasource": "${DS_INFLUXDB-HMCI}",
"description": "",
"fieldConfig": {
"defaults": {
@ -92,7 +92,7 @@
{
"matcher": {
"id": "byName",
"options": "lparname"
"options": "Name"
},
"properties": [
{
@ -104,18 +104,34 @@
{
"matcher": {
"id": "byName",
"options": "affinityScore"
"options": "Affinity Score"
},
"properties": [
{
"id": "color",
"value": {
"mode": "thresholds"
"mode": "continuous-RdYlGr"
}
},
{
"id": "unit",
"value": "percent"
},
{
"id": "custom.displayMode",
"value": "basic"
}
]
},
{
"matcher": {
"id": "byName",
"options": "ID"
},
"properties": [
{
"id": "custom.width",
"value": 330
}
]
}
@ -132,7 +148,7 @@
"showHeader": true,
"sortBy": []
},
"pluginVersion": "7.4.2",
"pluginVersion": "8.0.0",
"targets": [
{
"alias": "Read",
@ -199,17 +215,51 @@
],
"timeFrom": null,
"timeShift": null,
"title": "",
"transformations": [
{
"id": "organize",
"options": {
"excludeByName": {
"Time": true
},
"indexByName": {
"Time": 0,
"affinityScore": 4,
"id": 1,
"viosname": 2,
"viosstate": 3
},
"renameByName": {
"affinityScore": "Affinity Score",
"id": "ID",
"viosname": "Name",
"viosstate": "State"
}
}
},
{
"id": "sortBy",
"options": {
"fields": {},
"sort": [
{
"field": "Name"
}
]
}
}
],
"type": "table"
},
{
"datasource": "${DS_HMCI}",
"datasource": "${DS_INFLUXDB-HMCI}",
"description": "",
"fieldConfig": {
"defaults": {
"custom": {},
"links": [],
"mappings": [],
"max": 100,
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
@ -238,7 +288,7 @@
"options": {
"reduceOptions": {
"calcs": [
"mean"
"lastNotNull"
],
"fields": "",
"values": false
@ -247,7 +297,7 @@
"showThresholdMarkers": true,
"text": {}
},
"pluginVersion": "7.4.2",
"pluginVersion": "8.0.0",
"targets": [
{
"alias": "$tag_viosname",
@ -288,7 +338,7 @@
},
{
"params": [],
"type": "mean"
"type": "last"
}
]
],
@ -318,19 +368,18 @@
"content": "",
"dashLength": 10,
"dashes": false,
"datasource": "${DS_HMCI}",
"datasource": "${DS_INFLUXDB-HMCI}",
"description": "",
"editable": true,
"error": false,
"fieldConfig": {
"defaults": {
"custom": {},
"links": []
},
"overrides": []
},
"fill": 2,
"fillGradient": 2,
"fill": 1,
"fillGradient": 0,
"grid": {},
"gridPos": {
"h": 9,
@ -352,7 +401,7 @@
"values": false
},
"lines": true,
"linewidth": 2,
"linewidth": 1,
"links": [],
"mode": "",
"nullPointMode": "connected",
@ -360,7 +409,7 @@
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "7.4.2",
"pluginVersion": "8.0.0",
"pointradius": 5,
"points": false,
"renderer": "flot",
@ -371,7 +420,7 @@
"style": {},
"targets": [
{
"alias": "$tag_viosname",
"alias": "$tag_viosname - $col",
"dsType": "influxdb",
"groupBy": [
{
@ -410,6 +459,12 @@
{
"params": [],
"type": "mean"
},
{
"params": [
"utilized"
],
"type": "alias"
}
]
],
@ -478,13 +533,12 @@
"content": "",
"dashLength": 10,
"dashes": false,
"datasource": "${DS_HMCI}",
"datasource": "${DS_INFLUXDB-HMCI}",
"description": "",
"editable": true,
"error": false,
"fieldConfig": {
"defaults": {
"custom": {},
"links": []
},
"overrides": []
@ -493,23 +547,23 @@
"fillGradient": 1,
"grid": {},
"gridPos": {
"h": 9,
"w": 24,
"h": 18,
"w": 12,
"x": 0,
"y": 14
},
"hiddenSeries": false,
"id": 18,
"legend": {
"alignAsTable": true,
"avg": true,
"alignAsTable": false,
"avg": false,
"current": false,
"max": true,
"max": false,
"min": false,
"rightSide": false,
"show": false,
"show": true,
"total": false,
"values": true
"values": false
},
"lines": true,
"linewidth": 1,
@ -520,7 +574,7 @@
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "7.4.2",
"pluginVersion": "8.0.0",
"pointradius": 5,
"points": false,
"renderer": "flot",
@ -725,13 +779,12 @@
"content": "",
"dashLength": 10,
"dashes": false,
"datasource": "${DS_HMCI}",
"datasource": "${DS_INFLUXDB-HMCI}",
"description": "",
"editable": true,
"error": false,
"fieldConfig": {
"defaults": {
"custom": {},
"links": []
},
"overrides": []
@ -740,23 +793,23 @@
"fillGradient": 1,
"grid": {},
"gridPos": {
"h": 9,
"w": 24,
"x": 0,
"y": 23
"h": 18,
"w": 12,
"x": 12,
"y": 14
},
"hiddenSeries": false,
"id": 17,
"legend": {
"alignAsTable": true,
"avg": true,
"alignAsTable": false,
"avg": false,
"current": false,
"max": true,
"min": true,
"max": false,
"min": false,
"rightSide": false,
"show": false,
"show": true,
"total": false,
"values": true
"values": false
},
"lines": true,
"linewidth": 1,
@ -767,7 +820,7 @@
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "7.4.2",
"pluginVersion": "8.0.0",
"pointradius": 5,
"points": false,
"renderer": "flot",
@ -995,7 +1048,7 @@
}
],
"refresh": "1m",
"schemaVersion": 27,
"schemaVersion": 30,
"style": "dark",
"tags": [
"Power",
@ -1008,7 +1061,7 @@
"allFormat": "regex values",
"allValue": null,
"current": {},
"datasource": "${DS_HMCI}",
"datasource": "${DS_INFLUXDB-HMCI}",
"definition": "SHOW TAG VALUES FROM \"server_processor\" WITH KEY = \"servername\" WHERE time > now() - 24h",
"description": null,
"error": null,
@ -1026,7 +1079,6 @@
"skipUrlSync": false,
"sort": 0,
"tagValuesQuery": null,
"tags": [],
"tagsQuery": null,
"type": "query",
"useTags": false
@ -1035,7 +1087,7 @@
"allFormat": "regex values",
"allValue": null,
"current": {},
"datasource": "${DS_HMCI}",
"datasource": "${DS_INFLUXDB-HMCI}",
"definition": "SHOW TAG VALUES FROM \"vios_details\" WITH KEY = \"viosname\" WHERE servername =~ /$ServerName/ AND time > now() - 24h",
"description": null,
"error": null,
@ -1053,7 +1105,6 @@
"skipUrlSync": false,
"sort": 0,
"tagValuesQuery": null,
"tags": [],
"tagsQuery": null,
"type": "query",
"useTags": false
@ -1092,5 +1143,5 @@
"timezone": "browser",
"title": "IBM Power - HMCi - Virtual I/O Servers",
"uid": "DDNEv5vGz",
"version": 18
"version": 4
}

View file

@ -5,10 +5,15 @@
To install as a systemd service, copy the **hmci.service**
file into */etc/systemd/system/* and enable the service:
systemctl daemon-reload
systemctl enable hmci.service
systemctl restart hmci.service
```shell
cp /opt/hmci/doc/hmci.service /etc/systemd/system/
systemctl daemon-reload
systemctl enable hmci.service
systemctl restart hmci.service
```
To read log output from the service, use:
To read log output from the service:
journalctl -f -u hmci.service
```shell
journalctl -f -u hmci.service
```

Binary file not shown.

View file

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

2
gradlew vendored
View file

@ -130,7 +130,7 @@ fi
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath

21
gradlew.bat vendored
View file

@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@ -54,7 +54,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@ -64,21 +64,6 @@ echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
@ -86,7 +71,7 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell

View file

@ -249,7 +249,7 @@ public class HmcRestClient {
// Do not try to parse empty response
if(responseBody == null || responseBody.isEmpty() || responseBody.length() <= 1) {
responseErrors++;
log.warn("getPcmDataForManagedSystem() - empty response");
log.warn("getPcmDataForManagedSystem() - empty response, skipping: " + system.name);
return null;
}
@ -287,7 +287,7 @@ public class HmcRestClient {
// Do not try to parse empty response
if(responseBody == null || responseBody.isEmpty() || responseBody.length() <= 1) {
responseErrors++;
log.warn("getPcmDataForLogicalPartition() - empty response");
log.warn("getPcmDataForLogicalPartition() - empty response, skipping: " + partition.name);
return null;
}

View file

@ -122,13 +122,13 @@ class InfluxClient {
void writeManagedSystem(ManagedSystem system) {
if(system.metrics == null) {
log.trace("writeManagedSystem() - null metrics, skipping");
log.trace("writeManagedSystem() - null metrics, skipping: " + system.name);
return;
}
Instant timestamp = system.getTimestamp();
if(timestamp == null) {
log.warn("writeManagedSystem() - no timestamp, skipping");
log.warn("writeManagedSystem() - no timestamp, skipping: " + system.name);
return;
}
@ -253,13 +253,13 @@ class InfluxClient {
void writeLogicalPartition(LogicalPartition partition) {
if(partition.metrics == null) {
log.warn("writeLogicalPartition() - null metrics, skipping");
log.warn("writeLogicalPartition() - null metrics, skipping: " + partition.name);
return;
}
Instant timestamp = partition.getTimestamp();
if(timestamp == null) {
log.warn("writeLogicalPartition() - no timestamp, skipping");
log.warn("writeLogicalPartition() - no timestamp, skipping: " + partition.name);
return;
}
@ -311,21 +311,21 @@ class InfluxClient {
*/
void writeSystemEnergy(SystemEnergy system) {
void writeSystemEnergy(SystemEnergy systemEnergy) {
if(system.metrics == null) {
log.trace("writeSystemEnergy() - null metrics, skipping");
if(systemEnergy.metrics == null) {
log.trace("writeSystemEnergy() - null metrics, skipping: " + systemEnergy.system.name);
return;
}
Instant timestamp = system.getTimestamp();
Instant timestamp = systemEnergy.getTimestamp();
if(timestamp == null) {
log.warn("writeSystemEnergy() - no timestamp, skipping");
log.warn("writeSystemEnergy() - no timestamp, skipping: " + systemEnergy.system.name);
return;
}
getSystemEnergyPower(system, timestamp).forEach(it -> batchPoints.point(it) );
getSystemEnergyTemperature(system, timestamp).forEach(it -> batchPoints.point(it) );
getSystemEnergyPower(systemEnergy, timestamp).forEach(it -> batchPoints.point(it) );
getSystemEnergyTemperature(systemEnergy, timestamp).forEach(it -> batchPoints.point(it) );
}
private static List<Point> getSystemEnergyPower(SystemEnergy system, Instant timestamp) {

View file

@ -122,4 +122,21 @@ class LogicalPartitionTest extends Specification {
}
void "test getVirtualGenericAdapterMetrics"() {
setup:
def testFile = new File(getClass().getResource('/pcm-data-logical-partition.json').toURI())
def testJson = testFile.getText('UTF-8')
ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N")
LogicalPartition lpar = new LogicalPartition("2DE05DB6-8AD5-448F-8327-0F488D287E82", "9Flash01", "OS400", system)
when:
lpar.processMetrics(testJson)
List<Measurement> listOfMeasurements = lpar.getVirtualGenericAdapterMetrics()
then:
listOfMeasurements.size() == 1
listOfMeasurements.first().fields['readBytes'] == 0.0
}
}