Merged in development (pull request #9)

Development
This commit is contained in:
Mark Nellemann 2020-12-11 10:16:13 +00:00
commit 151a437800
28 changed files with 2669 additions and 2433 deletions

View file

@ -1,6 +1,6 @@
# HMC Insights # HMC Insights
**HMCi** is a utility that collects metrics from one or more *IBM Power HMC* systems. The metrics data is processed and saved into an InfluxDB time-series database. Grafana is used to visualize the metrics from InfluxDB. **HMCi** is a utility that collects metrics from one or more *IBM Power HMC* systems. The metric data is processed and saved into an InfluxDB time-series database. Grafana is used to visualize the metrics from InfluxDB.
Metrics includes *Managed Systems* (the physical Power servers) and *Logical Partitions* (the virtualized servers) running AIX, Linux and IBM-i (AS/400). Metrics includes *Managed Systems* (the physical Power servers) and *Logical Partitions* (the virtualized servers) running AIX, Linux and IBM-i (AS/400).
@ -36,15 +36,26 @@ Install InfluxDB on an *LPAR* or other server, which is network accessible by th
- Copy the *doc/hmci.toml* configuration example into */etc/hmci.toml* and edit the configuration to suit your environment. The location of the configuration file can be changed with a flag when running hmci. - Copy the *doc/hmci.toml* configuration example into */etc/hmci.toml* and edit the configuration to suit your environment. The location of the configuration file can be changed with a flag when running hmci.
- Run the *bin/hmci* program in a shell, as a @reboot cron task or setup a proper service :) - Run the *bin/hmci* program in a shell, as a @reboot cron task or setup a proper service :)
- When started, *hmci* will try to create the InfluxDB database named hmci, if not found. - When started, *hmci* will try to create the InfluxDB database named hmci, if not found.
- Configure Grafana to communicate with your InfluxDB and import dashboards from the *doc/* folder into Grafana (The dashboards are slightly modified versions of the dashboard provided by the nmon2influxdb tool) - Configure Grafana to communicate with your InfluxDB and import dashboards from the *doc/* folder into Grafana.
## Grafana Screenshots
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)
## Notes ## Notes
### InfluxDB ### InfluxDB
Examples on how to change the default InfluxDB retention policy for the hmci database: Per default the *hmci* influx database has no retention policy, so data will be kept forever. It is recommended to set a retention policy, which is shown below.
Examples for changing the default InfluxDB retention policy for the hmci database:
ALTER RETENTION POLICY "autogen" ON "hmci" DURATION 156w ALTER RETENTION POLICY "autogen" ON "hmci" DURATION 156w
ALTER RETENTION POLICY "autogen" ON "hmci" DURATION 90d ALTER RETENTION POLICY "autogen" ON "hmci" DURATION 90d

View file

@ -23,7 +23,7 @@ dependencies {
implementation 'com.squareup.moshi:moshi:1.11.0' implementation 'com.squareup.moshi:moshi:1.11.0'
implementation 'com.serjltt.moshi:moshi-lazy-adapters:2.2' implementation 'com.serjltt.moshi:moshi-lazy-adapters:2.2'
implementation 'org.tomlj:tomlj:1.0.0' implementation 'org.tomlj:tomlj:1.0.0'
implementation 'org.influxdb:influxdb-java:2.20' implementation 'org.influxdb:influxdb-java:2.21'
implementation 'org.slf4j:slf4j-api:1.7.+' implementation 'org.slf4j:slf4j-api:1.7.+'
runtimeOnly 'ch.qos.logback:logback-classic:1.+' runtimeOnly 'ch.qos.logback:logback-classic:1.+'
@ -35,7 +35,7 @@ dependencies {
} }
application { application {
mainClassName = 'biz.nellemann.hmci.Main' mainClassName = 'biz.nellemann.hmci.Application'
} }
test { test {

View file

@ -0,0 +1,657 @@
{
"__inputs": [
{
"name": "DS_HMCI",
"label": "HMCi",
"description": "",
"type": "datasource",
"pluginId": "influxdb",
"pluginName": "InfluxDB"
}
],
"__requires": [
{
"type": "grafana",
"id": "grafana",
"name": "Grafana",
"version": "7.3.1"
},
{
"type": "panel",
"id": "graph",
"name": "Graph",
"version": ""
},
{
"type": "datasource",
"id": "influxdb",
"name": "InfluxDB",
"version": "1.0.0"
},
{
"type": "panel",
"id": "stat",
"name": "Stat",
"version": ""
}
],
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"type": "dashboard"
}
]
},
"description": "https://bitbucket.org/mnellemann/hmci/",
"editable": true,
"gnetId": null,
"graphTooltip": 0,
"id": null,
"iteration": 1607681490214,
"links": [],
"panels": [
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_HMCI}",
"fieldConfig": {
"defaults": {
"custom": {},
"links": []
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 9,
"w": 12,
"x": 0,
"y": 0
},
"hiddenSeries": false,
"id": 2,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"nullPointMode": "null",
"options": {
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "7.3.1",
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"alias": "$tag_system",
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"system"
],
"type": "tag"
},
{
"params": [
"linear"
],
"type": "fill"
}
],
"measurement": "SystemEnergyPower",
"orderByTime": "ASC",
"policy": "default",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": [
{
"key": "system",
"operator": "=~",
"value": "/^$ManagedSystem$/"
}
]
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Power Usage",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"datasource": "${DS_HMCI}",
"fieldConfig": {
"defaults": {
"custom": {},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 1000
}
]
},
"unit": "watth"
},
"overrides": []
},
"gridPos": {
"h": 9,
"w": 12,
"x": 12,
"y": 0
},
"id": 7,
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"mean"
],
"fields": "",
"values": false
},
"textMode": "auto"
},
"pluginVersion": "7.3.1",
"targets": [
{
"alias": "$tag_system",
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"system"
],
"type": "tag"
},
{
"params": [
"linear"
],
"type": "fill"
}
],
"measurement": "SystemEnergyPower",
"orderByTime": "ASC",
"policy": "default",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": [
{
"key": "system",
"operator": "=~",
"value": "/^$ManagedSystem$/"
}
]
}
],
"timeFrom": null,
"timeShift": null,
"title": "Power Usage",
"type": "stat"
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_HMCI}",
"fieldConfig": {
"defaults": {
"custom": {},
"links": []
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 13,
"w": 12,
"x": 0,
"y": 9
},
"hiddenSeries": false,
"id": 4,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"nullPointMode": "null",
"options": {
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "7.3.1",
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"alias": "$tag_system - $tag_name",
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"system"
],
"type": "tag"
},
{
"params": [
"name"
],
"type": "tag"
},
{
"params": [
"linear"
],
"type": "fill"
}
],
"measurement": "SystemEnergyThermal",
"orderByTime": "ASC",
"policy": "default",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": [
{
"key": "name",
"operator": "=~",
"value": "/cpuTemperature_\\d+/"
},
{
"condition": "AND",
"key": "system",
"operator": "=~",
"value": "/^$ManagedSystem$/"
}
]
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "CPU Temperatures",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_HMCI}",
"fieldConfig": {
"defaults": {
"custom": {},
"links": []
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 13,
"w": 12,
"x": 12,
"y": 9
},
"hiddenSeries": false,
"id": 5,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"nullPointMode": "null",
"options": {
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "7.3.1",
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"alias": "$tag_system - $tag_name",
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"system"
],
"type": "tag"
},
{
"params": [
"name"
],
"type": "tag"
},
{
"params": [
"linear"
],
"type": "fill"
}
],
"measurement": "SystemEnergyThermal",
"orderByTime": "ASC",
"policy": "default",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": [
{
"key": "name",
"operator": "=",
"value": "inletTemperature_1"
},
{
"condition": "AND",
"key": "system",
"operator": "=~",
"value": "/^$ManagedSystem$/"
}
]
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Inlet Temperatures",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
}
],
"refresh": "30s",
"schemaVersion": 26,
"style": "dark",
"tags": [
"POWER"
],
"templating": {
"list": [
{
"allValue": null,
"current": {},
"datasource": "${DS_HMCI}",
"definition": "SHOW TAG VALUES FROM \"SystemProcessor\" WITH KEY = \"system\"",
"error": null,
"hide": 0,
"includeAll": false,
"label": null,
"multi": true,
"name": "ManagedSystem",
"options": [],
"query": "SHOW TAG VALUES FROM \"SystemProcessor\" WITH KEY = \"system\"",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"tagValuesQuery": "",
"tags": [],
"tagsQuery": "",
"type": "query",
"useTags": false
}
]
},
"time": {
"from": "now-3h",
"to": "now"
},
"timepicker": {
"refresh_intervals": [
"5s",
"10s",
"30s",
"1m",
"5m",
"15m",
"30m",
"1h",
"2h",
"1d"
]
},
"timezone": "",
"title": "IBM Power - HMC Managed Systems - Energy",
"uid": "oHcrgD1Mk",
"version": 2
}

View file

@ -0,0 +1,805 @@
{
"__inputs": [
{
"name": "DS_HMCI",
"label": "HMCi",
"description": "",
"type": "datasource",
"pluginId": "influxdb",
"pluginName": "InfluxDB"
}
],
"__requires": [
{
"type": "panel",
"id": "gauge",
"name": "Gauge",
"version": ""
},
{
"type": "grafana",
"id": "grafana",
"name": "Grafana",
"version": "7.3.1"
},
{
"type": "panel",
"id": "graph",
"name": "Graph",
"version": ""
},
{
"type": "datasource",
"id": "influxdb",
"name": "InfluxDB",
"version": "1.0.0"
}
],
"annotations": {
"enable": false,
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"type": "dashboard"
}
]
},
"description": "https://bitbucket.org/mnellemann/hmci/",
"editable": true,
"gnetId": 1510,
"graphTooltip": 0,
"id": null,
"iteration": 1607681518752,
"links": [],
"panels": [
{
"aliasColors": {},
"bars": false,
"content": "",
"dashLength": 10,
"dashes": false,
"datasource": "${DS_HMCI}",
"decimals": 2,
"editable": true,
"error": false,
"fieldConfig": {
"defaults": {
"custom": {},
"links": []
},
"overrides": []
},
"fill": 2,
"fillGradient": 0,
"grid": {},
"gridPos": {
"h": 11,
"w": 24,
"x": 0,
"y": 0
},
"hiddenSeries": false,
"id": 2,
"legend": {
"alignAsTable": true,
"avg": true,
"current": false,
"max": true,
"min": true,
"rightSide": false,
"show": false,
"sort": "avg",
"sortDesc": true,
"total": false,
"values": true
},
"lines": true,
"linewidth": 2,
"links": [],
"mode": "",
"nullPointMode": "connected",
"options": {
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "7.3.1",
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": true,
"steppedLine": false,
"style": {},
"targets": [
{
"alias": "$tag_partition $tag_name",
"dsType": "influxdb",
"groupBy": [
{
"params": [
"$interval"
],
"type": "time"
},
{
"params": [
"name"
],
"type": "tag"
},
{
"params": [
"partition"
],
"type": "tag"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"hide": false,
"measurement": "PartitionProcessor",
"orderByTime": "ASC",
"policy": "default",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": [
{
"key": "name",
"operator": "=",
"value": "utilizedProcUnits"
},
{
"condition": "AND",
"key": "system",
"operator": "=~",
"value": "/^$ManagedSystem$/"
},
{
"condition": "AND",
"key": "partition",
"operator": "=~",
"value": "/^$Partition$/"
}
]
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Processor Units - Utilization",
"tooltip": {
"msResolution": false,
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"$$hashKey": "object:4943",
"format": "short",
"label": "cores",
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"$$hashKey": "object:4944",
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": false,
"content": "",
"dashLength": 10,
"dashes": false,
"datasource": "${DS_HMCI}",
"description": "",
"editable": true,
"error": false,
"fieldConfig": {
"defaults": {
"custom": {},
"links": []
},
"overrides": []
},
"fill": 0,
"fillGradient": 0,
"grid": {},
"gridPos": {
"h": 11,
"w": 12,
"x": 0,
"y": 11
},
"hiddenSeries": false,
"id": 8,
"legend": {
"alignAsTable": true,
"avg": true,
"current": false,
"max": true,
"min": true,
"show": true,
"sort": "avg",
"sortDesc": true,
"total": false,
"values": true
},
"lines": true,
"linewidth": 2,
"mode": "",
"nullPointMode": "connected",
"options": {
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "7.3.1",
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"style": {},
"targets": [
{
"alias": "$tag_partition - VLAN $tag_vlanId: $tag_name",
"dsType": "influxdb",
"groupBy": [
{
"params": [
"$interval"
],
"type": "time"
},
{
"params": [
"name"
],
"type": "tag"
},
{
"params": [
"vlanId"
],
"type": "tag"
},
{
"params": [
"partition"
],
"type": "tag"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"hide": false,
"measurement": "PartitionVirtualEthernetAdapters",
"orderByTime": "ASC",
"policy": "default",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": [
{
"key": "partition",
"operator": "=~",
"value": "/^$Partition$/"
},
{
"condition": "AND",
"key": "name",
"operator": "!~",
"value": "/Physical/"
},
{
"condition": "AND",
"key": "system",
"operator": "=~",
"value": "/^$ManagedSystem$/"
}
]
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Virtual Network Adapters",
"tooltip": {
"msResolution": false,
"shared": true,
"sort": 0,
"value_type": "cumulative"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"$$hashKey": "object:10101",
"format": "Bps",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"$$hashKey": "object:10102",
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": false,
"content": "",
"dashLength": 10,
"dashes": false,
"datasource": "${DS_HMCI}",
"editable": true,
"error": false,
"fieldConfig": {
"defaults": {
"custom": {},
"links": []
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"grid": {},
"gridPos": {
"h": 11,
"w": 12,
"x": 12,
"y": 11
},
"hiddenSeries": false,
"id": 11,
"legend": {
"alignAsTable": true,
"avg": true,
"current": false,
"max": true,
"min": true,
"show": true,
"sort": "avg",
"sortDesc": true,
"total": false,
"values": true
},
"lines": true,
"linewidth": 2,
"mode": "",
"nullPointMode": "connected",
"options": {
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "7.3.1",
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": true,
"steppedLine": false,
"style": {},
"targets": [
{
"alias": "$tag_partition $tag_wwpn : $tag_name",
"dsType": "influxdb",
"groupBy": [
{
"params": [
"$interval"
],
"type": "time"
},
{
"params": [
"wwpn"
],
"type": "tag"
},
{
"params": [
"partition"
],
"type": "tag"
},
{
"params": [
"name"
],
"type": "tag"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"hide": false,
"measurement": "PartitionVirtualFiberChannelAdapters",
"orderByTime": "ASC",
"policy": "default",
"query": "SELECT mean(\"value\") FROM \"PartitionVirtualFiberChannelAdapters\" WHERE (\"system\" =~ /^$ManagedSystem$/ AND \"name\" != 'transmittedBytes' AND \"partition\" =~ /^$Partition$/) AND $timeFilter GROUP BY time($interval), \"wwpn\", \"partition\", \"name\" fill(null)",
"rawQuery": false,
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": [
{
"key": "system",
"operator": "=~",
"value": "/^$ManagedSystem$/"
},
{
"condition": "AND",
"key": "name",
"operator": "!=",
"value": "transmittedBytes"
},
{
"condition": "AND",
"key": "partition",
"operator": "=~",
"value": "/^$Partition$/"
}
]
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Virtual Fiber Channel Adapters",
"tooltip": {
"msResolution": false,
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"$$hashKey": "object:3776",
"format": "Bps",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"$$hashKey": "object:3777",
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"datasource": "${DS_HMCI}",
"description": "",
"fieldConfig": {
"defaults": {
"custom": {},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "red",
"value": null
},
{
"color": "yellow",
"value": 70
},
{
"color": "green",
"value": 100
}
]
},
"unit": "percent"
},
"overrides": []
},
"gridPos": {
"h": 14,
"w": 24,
"x": 0,
"y": 22
},
"id": 9,
"options": {
"orientation": "auto",
"reduceOptions": {
"calcs": [
"mean"
],
"fields": "",
"values": false
},
"showThresholdLabels": false,
"showThresholdMarkers": true
},
"pluginVersion": "7.3.1",
"targets": [
{
"alias": "$tag_partition: AffinityScore",
"dsType": "influxdb",
"groupBy": [
{
"params": [
"$interval"
],
"type": "time"
},
{
"params": [
"partition"
],
"type": "tag"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"hide": false,
"measurement": "PartitionAffinityScore",
"orderByTime": "ASC",
"policy": "default",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": [
{
"key": "system",
"operator": "=~",
"value": "/^$ManagedSystem$/"
},
{
"condition": "AND",
"key": "partition",
"operator": "=~",
"value": "/^$Partition$/"
},
{
"condition": "AND",
"key": "name",
"operator": "=",
"value": "affinityScore"
}
]
}
],
"timeFrom": null,
"timeShift": null,
"title": "NUMA Affinity Score",
"type": "gauge"
}
],
"refresh": "30s",
"schemaVersion": 26,
"style": "dark",
"tags": [
"Power"
],
"templating": {
"list": [
{
"allFormat": "regex values",
"allValue": null,
"current": {},
"datasource": "${DS_HMCI}",
"definition": "SHOW TAG VALUES FROM \"SystemProcessor\" WITH KEY = \"system\" WHERE time > now() - 24h",
"error": null,
"hide": 0,
"includeAll": true,
"label": "System",
"multi": true,
"multiFormat": "regex values",
"name": "ManagedSystem",
"options": [],
"query": "SHOW TAG VALUES FROM \"SystemProcessor\" WITH KEY = \"system\" WHERE time > now() - 24h",
"refresh": 1,
"refresh_on_load": false,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"tagValuesQuery": null,
"tags": [],
"tagsQuery": null,
"type": "query",
"useTags": false
},
{
"allFormat": "regex values",
"allValue": null,
"current": {},
"datasource": "${DS_HMCI}",
"definition": "SHOW TAG VALUES FROM \"PartitionProcessor\" WITH KEY = \"partition\" WHERE system =~ /$ManagedSystem/",
"error": null,
"hide": 0,
"includeAll": true,
"label": "Logical Partition",
"multi": true,
"multiFormat": "regex values",
"name": "Partition",
"options": [],
"query": "SHOW TAG VALUES FROM \"PartitionProcessor\" WITH KEY = \"partition\" WHERE system =~ /$ManagedSystem/",
"refresh": 1,
"refresh_on_load": false,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"tagValuesQuery": null,
"tags": [],
"tagsQuery": null,
"type": "query",
"useTags": false
}
]
},
"time": {
"from": "now-3h",
"now": false,
"to": "now"
},
"timepicker": {
"refresh_intervals": [
"10s",
"30s",
"1m",
"5m",
"15m",
"30m",
"1h",
"2h",
"1d"
],
"time_options": [
"5m",
"15m",
"1h",
"6h",
"12h",
"24h",
"2d",
"7d",
"30d"
]
},
"timezone": "browser",
"title": "IBM Power - HMC Managed Systems - Logical Partitions",
"uid": "Xl7oHESGz",
"version": 2
}

View file

@ -14,7 +14,7 @@
"type": "grafana", "type": "grafana",
"id": "grafana", "id": "grafana",
"name": "Grafana", "name": "Grafana",
"version": "7.0.6" "version": "7.3.1"
}, },
{ {
"type": "panel", "type": "panel",
@ -43,29 +43,14 @@
} }
] ]
}, },
"description": "HMC metrics from HMCi", "description": "https://bitbucket.org/mnellemann/hmci/",
"editable": true, "editable": true,
"gnetId": 1465, "gnetId": 1465,
"graphTooltip": 0, "graphTooltip": 0,
"id": null, "id": null,
"iteration": 1599142406783, "iteration": 1607681505084,
"links": [], "links": [],
"panels": [ "panels": [
{
"collapsed": false,
"datasource": "${DS_HMCI}",
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 0
},
"id": 22,
"panels": [],
"repeat": "ManagedSystem",
"title": "$ManagedSystem Throughput",
"type": "row"
},
{ {
"aliasColors": {}, "aliasColors": {},
"bars": false, "bars": false,
@ -77,7 +62,8 @@
"error": false, "error": false,
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"custom": {} "custom": {},
"links": []
}, },
"overrides": [] "overrides": []
}, },
@ -88,7 +74,7 @@
"h": 8, "h": 8,
"w": 24, "w": 24,
"x": 0, "x": 0,
"y": 1 "y": 0
}, },
"hiddenSeries": false, "hiddenSeries": false,
"id": 16, "id": 16,
@ -109,21 +95,21 @@
"mode": "", "mode": "",
"nullPointMode": "connected", "nullPointMode": "connected",
"options": { "options": {
"dataLinks": [] "alertThreshold": true
}, },
"percentage": false, "percentage": false,
"pluginVersion": "7.1.3", "pluginVersion": "7.3.1",
"pointradius": 5, "pointradius": 5,
"points": false, "points": false,
"renderer": "flot", "renderer": "flot",
"seriesOverrides": [], "seriesOverrides": [],
"spaceLength": 10, "spaceLength": 10,
"stack": false, "stack": true,
"steppedLine": false, "steppedLine": false,
"style": {}, "style": {},
"targets": [ "targets": [
{ {
"alias": "$tag_vios: $tag_id / $tag_device", "alias": "$tag_vios: $tag_id ($tag_device)",
"dsType": "influxdb", "dsType": "influxdb",
"groupBy": [ "groupBy": [
{ {
@ -202,7 +188,7 @@
"timeFrom": null, "timeFrom": null,
"timeRegions": [], "timeRegions": [],
"timeShift": null, "timeShift": null,
"title": "$ManagedSystem VIOS Physical Fiber Channel Adapters", "title": "$ManagedSystem - Fiber Channel Adapters",
"tooltip": { "tooltip": {
"msResolution": false, "msResolution": false,
"shared": true, "shared": true,
@ -249,11 +235,13 @@
"dashLength": 10, "dashLength": 10,
"dashes": false, "dashes": false,
"datasource": "${DS_HMCI}", "datasource": "${DS_HMCI}",
"description": "",
"editable": true, "editable": true,
"error": false, "error": false,
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"custom": {} "custom": {},
"links": []
}, },
"overrides": [] "overrides": []
}, },
@ -264,7 +252,178 @@
"h": 8, "h": 8,
"w": 24, "w": 24,
"x": 0, "x": 0,
"y": 9 "y": 8
},
"hiddenSeries": false,
"id": 17,
"legend": {
"alignAsTable": true,
"avg": true,
"current": false,
"max": true,
"min": true,
"rightSide": true,
"show": true,
"total": false,
"values": true
},
"lines": true,
"linewidth": 2,
"links": [],
"mode": "",
"nullPointMode": "connected",
"options": {
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "7.3.1",
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"style": {},
"targets": [
{
"alias": "$tag_vios: $tag_name",
"dsType": "influxdb",
"groupBy": [
{
"params": [
"$interval"
],
"type": "time"
},
{
"params": [
"vios"
],
"type": "tag"
},
{
"params": [
"name"
],
"type": "tag"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"hide": false,
"measurement": "SystemVirtualEthernetAdapters",
"orderByTime": "ASC",
"policy": "default",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": [
{
"key": "system",
"operator": "=~",
"value": "/^$ManagedSystem$/"
},
{
"condition": "AND",
"key": "vios",
"operator": "=~",
"value": "/^$Vios$/"
},
{
"condition": "AND",
"key": "name",
"operator": "=~",
"value": "/.*Bytes/"
}
]
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "$ManagedSystem - Virtual Ethernet Adapters",
"tooltip": {
"msResolution": false,
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"$$hashKey": "object:2622",
"format": "Bps",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"$$hashKey": "object:2623",
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": false,
"content": "",
"dashLength": 10,
"dashes": false,
"datasource": "${DS_HMCI}",
"editable": true,
"error": false,
"fieldConfig": {
"defaults": {
"custom": {},
"links": []
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"grid": {},
"gridPos": {
"h": 8,
"w": 24,
"x": 0,
"y": 16
}, },
"hiddenSeries": false, "hiddenSeries": false,
"id": 11, "id": 11,
@ -285,10 +444,10 @@
"mode": "", "mode": "",
"nullPointMode": "connected", "nullPointMode": "connected",
"options": { "options": {
"dataLinks": [] "alertThreshold": true
}, },
"percentage": false, "percentage": false,
"pluginVersion": "7.1.3", "pluginVersion": "7.3.1",
"pointradius": 5, "pointradius": 5,
"points": false, "points": false,
"renderer": "flot", "renderer": "flot",
@ -372,7 +531,7 @@
"timeFrom": null, "timeFrom": null,
"timeRegions": [], "timeRegions": [],
"timeShift": null, "timeShift": null,
"title": "$ManagedSystem Shared Adapters", "title": "$ManagedSystem - Shared Adapters",
"tooltip": { "tooltip": {
"msResolution": false, "msResolution": false,
"shared": true, "shared": true,
@ -411,183 +570,15 @@
"align": false, "align": false,
"alignLevel": null "alignLevel": null
} }
},
{
"aliasColors": {},
"bars": false,
"content": "",
"dashLength": 10,
"dashes": false,
"datasource": "${DS_HMCI}",
"editable": true,
"error": false,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 2,
"fillGradient": 0,
"grid": {},
"gridPos": {
"h": 8,
"w": 24,
"x": 0,
"y": 17
},
"hiddenSeries": false,
"id": 26,
"legend": {
"alignAsTable": true,
"avg": true,
"current": false,
"max": true,
"min": false,
"rightSide": true,
"show": true,
"total": false,
"values": true
},
"lines": true,
"linewidth": 2,
"mode": "",
"nullPointMode": "connected",
"options": {
"dataLinks": []
},
"percentage": false,
"pluginVersion": "7.1.3",
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"style": {},
"targets": [
{
"alias": "$tag_vios: $tag_device xmit",
"dsType": "influxdb",
"groupBy": [
{
"params": [
"$interval"
],
"type": "time"
},
{
"params": [
"vios"
],
"type": "tag"
},
{
"params": [
"device"
],
"type": "tag"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"hide": false,
"measurement": "SystemGenericPhysicalAdapters",
"orderByTime": "ASC",
"policy": "default",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": [
{
"key": "system",
"operator": "=~",
"value": "/^$ManagedSystem$/"
},
{
"condition": "AND",
"key": "vios",
"operator": "=~",
"value": "/^$Vios$/"
},
{
"condition": "AND",
"key": "name",
"operator": "=",
"value": "transmittedBytes"
}
]
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "$ManagedSystem VIOS Generic Physical Adapters",
"tooltip": {
"msResolution": false,
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"$$hashKey": "object:2958",
"format": "Bps",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"$$hashKey": "object:2959",
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
} }
], ],
"refresh": "30s", "refresh": "30s",
"schemaVersion": 25, "schemaVersion": 26,
"style": "dark", "style": "dark",
"tags": [ "tags": [
"Power", "Power",
"AIX" "AIX",
"VIOS"
], ],
"templating": { "templating": {
"list": [ "list": [
@ -596,15 +587,16 @@
"allValue": null, "allValue": null,
"current": {}, "current": {},
"datasource": "${DS_HMCI}", "datasource": "${DS_HMCI}",
"definition": "", "definition": "SHOW TAG VALUES FROM \"SystemProcessor\" WITH KEY = \"system\" WHERE time > now() - 24h",
"error": null,
"hide": 0, "hide": 0,
"includeAll": false, "includeAll": false,
"label": null, "label": "System",
"multi": true, "multi": true,
"multiFormat": "regex values", "multiFormat": "regex values",
"name": "ManagedSystem", "name": "ManagedSystem",
"options": [], "options": [],
"query": "SHOW TAG VALUES FROM \"SystemProcessor\" WITH KEY = \"system\"", "query": "SHOW TAG VALUES FROM \"SystemProcessor\" WITH KEY = \"system\" WHERE time > now() - 24h",
"refresh": 1, "refresh": 1,
"refresh_on_load": false, "refresh_on_load": false,
"regex": "", "regex": "",
@ -621,15 +613,16 @@
"allValue": null, "allValue": null,
"current": {}, "current": {},
"datasource": "${DS_HMCI}", "datasource": "${DS_HMCI}",
"definition": "SHOW TAG VALUES FROM \"SystemFiberChannelAdapters\" WITH KEY = \"vios\" where system =~ /$ManagedSystem/", "definition": "SHOW TAG VALUES FROM \"SystemFiberChannelAdapters\" WITH KEY = \"vios\" WHERE system =~ /$ManagedSystem/",
"error": null,
"hide": 0, "hide": 0,
"includeAll": true, "includeAll": true,
"label": "VIOS", "label": "Virtual I/O Server",
"multi": true, "multi": true,
"multiFormat": "regex values", "multiFormat": "regex values",
"name": "Vios", "name": "Vios",
"options": [], "options": [],
"query": "SHOW TAG VALUES FROM \"SystemFiberChannelAdapters\" WITH KEY = \"vios\" where system =~ /$ManagedSystem/", "query": "SHOW TAG VALUES FROM \"SystemFiberChannelAdapters\" WITH KEY = \"vios\" WHERE system =~ /$ManagedSystem/",
"refresh": 1, "refresh": 1,
"refresh_on_load": false, "refresh_on_load": false,
"regex": "", "regex": "",
@ -673,7 +666,7 @@
] ]
}, },
"timezone": "browser", "timezone": "browser",
"title": "Power Systems - HMC Virtual Input Output Servers", "title": "IBM Power - HMC Managed Systems - Virtual I/O Servers",
"uid": "DDNEv5vGz", "uid": "DDNEv5vGz",
"version": 17 "version": 2
} }

File diff suppressed because it is too large Load diff

View file

@ -1,3 +1,3 @@
id = hmci id = hmci
group = biz.nellemann.hmci group = biz.nellemann.hmci
version = 0.2.4 version = 0.2.5

View file

@ -29,15 +29,15 @@ import java.util.concurrent.Callable;
mixinStandardHelpOptions = true, mixinStandardHelpOptions = true,
description = "HMC Insights.", description = "HMC Insights.",
versionProvider = biz.nellemann.hmci.VersionProvider.class) versionProvider = biz.nellemann.hmci.VersionProvider.class)
public class Main implements Callable<Integer> { public class Application implements Callable<Integer> {
private final static Logger log = LoggerFactory.getLogger(Main.class); private final static Logger log = LoggerFactory.getLogger(Application.class);
@Option(names = { "-c", "--conf" }, description = "Configuration file [default: '/etc/hmci.toml'].", defaultValue = "/etc/hmci.toml", paramLabel = "<file>") @Option(names = { "-c", "--conf" }, description = "Configuration file [default: '/etc/hmci.toml'].", defaultValue = "/etc/hmci.toml", paramLabel = "<file>")
private String configurationFile; private String configurationFile;
public static void main(String... args) { public static void main(String... args) {
int exitCode = new CommandLine(new Main()).execute(args); int exitCode = new CommandLine(new Application()).execute(args);
System.exit(exitCode); System.exit(exitCode);
} }

View file

@ -223,7 +223,6 @@ class HmcClient {
} }
/** /**
* Parse XML feed to get PCM Data in JSON format * Parse XML feed to get PCM Data in JSON format
* @param system a valid ManagedSystem * @param system a valid ManagedSystem
@ -300,6 +299,44 @@ class HmcClient {
} }
/**
* Parse XML feed to get PCM Data in JSON format
* @param systemEnergy a valid SystemEnergy
* @return JSON string with PCM data for this SystemEnergy
*/
String getPcmDataForEnergy(SystemEnergy systemEnergy) throws Exception {
log.debug("getPcmDataForEnergy() - " + systemEnergy.system.id);
URL url = new URL(String.format("%s/rest/api/pcm/ManagedSystem/%s/ProcessedMetrics?Type=Energy&NoOfSamples=1", baseUrl, systemEnergy.system.id));
String responseBody = getResponse(url);
String jsonBody = null;
//log.info(responseBody);
// Do not try to parse empty response
if(responseBody == null || responseBody.isEmpty() || responseBody.length() <= 1) {
responseErrors++;
log.warn("getPcmDataForEnergy() - empty response");
return null;
}
try {
Document doc = Jsoup.parse(responseBody);
Element entry = doc.select("feed > entry").first();
Element link = entry.select("link[href]").first();
if(link.attr("type").equals("application/json")) {
String href = link.attr("href");
log.debug("getPcmDataForEnergy() - json url: " + href);
jsonBody = getResponse(new URL(href));
}
} catch(Exception e) {
log.warn("getPcmDataForEnergy() - xml parse error", e);
}
return jsonBody;
}
/** /**
* Return a Response from the HMC * Return a Response from the HMC

View file

@ -121,18 +121,13 @@ class InfluxClient {
} }
getSystemMemory(system, timestamp).forEach( it -> batchPoints.point(it) ); getSystemMemory(system, timestamp).forEach( it -> batchPoints.point(it) );
getSystemProcessor(system, timestamp).forEach( it -> batchPoints.point(it) ); getSystemProcessor(system, timestamp).forEach( it -> batchPoints.point(it) );
getSystemSharedProcessorPools(system, timestamp).forEach( it -> batchPoints.point(it) ); getSystemSharedProcessorPools(system, timestamp).forEach( it -> batchPoints.point(it) );
getSystemSharedAdapters(system, timestamp).forEach( it -> batchPoints.point(it) ); getSystemSharedAdapters(system, timestamp).forEach( it -> batchPoints.point(it) );
getSystemFiberChannelAdapters(system, timestamp).forEach( it -> batchPoints.point(it) ); getSystemFiberChannelAdapters(system, timestamp).forEach( it -> batchPoints.point(it) );
//getSystemGenericPhysicalAdapters(system, timestamp).forEach( it -> batchPoints.point(it) );
getSystemGenericPhysicalAdapters(system, timestamp).forEach( it -> batchPoints.point(it) ); //getSystemGenericVirtualAdapters(system, timestamp).forEach( it -> batchPoints.point(it) );
getSystemVirtualEthernetAdapters(system, timestamp).forEach( it -> batchPoints.point(it) );
getSystemGenericVirtualAdapters(system, timestamp).forEach( it -> batchPoints.point(it) );
} }
@ -162,6 +157,7 @@ class InfluxClient {
return processMeasurementMap(metrics, timestamp, "SystemFiberChannelAdapters"); return processMeasurementMap(metrics, timestamp, "SystemFiberChannelAdapters");
} }
/*
private static List<Point> getSystemGenericPhysicalAdapters(ManagedSystem system, Instant timestamp) { private static List<Point> getSystemGenericPhysicalAdapters(ManagedSystem system, Instant timestamp) {
List<Measurement> metrics = system.getSystemGenericPhysicalAdapters(); List<Measurement> metrics = system.getSystemGenericPhysicalAdapters();
return processMeasurementMap(metrics, timestamp, "SystemGenericPhysicalAdapters"); return processMeasurementMap(metrics, timestamp, "SystemGenericPhysicalAdapters");
@ -171,6 +167,12 @@ class InfluxClient {
List<Measurement> metrics = system.getSystemGenericVirtualAdapters(); List<Measurement> metrics = system.getSystemGenericVirtualAdapters();
return processMeasurementMap(metrics, timestamp, "SystemGenericVirtualAdapters"); return processMeasurementMap(metrics, timestamp, "SystemGenericVirtualAdapters");
} }
*/
private static List<Point> getSystemVirtualEthernetAdapters(ManagedSystem system, Instant timestamp) {
List<Measurement> metrics = system.getSystemVirtualEthernetAdapters();
return processMeasurementMap(metrics, timestamp, "SystemVirtualEthernetAdapters");
}
/* /*
@ -191,13 +193,9 @@ class InfluxClient {
} }
getPartitionAffinityScore(partition, timestamp).forEach( it -> batchPoints.point(it)); getPartitionAffinityScore(partition, timestamp).forEach( it -> batchPoints.point(it));
getPartitionMemory(partition, timestamp).forEach( it -> batchPoints.point(it)); getPartitionMemory(partition, timestamp).forEach( it -> batchPoints.point(it));
getPartitionProcessor(partition, timestamp).forEach( it -> batchPoints.point(it)); getPartitionProcessor(partition, timestamp).forEach( it -> batchPoints.point(it));
getPartitionVirtualEthernetAdapter(partition, timestamp).forEach( it -> batchPoints.point(it)); getPartitionVirtualEthernetAdapter(partition, timestamp).forEach( it -> batchPoints.point(it));
getPartitionVirtualFiberChannelAdapter(partition, timestamp).forEach( it -> batchPoints.point(it)); getPartitionVirtualFiberChannelAdapter(partition, timestamp).forEach( it -> batchPoints.point(it));
} }
@ -229,6 +227,39 @@ class InfluxClient {
/*
System Energy
*/
void writeSystemEnergy(SystemEnergy system) {
if(system.metrics == null) {
log.warn("writeSystemEnergy() - null metrics, skipping");
return;
}
Instant timestamp = system.getTimestamp();
if(timestamp == null) {
log.warn("writeSystemEnergy() - no timestamp, skipping");
return;
}
getSystemEnergyPower(system, timestamp).forEach(it -> batchPoints.point(it) );
getSystemEnergyTemperature(system, timestamp).forEach(it -> batchPoints.point(it) );
}
private static List<Point> getSystemEnergyPower(SystemEnergy system, Instant timestamp) {
List<Measurement> metrics = system.getPowerMetrics();
return processMeasurementMap(metrics, timestamp, "SystemEnergyPower");
}
private static List<Point> getSystemEnergyTemperature(SystemEnergy system, Instant timestamp) {
List<Measurement> metrics = system.getThermalMetrics();
return processMeasurementMap(metrics, timestamp, "SystemEnergyThermal");
}
/* /*
Shared Shared
*/ */
@ -239,7 +270,6 @@ class InfluxClient {
measurements.forEach( m -> { measurements.forEach( m -> {
// Iterate fields // Iterate fields
//Map<String, BigDecimal> fieldsMap = m.get("fields");
m.fields.forEach((fieldName, fieldValue) -> { m.fields.forEach((fieldName, fieldValue) -> {
log.debug("processMeasurementMap() " + measurement + " - fieldName: " + fieldName + ", fieldValue: " + fieldValue); log.debug("processMeasurementMap() " + measurement + " - fieldName: " + fieldName + ", fieldValue: " + fieldValue);
@ -249,7 +279,6 @@ class InfluxClient {
.addField("value", fieldValue); .addField("value", fieldValue);
// For each field, we add all tags // For each field, we add all tags
//Map<String, String> tagsMap = m.get("tags");
m.tags.forEach((tagName, tagValue) -> { m.tags.forEach((tagName, tagValue) -> {
builder.tag(tagName, tagValue); builder.tag(tagName, tagValue);
log.debug("processMeasurementMap() " + measurement + " - tagName: " + tagName + ", tagValue: " + tagValue); log.debug("processMeasurementMap() " + measurement + " - tagName: " + tagName + ", tagValue: " + tagValue);

View file

@ -151,6 +151,29 @@ class Insights {
} }
void getMetricsForEnergy() {
systems.forEach((systemId, system) -> {
HmcClient hmcClient = hmcClients.get(system.hmcId);
// Get and process metrics for this system
String tmpJsonString = null;
try {
tmpJsonString = hmcClient.getPcmDataForEnergy(system.energy);
} catch (Exception e) {
log.error("getMetricsForEnergy()", e);
}
if(tmpJsonString != null && !tmpJsonString.isEmpty()) {
system.energy.processMetrics(tmpJsonString);
}
});
}
void writeMetricsForManagedSystems() { void writeMetricsForManagedSystems() {
try { try {
systems.forEach((systemId, system) -> influxClient.writeManagedSystem(system)); systems.forEach((systemId, system) -> influxClient.writeManagedSystem(system));
@ -169,6 +192,15 @@ class Insights {
} }
void writeMetricsForSystemEnergy() {
try {
systems.forEach((systemId, system) -> influxClient.writeSystemEnergy(system.energy));
} catch (NullPointerException npe) {
log.warn("writeMetricsForSystemEnergy() - NPE: " + npe.toString());
}
}
void run() throws InterruptedException { void run() throws InterruptedException {
log.debug("run()"); log.debug("run()");
@ -185,9 +217,11 @@ class Insights {
try { try {
getMetricsForSystems(); getMetricsForSystems();
getMetricsForPartitions(); getMetricsForPartitions();
getMetricsForEnergy();
writeMetricsForManagedSystems(); writeMetricsForManagedSystems();
writeMetricsForLogicalPartitions(); writeMetricsForLogicalPartitions();
writeMetricsForSystemEnergy();
influxClient.writeBatchPoints(); influxClient.writeBatchPoints();
// Refresh HMC's // Refresh HMC's

View file

@ -59,8 +59,7 @@ class LogicalPartition extends MetaSystem {
fieldsMap.put("affinityScore", metrics.systemUtil.sample.lparsUtil.affinityScore); fieldsMap.put("affinityScore", metrics.systemUtil.sample.lparsUtil.affinityScore);
log.debug("getAffinityScore() - fields: " + fieldsMap.toString()); log.debug("getAffinityScore() - fields: " + fieldsMap.toString());
Measurement measurement = new Measurement(tagsMap, fieldsMap); list.add(new Measurement(tagsMap, fieldsMap));
list.add(measurement);
return list; return list;
} }
@ -79,13 +78,11 @@ class LogicalPartition extends MetaSystem {
fieldsMap.put("backedPhysicalMem", metrics.systemUtil.sample.lparsUtil.memory.backedPhysicalMem); fieldsMap.put("backedPhysicalMem", metrics.systemUtil.sample.lparsUtil.memory.backedPhysicalMem);
log.debug("getMemoryMetrics() - fields: " + fieldsMap.toString()); log.debug("getMemoryMetrics() - fields: " + fieldsMap.toString());
Measurement measurement = new Measurement(tagsMap, fieldsMap); list.add(new Measurement(tagsMap, fieldsMap));
list.add(measurement);
return list; return list;
} }
//@CompileDynamic
List<Measurement> getProcessorMetrics() { List<Measurement> getProcessorMetrics() {
List<Measurement> list = new ArrayList<>(); List<Measurement> list = new ArrayList<>();
@ -109,13 +106,11 @@ class LogicalPartition extends MetaSystem {
fieldsMap.put("timeSpentWaitingForDispatch", metrics.systemUtil.sample.lparsUtil.processor.timePerInstructionExecution); fieldsMap.put("timeSpentWaitingForDispatch", metrics.systemUtil.sample.lparsUtil.processor.timePerInstructionExecution);
log.debug("getProcessorMetrics() - fields: " + fieldsMap.toString()); log.debug("getProcessorMetrics() - fields: " + fieldsMap.toString());
Measurement measurement = new Measurement(tagsMap, fieldsMap); list.add(new Measurement(tagsMap, fieldsMap));
list.add(measurement);
return list; return list;
} }
//@CompileDynamic
List<Measurement> getVirtualEthernetAdapterMetrics() { List<Measurement> getVirtualEthernetAdapterMetrics() {
List<Measurement> list = new ArrayList<>(); List<Measurement> list = new ArrayList<>();
@ -137,16 +132,13 @@ class LogicalPartition extends MetaSystem {
fieldsMap.put("sentBytes", adapter.sentBytes); fieldsMap.put("sentBytes", adapter.sentBytes);
log.debug("getVirtualEthernetAdapterMetrics() - fields: " + fieldsMap.toString()); log.debug("getVirtualEthernetAdapterMetrics() - fields: " + fieldsMap.toString());
Measurement measurement = new Measurement(tagsMap, fieldsMap); list.add(new Measurement(tagsMap, fieldsMap));
list.add(measurement);
}); });
return list; return list;
} }
//PartitionVirtualFiberChannelAdapters
//@CompileDynamic
List<Measurement> getVirtualFiberChannelAdaptersMetrics() { List<Measurement> getVirtualFiberChannelAdaptersMetrics() {
List<Measurement> list = new ArrayList<>(); List<Measurement> list = new ArrayList<>();
@ -165,8 +157,7 @@ class LogicalPartition extends MetaSystem {
fieldsMap.put("readBytes", adapter.readBytes.get(0)); fieldsMap.put("readBytes", adapter.readBytes.get(0));
log.debug("getVirtualFiberChannelAdaptersMetrics() - fields: " + fieldsMap.toString()); log.debug("getVirtualFiberChannelAdaptersMetrics() - fields: " + fieldsMap.toString());
Measurement measurement = new Measurement(tagsMap, fieldsMap); list.add(new Measurement(tagsMap, fieldsMap));
list.add(measurement);
}); });
return list; return list;

View file

@ -34,6 +34,8 @@ class ManagedSystem extends MetaSystem {
public final String model; public final String model;
public final String serialNumber; public final String serialNumber;
public final SystemEnergy energy;
ManagedSystem(String hmcId, String id, String name, String type, String model, String serialNumber) { ManagedSystem(String hmcId, String id, String name, String type, String model, String serialNumber) {
this.hmcId = hmcId; this.hmcId = hmcId;
@ -42,6 +44,7 @@ class ManagedSystem extends MetaSystem {
this.type = type; this.type = type;
this.model = model; this.model = model;
this.serialNumber = serialNumber; this.serialNumber = serialNumber;
this.energy = new SystemEnergy(this);
} }
public String toString() { public String toString() {
@ -52,12 +55,9 @@ class ManagedSystem extends MetaSystem {
List<Measurement> getMemoryMetrics() { List<Measurement> getMemoryMetrics() {
List<Measurement> list = new ArrayList<>(); List<Measurement> list = new ArrayList<>();
//Map<String, Map> map = new HashMap<String, Map>()
HashMap<String, String> tagsMap = new HashMap<String, String>(); HashMap<String, String> tagsMap = new HashMap<String, String>();
tagsMap.put("system", name); tagsMap.put("system", name);
//map.put("tags", tagsMap)
log.debug("getMemoryMetrics() - tags: " + tagsMap.toString()); log.debug("getMemoryMetrics() - tags: " + tagsMap.toString());
Map<String, Number> fieldsMap = new HashMap<String, Number>(); Map<String, Number> fieldsMap = new HashMap<String, Number>();
@ -65,12 +65,9 @@ class ManagedSystem extends MetaSystem {
fieldsMap.put("availableMem", metrics.systemUtil.sample.serverUtil.memory.availableMem); fieldsMap.put("availableMem", metrics.systemUtil.sample.serverUtil.memory.availableMem);
fieldsMap.put("configurableMem", metrics.systemUtil.sample.serverUtil.memory.configurableMem); fieldsMap.put("configurableMem", metrics.systemUtil.sample.serverUtil.memory.configurableMem);
fieldsMap.put("assignedMemToLpars", metrics.systemUtil.sample.serverUtil.memory.assignedMemToLpars); fieldsMap.put("assignedMemToLpars", metrics.systemUtil.sample.serverUtil.memory.assignedMemToLpars);
//map.put("fields", fieldsMap)
log.debug("getMemoryMetrics() - fields: " + fieldsMap.toString()); log.debug("getMemoryMetrics() - fields: " + fieldsMap.toString());
Measurement measurement = new Measurement(tagsMap, fieldsMap); list.add(new Measurement(tagsMap, fieldsMap));
list.add(measurement);
return list; return list;
} }
@ -79,13 +76,9 @@ class ManagedSystem extends MetaSystem {
List<Measurement> getProcessorMetrics() { List<Measurement> getProcessorMetrics() {
List<Measurement> list = new ArrayList<>(); List<Measurement> list = new ArrayList<>();
//Map<String, Map> map = new HashMap<>()
HashMap<String, String> tagsMap = new HashMap<String, String>(); HashMap<String, String> tagsMap = new HashMap<String, String>();
tagsMap.put("system", name); tagsMap.put("system", name);
//map.put("tags", tagsMap)
//measurement.tags = tagsMap;
log.debug("getProcessorMetrics() - tags: " + tagsMap.toString()); log.debug("getProcessorMetrics() - tags: " + tagsMap.toString());
HashMap<String, Number> fieldsMap = new HashMap<String, Number>(); HashMap<String, Number> fieldsMap = new HashMap<String, Number>();
@ -93,14 +86,9 @@ class ManagedSystem extends MetaSystem {
fieldsMap.put("utilizedProcUnits", metrics.systemUtil.sample.serverUtil.processor.utilizedProcUnits); fieldsMap.put("utilizedProcUnits", metrics.systemUtil.sample.serverUtil.processor.utilizedProcUnits);
fieldsMap.put("availableProcUnits", metrics.systemUtil.sample.serverUtil.processor.availableProcUnits); fieldsMap.put("availableProcUnits", metrics.systemUtil.sample.serverUtil.processor.availableProcUnits);
fieldsMap.put("configurableProcUnits", metrics.systemUtil.sample.serverUtil.processor.configurableProcUnits); fieldsMap.put("configurableProcUnits", metrics.systemUtil.sample.serverUtil.processor.configurableProcUnits);
//map.put("fields", fieldsMap)
//measurement.fields = fieldsMap;
log.debug("getProcessorMetrics() - fields: " + fieldsMap.toString()); log.debug("getProcessorMetrics() - fields: " + fieldsMap.toString());
Measurement measurement = new Measurement(tagsMap, fieldsMap); list.add(new Measurement(tagsMap, fieldsMap));
list.add(measurement);
return list; return list;
} }
@ -109,58 +97,45 @@ class ManagedSystem extends MetaSystem {
List<Measurement> list = new ArrayList<>(); List<Measurement> list = new ArrayList<>();
metrics.systemUtil.sample.serverUtil.sharedProcessorPool.forEach(adapter -> { metrics.systemUtil.sample.serverUtil.sharedProcessorPool.forEach(adapter -> {
//Map<String, Map> map = new HashMap<String, Map>()
HashMap<String, String> tagsMap = new HashMap<String, String>(); HashMap<String, String> tagsMap = new HashMap<String, String>();
tagsMap.put("system", name); tagsMap.put("system", name);
tagsMap.put("pool", adapter.name); tagsMap.put("pool", adapter.name);
//map.put("tags", tagsMap)
log.debug("getSharedProcessorPools() - tags: " + tagsMap.toString()); log.debug("getSharedProcessorPools() - tags: " + tagsMap.toString());
HashMap<String, Number> fieldsMap = new HashMap<String, Number>(); HashMap<String, Number> fieldsMap = new HashMap<String, Number>();
fieldsMap.put("assignedProcUnits", adapter.assignedProcUnits); fieldsMap.put("assignedProcUnits", adapter.assignedProcUnits);
fieldsMap.put("availableProcUnits", adapter.availableProcUnits); fieldsMap.put("availableProcUnits", adapter.availableProcUnits);
//map.put("fields", fieldsMap)
log.debug("getSharedProcessorPools() - fields: " + fieldsMap.toString()); log.debug("getSharedProcessorPools() - fields: " + fieldsMap.toString());
Measurement measurement = new Measurement(tagsMap, fieldsMap); list.add(new Measurement(tagsMap, fieldsMap));
list.add(measurement);
}); });
return list; return list;
} }
// VIOs
List<Measurement> getSystemSharedAdapters() { List<Measurement> getSystemSharedAdapters() {
List<Measurement> list = new ArrayList<>(); List<Measurement> list = new ArrayList<>();
metrics.systemUtil.sample.viosUtil.forEach(vios -> { metrics.systemUtil.sample.viosUtil.forEach(vios -> {
vios.network.sharedAdapters.forEach(adapter -> { vios.network.sharedAdapters.forEach(adapter -> {
//Map<String, Map> map = new HashMap<String, Map>()
Measurement measurement = new Measurement();
HashMap<String, String> tagsMap = new HashMap<String, String>(); HashMap<String, String> tagsMap = new HashMap<String, String>();
tagsMap.put("system", name); tagsMap.put("system", name);
tagsMap.put("type", adapter.type); tagsMap.put("type", adapter.type);
tagsMap.put("vios", vios.name); tagsMap.put("vios", vios.name);
tagsMap.put("device", adapter.physicalLocation);
//map.put("tags", tagsMap)
measurement.tags = tagsMap;
log.debug("getSystemSharedAdapters() - tags: " + tagsMap.toString()); log.debug("getSystemSharedAdapters() - tags: " + tagsMap.toString());
HashMap<String, Number> fieldsMap = new HashMap<String, Number>(); HashMap<String, Number> fieldsMap = new HashMap<String, Number>();
fieldsMap.put("sentBytes", adapter.sentBytes); fieldsMap.put("sentBytes", adapter.sentBytes);
fieldsMap.put("receivedBytes", adapter.receivedBytes); fieldsMap.put("receivedBytes", adapter.receivedBytes);
fieldsMap.put("transferredBytes", adapter.transferredBytes); fieldsMap.put("transferredBytes", adapter.transferredBytes);
//map.put("fields", fieldsMap)
measurement.fields = fieldsMap;
log.debug("getSystemSharedAdapters() - fields: " + fieldsMap.toString()); log.debug("getSystemSharedAdapters() - fields: " + fieldsMap.toString());
list.add(measurement); list.add(new Measurement(tagsMap, fieldsMap));
}); });
}); });
@ -168,7 +143,7 @@ class ManagedSystem extends MetaSystem {
return list; return list;
} }
// VIOs
List<Measurement> getSystemFiberChannelAdapters() { List<Measurement> getSystemFiberChannelAdapters() {
List<Measurement> list = new ArrayList<>(); List<Measurement> list = new ArrayList<>();
@ -176,8 +151,6 @@ class ManagedSystem extends MetaSystem {
log.debug("getSystemFiberChannelAdapters() - VIOS: " + vios.name); log.debug("getSystemFiberChannelAdapters() - VIOS: " + vios.name);
vios.storage.fiberChannelAdapters.forEach( adapter -> { vios.storage.fiberChannelAdapters.forEach( adapter -> {
//HashMap<String, Map> map = new HashMap<>()
Measurement measurement = new Measurement();
HashMap<String, String> tagsMap = new HashMap<String, String>(); HashMap<String, String> tagsMap = new HashMap<String, String>();
tagsMap.put("id", adapter.id); tagsMap.put("id", adapter.id);
@ -185,21 +158,15 @@ class ManagedSystem extends MetaSystem {
tagsMap.put("wwpn", adapter.wwpn); tagsMap.put("wwpn", adapter.wwpn);
tagsMap.put("vios", vios.name); tagsMap.put("vios", vios.name);
tagsMap.put("device", adapter.physicalLocation); tagsMap.put("device", adapter.physicalLocation);
//map.put("tags", tagsMap)
measurement.tags = tagsMap;
log.debug("getSystemFiberChannelAdapters() - tags: " + tagsMap.toString()); log.debug("getSystemFiberChannelAdapters() - tags: " + tagsMap.toString());
HashMap<String, Number> fieldsMap = new HashMap<String, Number>(); HashMap<String, Number> fieldsMap = new HashMap<String, Number>();
fieldsMap.put("writeBytes", adapter.writeBytes); fieldsMap.put("writeBytes", adapter.writeBytes);
fieldsMap.put("readBytes", adapter.readBytes); fieldsMap.put("readBytes", adapter.readBytes);
fieldsMap.put("transmittedBytes", adapter.transmittedBytes); fieldsMap.put("transmittedBytes", adapter.transmittedBytes);
//map.put("fields", fieldsMap)
measurement.fields = fieldsMap;
log.debug("getSystemFiberChannelAdapters() - fields: " + fieldsMap.toString()); log.debug("getSystemFiberChannelAdapters() - fields: " + fieldsMap.toString());
list.add(measurement); list.add(new Measurement(tagsMap, fieldsMap));
}); });
}); });
@ -208,6 +175,8 @@ class ManagedSystem extends MetaSystem {
} }
// VIOs
/*
List<Measurement> getSystemGenericPhysicalAdapters() { List<Measurement> getSystemGenericPhysicalAdapters() {
List<Measurement> list = new ArrayList<>(); List<Measurement> list = new ArrayList<>();
@ -216,34 +185,31 @@ class ManagedSystem extends MetaSystem {
vios.storage.genericPhysicalAdapters.forEach( adapter -> { vios.storage.genericPhysicalAdapters.forEach( adapter -> {
Measurement measurement = new Measurement();
HashMap<String, String> tagsMap = new HashMap<String, String>(); HashMap<String, String> tagsMap = new HashMap<String, String>();
tagsMap.put("id", adapter.id); tagsMap.put("id", adapter.id);
tagsMap.put("system", name); tagsMap.put("system", name);
tagsMap.put("vios", vios.name); tagsMap.put("vios", vios.name);
tagsMap.put("device", adapter.physicalLocation); tagsMap.put("device", adapter.physicalLocation);
measurement.tags = tagsMap;
log.debug("getSystemGenericPhysicalAdapters() - tags: " + tagsMap.toString()); log.debug("getSystemGenericPhysicalAdapters() - tags: " + tagsMap.toString());
HashMap<String, Number> fieldsMap = new HashMap<String, Number>(); HashMap<String, Number> fieldsMap = new HashMap<String, Number>();
fieldsMap.put("writeBytes", adapter.writeBytes); fieldsMap.put("writeBytes", adapter.writeBytes);
fieldsMap.put("readBytes", adapter.readBytes); fieldsMap.put("readBytes", adapter.readBytes);
fieldsMap.put("transmittedBytes", adapter.transmittedBytes); fieldsMap.put("transmittedBytes", adapter.transmittedBytes);
measurement.fields = fieldsMap;
log.debug("getSystemGenericPhysicalAdapters() - fields: " + fieldsMap.toString()); log.debug("getSystemGenericPhysicalAdapters() - fields: " + fieldsMap.toString());
list.add(measurement); list.add(new Measurement(tagsMap, fieldsMap));
}); });
}); });
return list; return list;
} }
*/
// VIOs
/*
List<Measurement> getSystemGenericVirtualAdapters() { List<Measurement> getSystemGenericVirtualAdapters() {
List<Measurement> list = new ArrayList<>(); List<Measurement> list = new ArrayList<>();
@ -252,26 +218,49 @@ class ManagedSystem extends MetaSystem {
vios.storage.genericVirtualAdapters.forEach( adapter -> { vios.storage.genericVirtualAdapters.forEach( adapter -> {
Measurement measurement = new Measurement();
HashMap<String, String> tagsMap = new HashMap<String, String>(); HashMap<String, String> tagsMap = new HashMap<String, String>();
tagsMap.put("id", adapter.id); tagsMap.put("id", adapter.id);
tagsMap.put("system", name); tagsMap.put("system", name);
tagsMap.put("vios", vios.name); tagsMap.put("vios", vios.name);
tagsMap.put("device", adapter.physicalLocation); tagsMap.put("device", adapter.physicalLocation);
measurement.tags = tagsMap;
log.debug("getSystemGenericVirtualAdapters() - tags: " + tagsMap.toString()); log.debug("getSystemGenericVirtualAdapters() - tags: " + tagsMap.toString());
HashMap<String, Number> fieldsMap = new HashMap<String, Number>(); HashMap<String, Number> fieldsMap = new HashMap<String, Number>();
fieldsMap.put("writeBytes", adapter.writeBytes); fieldsMap.put("writeBytes", adapter.writeBytes);
fieldsMap.put("readBytes", adapter.readBytes); fieldsMap.put("readBytes", adapter.readBytes);
fieldsMap.put("transmittedBytes", adapter.transmittedBytes); fieldsMap.put("transmittedBytes", adapter.transmittedBytes);
measurement.fields = fieldsMap;
log.debug("getSystemGenericVirtualAdapters() - fields: " + fieldsMap.toString()); log.debug("getSystemGenericVirtualAdapters() - fields: " + fieldsMap.toString());
list.add(measurement); list.add(new Measurement(tagsMap, fieldsMap));
});
});
return list;
}
*/
// VIOs
List<Measurement> getSystemVirtualEthernetAdapters() {
List<Measurement> list = new ArrayList<>();
metrics.systemUtil.sample.viosUtil.forEach( vios -> {
vios.network.virtualEthernetAdapters.forEach( adapter -> {
HashMap<String, String> tagsMap = new HashMap<String, String>();
tagsMap.put("system", name);
tagsMap.put("vios", vios.name);
tagsMap.put("device", adapter.physicalLocation);
log.debug("getSystemGenericVirtualAdapters() - tags: " + tagsMap.toString());
HashMap<String, Number> fieldsMap = new HashMap<String, Number>();
fieldsMap.put("sentBytes", adapter.sentBytes);
fieldsMap.put("receivedBytes", adapter.receivedBytes);
log.debug("getSystemGenericVirtualAdapters() - fields: " + fieldsMap.toString());
list.add(new Measurement(tagsMap, fieldsMap));
}); });
}); });

View file

@ -4,14 +4,12 @@ import java.util.Map;
public class Measurement { public class Measurement {
Map<String, String> tags; final Map<String, String> tags;
Map<String, Number> fields; final Map<String, Number> fields;
Measurement() {
}
Measurement(Map<String, String> tags, Map<String, Number> fields) { Measurement(Map<String, String> tags, Map<String, Number> fields) {
this.tags = tags; this.tags = tags;
this.fields = fields; this.fields = fields;
} }
} }

View file

@ -47,20 +47,19 @@ abstract class MetaSystem {
} }
} }
//@CompileDynamic
void processMetrics(String json) { void processMetrics(String json) {
try { try {
metrics = jsonAdapter.fromJson(json); metrics = jsonAdapter.nullSafe().fromJson(json);
} catch(Exception e) { } catch(Exception e) {
log.warn("processMetrics() error", e); log.warn("processMetrics() error", e);
} }
//System.out.println(jsonAdapter.toJson(metrics));
//Map pcmMap = new JsonSlurper().parseText(json) as Map
//metrics = new PcmData(pcmMap)
} }
//@CompileDynamic
Instant getTimestamp() { Instant getTimestamp() {
String timestamp = metrics.systemUtil.sample.sampleInfo.timeStamp; String timestamp = metrics.systemUtil.sample.sampleInfo.timeStamp;
@ -91,6 +90,7 @@ abstract class MetaSystem {
} }
} }
static class NumberAdapter { static class NumberAdapter {
@FromJson @FromJson

View file

@ -0,0 +1,88 @@
/*
* Copyright 2020 Mark Nellemann <mark.nellemann@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package biz.nellemann.hmci;
import biz.nellemann.hmci.pcm.Temperature;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
class SystemEnergy extends MetaSystem {
private final static Logger log = LoggerFactory.getLogger(SystemEnergy.class);
public final ManagedSystem system;
SystemEnergy(ManagedSystem system) {
this.system = system;
}
public String toString() {
return system.name;
}
List<Measurement> getPowerMetrics() {
List<Measurement> list = new ArrayList<>();
HashMap<String, String> tagsMap = new HashMap<String, String>();
tagsMap.put("system", system.name);
log.debug("getPowerMetrics() - tags: " + tagsMap.toString());
Map<String, Number> fieldsMap = new HashMap<String, Number>();
fieldsMap.put("powerReading", metrics.systemUtil.sample.energyUtil.powerUtil.powerReading);
log.debug("getPowerMetrics() - fields: " + fieldsMap.toString());
list.add(new Measurement(tagsMap, fieldsMap));
return list;
}
List<Measurement> getThermalMetrics() {
List<Measurement> list = new ArrayList<>();
HashMap<String, String> tagsMap = new HashMap<String, String>();
tagsMap.put("system", system.name);
log.debug("getThermalMetrics() - tags: " + tagsMap.toString());
Map<String, Number> fieldsMap = new HashMap<String, Number>();
for(Temperature t : metrics.systemUtil.sample.energyUtil.thermalUtil.cpuTemperatures) {
fieldsMap.put("cpuTemperature_" + t.entityInstance, t.temperatureReading);
}
for(Temperature t : metrics.systemUtil.sample.energyUtil.thermalUtil.inletTemperatures) {
fieldsMap.put("inletTemperature_" + t.entityInstance, t.temperatureReading);
}
/* Disabled, not sure if useful
for(Temperature t : metrics.systemUtil.sample.energyUtil.thermalUtil.baseboardTemperatures) {
fieldsMap.put("baseboardTemperature_" + t.entityInstance, t.temperatureReading);
}*/
log.debug("getThermalMetrics() - fields: " + fieldsMap.toString());
list.add(new Measurement(tagsMap, fieldsMap));
return list;
}
}

View file

@ -0,0 +1,6 @@
package biz.nellemann.hmci.pcm;
public class EnergyUtil {
public PowerUtil powerUtil = new PowerUtil();
public ThermalUtil thermalUtil = new ThermalUtil();
}

View file

@ -0,0 +1,10 @@
package biz.nellemann.hmci.pcm;
import com.serjltt.moshi.adapters.FirstElement;
public class PowerUtil {
@FirstElement
public Float powerReading = 0.0f;
}

View file

@ -0,0 +1,13 @@
package biz.nellemann.hmci.pcm;
import com.serjltt.moshi.adapters.FirstElement;
public class Temperature {
public String entityId;
public String entityInstance;
@FirstElement
public Float temperatureReading;
}

View file

@ -0,0 +1,12 @@
package biz.nellemann.hmci.pcm;
import java.util.ArrayList;
import java.util.List;
public class ThermalUtil {
public List<Temperature> inletTemperatures = new ArrayList<>();
public List<Temperature> cpuTemperatures = new ArrayList<>();
public List<Temperature> baseboardTemperatures = new ArrayList<>();
}

View file

@ -10,6 +10,7 @@ public class UtilSample {
public String sampleType; public String sampleType;
public SampleInfo sampleInfo; public SampleInfo sampleInfo;
public ServerUtil serverUtil; public ServerUtil serverUtil;
public EnergyUtil energyUtil = new EnergyUtil();
public List<ViosUtil> viosUtil = new ArrayList<>(); public List<ViosUtil> viosUtil = new ArrayList<>();
@FirstElement @FirstElement

View file

@ -2,7 +2,7 @@ package biz.nellemann.hmci
import spock.lang.Specification import spock.lang.Specification
class ManagedSystemTest extends Specification { class ManagedSystemTest extends Specification {
void "test processPcmJson for ManagedSystem"() { void "test processPcmJson for ManagedSystem"() {
@ -24,6 +24,7 @@ class ManagedSystemTest extends Specification {
} }
void "test getMemoryMetrics"() { void "test getMemoryMetrics"() {
setup: setup:

View file

@ -0,0 +1,26 @@
package biz.nellemann.hmci
import spock.lang.Specification
class SystemEnergyTest extends Specification {
void "test processPcmJson for ManagedSystem Energy"() {
setup:
def testFile = new File(getClass().getResource('/pcm-data-energy.json').toURI())
def testJson = testFile.getText('UTF-8')
when:
ManagedSystem system = new ManagedSystem("site1", "e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N")
system.energy.processMetrics(testJson)
then:
system.energy.metrics.systemUtil.sample.energyUtil.powerUtil.powerReading == 542.0
system.energy.metrics.systemUtil.sample.energyUtil.thermalUtil.cpuTemperatures.first().entityId == "CPU temperature sensors(41h)"
system.energy.metrics.systemUtil.sample.energyUtil.thermalUtil.cpuTemperatures.first().temperatureReading == 54.0
system.energy.metrics.systemUtil.sample.energyUtil.thermalUtil.inletTemperatures.first().temperatureReading == 26.0
system.energy.metrics.systemUtil.sample.energyUtil.thermalUtil.baseboardTemperatures.first().entityId == "Baseboard temperature sensors(42h)"
system.energy.metrics.systemUtil.sample.energyUtil.thermalUtil.baseboardTemperatures.first().temperatureReading == 45.0
}
}

View file

@ -0,0 +1,19 @@
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:ns2="http://a9.com/-/spec/opensearch/1.1/" xmlns:ns3="http://www.w3.org/1999/xhtml">
<id>b597e4da-2aab-3f52-8616-341d62153559</id>
<updated>2020-12-09T12:30:00.000+01:00</updated>
<title type="text">ProcessedMetrics</title>
<subtitle type="text">ManagedSystem b597e4da-2aab-3f52-8616-341d62153559</subtitle>
<link rel="self" href="https://10.32.64.39:12443/rest/api/pcm/ManagedSystem/b597e4da-2aab-3f52-8616-341d62153559/ProcessedMetrics?Type=Energy&amp;NoOfSamples=1"/>
<generator uri="IBM Power Systems Management Console" version="1"/>
<entry>
<id>72849beb-ba68-414d-9e36-85d615bcc7f4</id>
<updated>2020-12-09T12:30:00.000+01:00</updated>
<title type="text">EnergyMetrics_ManagedSystem_b597e4da-2aab-3f52-8616-341d62153559_20201209T123000+0100_20201209T123000+0100_30.json</title>
<published>2020-12-09T12:30:00.000+01:00</published>
<link type="application/json" href="https://10.32.64.39:12443/rest/api/pcm/ProcessedMetrics/EnergyMetrics_ManagedSystem_b597e4da-2aab-3f52-8616-341d62153559_20201209T123000+0100_20201209T123000+0100_30.json"/>
<author>
<name>IBM Power Systems Management Console</name>
</author>
<category term="ManagedSystem" frequency="30"/>
</entry>
</feed>

View file

@ -1,151 +0,0 @@
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:ns2="http://a9.com/-/spec/opensearch/1.1/" xmlns:ns3="http://www.w3.org/1999/xhtml">
<id>b597e4da-2aab-3f52-8616-341d62153559</id>
<updated>2020-08-06T18:40:00.000+02:00</updated>
<title type="text">ProcessedMetrics</title>
<subtitle type="text">ManagedSystem b597e4da-2aab-3f52-8616-341d62153559</subtitle>
<link rel="self" href="https://10.32.64.39:12443/rest/api/pcm/ManagedSystem/b597e4da-2aab-3f52-8616-341d62153559/ProcessedMetrics?NoOfSamples=5"/>
<generator uri="IBM Power Systems Management Console" version="1"/>
<entry>
<id>9b10b25b-2242-48f7-b46a-e25c300ae3f8</id>
<updated>2020-08-06T18:40:00.000+02:00</updated>
<title type="text">ManagedSystem_b597e4da-2aab-3f52-8616-341d62153559_20200806T183800+0200_20200806T184000+0200_30.json</title>
<published>2020-08-06T18:38:00.000+02:00</published>
<link type="application/json" href="https://10.32.64.39:12443/rest/api/pcm/ProcessedMetrics/ManagedSystem_b597e4da-2aab-3f52-8616-341d62153559_20200806T183800+0200_20200806T184000+0200_30.json"/>
<author>
<name>IBM Power Systems Management Console</name>
</author>
<category term="ManagedSystem" frequency="30"/>
</entry>
<entry>
<id>7c2828f5-d643-4274-b60e-d6b6ba8269da</id>
<updated>2020-08-06T18:40:34.417+02:00</updated>
<title type="text">LogicalPartition_44A89632-E9E6-4E12-91AF-1A33DEE060CF</title>
<published>2020-08-06T18:40:34.417+02:00</published>
<link type="application/atom+xml" href="https://10.32.64.39:12443/rest/api/pcm/ManagedSystem/b597e4da-2aab-3f52-8616-341d62153559/LogicalPartition/44A89632-E9E6-4E12-91AF-1A33DEE060CF/ProcessedMetrics?NoOfSamples=5"/>
<author>
<name>IBM Power Systems Management Console</name>
</author>
<category term="LogicalPartition"/>
</entry>
<entry>
<id>595fba0e-d15d-47f3-8403-302197a555ff</id>
<updated>2020-08-06T18:40:34.417+02:00</updated>
<title type="text">LogicalPartition_6B7D14D3-BBD2-475B-8284-70FADBFC37FB</title>
<published>2020-08-06T18:40:34.417+02:00</published>
<link type="application/atom+xml" href="https://10.32.64.39:12443/rest/api/pcm/ManagedSystem/b597e4da-2aab-3f52-8616-341d62153559/LogicalPartition/6B7D14D3-BBD2-475B-8284-70FADBFC37FB/ProcessedMetrics?NoOfSamples=5"/>
<author>
<name>IBM Power Systems Management Console</name>
</author>
<category term="LogicalPartition"/>
</entry>
<entry>
<id>64affb83-513d-4bbe-bc4d-fc82a2c4a802</id>
<updated>2020-08-06T18:40:34.417+02:00</updated>
<title type="text">LogicalPartition_2A379B8A-C6E0-415E-9601-9832251F616F</title>
<published>2020-08-06T18:40:34.417+02:00</published>
<link type="application/atom+xml" href="https://10.32.64.39:12443/rest/api/pcm/ManagedSystem/b597e4da-2aab-3f52-8616-341d62153559/LogicalPartition/2A379B8A-C6E0-415E-9601-9832251F616F/ProcessedMetrics?NoOfSamples=5"/>
<author>
<name>IBM Power Systems Management Console</name>
</author>
<category term="LogicalPartition"/>
</entry>
<entry>
<id>2cbdde76-5a0d-497d-842d-3eff5f21b260</id>
<updated>2020-08-06T18:40:34.417+02:00</updated>
<title type="text">LogicalPartition_1700D42D-C9FA-4131-B024-588FDDC70649</title>
<published>2020-08-06T18:40:34.417+02:00</published>
<link type="application/atom+xml" href="https://10.32.64.39:12443/rest/api/pcm/ManagedSystem/b597e4da-2aab-3f52-8616-341d62153559/LogicalPartition/1700D42D-C9FA-4131-B024-588FDDC70649/ProcessedMetrics?NoOfSamples=5"/>
<author>
<name>IBM Power Systems Management Console</name>
</author>
<category term="LogicalPartition"/>
</entry>
<entry>
<id>4227b8b3-3ac9-4f4b-a915-89b5b8263a84</id>
<updated>2020-08-06T18:40:34.417+02:00</updated>
<title type="text">LogicalPartition_42108956-78CB-4040-A291-DF872B49268F</title>
<published>2020-08-06T18:40:34.417+02:00</published>
<link type="application/atom+xml" href="https://10.32.64.39:12443/rest/api/pcm/ManagedSystem/b597e4da-2aab-3f52-8616-341d62153559/LogicalPartition/42108956-78CB-4040-A291-DF872B49268F/ProcessedMetrics?NoOfSamples=5"/>
<author>
<name>IBM Power Systems Management Console</name>
</author>
<category term="LogicalPartition"/>
</entry>
<entry>
<id>e590c92d-076c-4598-bc21-208758b30d24</id>
<updated>2020-08-06T18:40:34.417+02:00</updated>
<title type="text">LogicalPartition_243A3A4C-85BF-4384-80E9-00954962B8CB</title>
<published>2020-08-06T18:40:34.417+02:00</published>
<link type="application/atom+xml" href="https://10.32.64.39:12443/rest/api/pcm/ManagedSystem/b597e4da-2aab-3f52-8616-341d62153559/LogicalPartition/243A3A4C-85BF-4384-80E9-00954962B8CB/ProcessedMetrics?NoOfSamples=5"/>
<author>
<name>IBM Power Systems Management Console</name>
</author>
<category term="LogicalPartition"/>
</entry>
<entry>
<id>7170c4d9-1437-4571-ba86-7136165f0d82</id>
<updated>2020-08-06T18:40:34.417+02:00</updated>
<title type="text">LogicalPartition_72A9CD86-312A-4A61-B9A3-2D5A11B373E5</title>
<published>2020-08-06T18:40:34.417+02:00</published>
<link type="application/atom+xml" href="https://10.32.64.39:12443/rest/api/pcm/ManagedSystem/b597e4da-2aab-3f52-8616-341d62153559/LogicalPartition/72A9CD86-312A-4A61-B9A3-2D5A11B373E5/ProcessedMetrics?NoOfSamples=5"/>
<author>
<name>IBM Power Systems Management Console</name>
</author>
<category term="LogicalPartition"/>
</entry>
<entry>
<id>012e2505-b6e8-491f-bd1c-7638a5a5b72b</id>
<updated>2020-08-06T18:40:34.417+02:00</updated>
<title type="text">LogicalPartition_58215ABF-1C91-4932-96EA-88041D560EED</title>
<published>2020-08-06T18:40:34.417+02:00</published>
<link type="application/atom+xml" href="https://10.32.64.39:12443/rest/api/pcm/ManagedSystem/b597e4da-2aab-3f52-8616-341d62153559/LogicalPartition/58215ABF-1C91-4932-96EA-88041D560EED/ProcessedMetrics?NoOfSamples=5"/>
<author>
<name>IBM Power Systems Management Console</name>
</author>
<category term="LogicalPartition"/>
</entry>
<entry>
<id>f50167b3-4b05-47f8-b833-356ce10c48c5</id>
<updated>2020-08-06T18:40:34.417+02:00</updated>
<title type="text">LogicalPartition_6D775DB5-010B-4B7C-B585-BB7C9128D259</title>
<published>2020-08-06T18:40:34.417+02:00</published>
<link type="application/atom+xml" href="https://10.32.64.39:12443/rest/api/pcm/ManagedSystem/b597e4da-2aab-3f52-8616-341d62153559/LogicalPartition/6D775DB5-010B-4B7C-B585-BB7C9128D259/ProcessedMetrics?NoOfSamples=5"/>
<author>
<name>IBM Power Systems Management Console</name>
</author>
<category term="LogicalPartition"/>
</entry>
<entry>
<id>1d1117ee-2d1c-4a6e-b0c2-b599c75fe869</id>
<updated>2020-08-06T18:40:34.417+02:00</updated>
<title type="text">LogicalPartition_75E900B0-06E2-4C67-A158-0198B4264304</title>
<published>2020-08-06T18:40:34.417+02:00</published>
<link type="application/atom+xml" href="https://10.32.64.39:12443/rest/api/pcm/ManagedSystem/b597e4da-2aab-3f52-8616-341d62153559/LogicalPartition/75E900B0-06E2-4C67-A158-0198B4264304/ProcessedMetrics?NoOfSamples=5"/>
<author>
<name>IBM Power Systems Management Console</name>
</author>
<category term="LogicalPartition"/>
</entry>
<entry>
<id>037ea153-8368-46ff-9633-e152a7847099</id>
<updated>2020-08-06T18:40:34.417+02:00</updated>
<title type="text">LogicalPartition_3380A831-9D22-4F03-A1DF-18B249F0FF8E</title>
<published>2020-08-06T18:40:34.417+02:00</published>
<link type="application/atom+xml" href="https://10.32.64.39:12443/rest/api/pcm/ManagedSystem/b597e4da-2aab-3f52-8616-341d62153559/LogicalPartition/3380A831-9D22-4F03-A1DF-18B249F0FF8E/ProcessedMetrics?NoOfSamples=5"/>
<author>
<name>IBM Power Systems Management Console</name>
</author>
<category term="LogicalPartition"/>
</entry>
<entry>
<id>3219619b-9803-4807-a6e4-25eca82fa84c</id>
<updated>2020-08-06T18:40:34.417+02:00</updated>
<title type="text">LogicalPartition_2DE05DB6-8AD5-448F-8327-0F488D287E82</title>
<published>2020-08-06T18:40:34.417+02:00</published>
<link type="application/atom+xml" href="https://10.32.64.39:12443/rest/api/pcm/ManagedSystem/b597e4da-2aab-3f52-8616-341d62153559/LogicalPartition/2DE05DB6-8AD5-448F-8327-0F488D287E82/ProcessedMetrics?NoOfSamples=5"/>
<author>
<name>IBM Power Systems Management Console</name>
</author>
<category term="LogicalPartition"/>
</entry>
</feed>

View file

@ -0,0 +1,104 @@
{
"systemUtil": {
"utilInfo": {
"version": "1.3.0",
"metricType": "Processed",
"frequency": 30,
"startTimeStamp": "2020-12-09T12:37:00+0100",
"endTimeStamp": "2020-12-09T12:37:00+0100",
"mtms": "9009-42A*21F64EV",
"name": "Server-9009-42A-SN21F64EV",
"uuid": "b597e4da-2aab-3f52-8616-341d62153559",
"metricArrayOrder": [
"AVG"
]
},
"utilSamples": [
{
"sampleType": "ManagedSystem",
"sampleInfo": {
"timeStamp": "2020-12-09T12:37:00+0100",
"status": 0
},
"energyUtil": {
"powerUtil": {
"powerReading": [
542.000
]
},
"thermalUtil": {
"inletTemperatures": [
{
"entityId": "Inlet air temperature(40h)",
"entityInstance": "1",
"temperatureReading": [
26.000
]
}
],
"cpuTemperatures": [
{
"entityId": "CPU temperature sensors(41h)",
"entityInstance": "2",
"temperatureReading": [
54.000
]
},
{
"entityId": "CPU temperature sensors(41h)",
"entityInstance": "1",
"temperatureReading": [
46.000
]
}
],
"baseboardTemperatures": [
{
"entityId": "Baseboard temperature sensors(42h)",
"entityInstance": "1",
"temperatureReading": [
45.000
]
},
{
"entityId": "Baseboard temperature sensors(42h)",
"entityInstance": "2",
"temperatureReading": [
45.000
]
},
{
"entityId": "Baseboard temperature sensors(42h)",
"entityInstance": "3",
"temperatureReading": [
45.000
]
},
{
"entityId": "Baseboard temperature sensors(42h)",
"entityInstance": "4",
"temperatureReading": [
48.000
]
},
{
"entityId": "Baseboard temperature sensors(42h)",
"entityInstance": "5",
"temperatureReading": [
48.000
]
},
{
"entityId": "Baseboard temperature sensors(42h)",
"entityInstance": "6",
"temperatureReading": [
48.000
]
}
]
}
}
}
]
}
}

View file

@ -1,19 +0,0 @@
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:ns2="http://a9.com/-/spec/opensearch/1.1/" xmlns:ns3="http://www.w3.org/1999/xhtml">
<id>1700D42D-C9FA-4131-B024-588FDDC70649</id>
<updated>2020-08-10T20:54:30.000+02:00</updated>
<title type="text">ProcessedMetrics</title>
<subtitle type="text">LogicalPartition 1700D42D-C9FA-4131-B024-588FDDC70649</subtitle>
<link rel="self" href="https://10.32.64.39:12443/rest/api/pcm/ManagedSystem/b597e4da-2aab-3f52-8616-341d62153559/LogicalPartition/1700D42D-C9FA-4131-B024-588FDDC70649/ProcessedMetrics"/>
<generator uri="IBM Power Systems Management Console" version="1"/>
<entry>
<id>160106d5-1803-42f3-a81f-c1fd90456e8c</id>
<updated>2020-08-10T20:54:30.000+02:00</updated>
<title type="text">LogicalPartition_1700D42D-C9FA-4131-B024-588FDDC70649_20200810T185530+0200_20200810T205430+0200_30.json</title>
<published>2020-08-10T18:55:30.000+02:00</published>
<link type="application/json" href="https://10.32.64.39:12443/rest/api/pcm/ProcessedMetrics/LogicalPartition_1700D42D-C9FA-4131-B024-588FDDC70649_20200810T185530+0200_20200810T205430+0200_30.json"/>
<author>
<name>IBM Power Systems Management Console</name>
</author>
<category term="LogicalPartition" frequency="30"/>
</entry>
</feed>