From 810cfee22b7a3d5ad8f73847a6df4a40bd671493 Mon Sep 17 00:00:00 2001 From: Mark Nellemann Date: Thu, 13 Aug 2020 11:48:00 +0200 Subject: [PATCH] More work on metrics for InfluxDB. --- README.md | 4 +- ... HMC Logical Partitions-1597311623553.json | 1505 +++++++++++++++++ ...s - HMC Managed Systems-1597311518654.json | 1148 +++++++++++++ doc/grafana-metrics.txt | 34 + .../biz/nellemann/hmci/InfluxClient.groovy | 165 +- .../nellemann/hmci/LogicalPartition.groovy | 109 +- .../biz/nellemann/hmci/ManagedSystem.groovy | 146 +- .../biz/nellemann/hmci/pojo/Storage.groovy | 2 +- .../nellemann/hmci/InfluxClientTest.groovy | 21 +- .../hmci/LogicalPartitionTest.groovy | 23 +- .../nellemann/hmci/ManagedSystemTest.groovy | 68 + 11 files changed, 3053 insertions(+), 172 deletions(-) create mode 100644 doc/Power Systems - HMC Logical Partitions-1597311623553.json create mode 100644 doc/Power Systems - HMC Managed Systems-1597311518654.json create mode 100644 doc/grafana-metrics.txt diff --git a/README.md b/README.md index 2e7861a..d3ae117 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Use the gradle build tool Start the InfluxDB container - docker run --name=influxdb -d -p 8086:8086 influxdb + docker run --name=influxdb --rm -d -p 8086:8086 influxdb To use the Influx client from the same container @@ -35,6 +35,6 @@ To use the Influx client from the same container Start the Grafana container, linking it to the InfluxDB container - docker run --name grafana --link influxdb:influxdb -d -p 3000:3000 grafana/grafana:7.1.3 + docker run --name grafana --link influxdb:influxdb --rm -d -p 3000:3000 grafana/grafana:7.1.3 Configure a new InfluxDB datasource on **http://influxdb:8086** to talk to the InfluxDB container. The database must be created beforehand, this can be done by running the hmci tool. \ No newline at end of file diff --git a/doc/Power Systems - HMC Logical Partitions-1597311623553.json b/doc/Power Systems - HMC Logical Partitions-1597311623553.json new file mode 100644 index 0000000..9b52141 --- /dev/null +++ b/doc/Power Systems - HMC Logical Partitions-1597311623553.json @@ -0,0 +1,1505 @@ +{ + "__inputs": [ + { + "name": "DS_INFLUXDB", + "label": "InfluxDB", + "description": "", + "type": "datasource", + "pluginId": "influxdb", + "pluginName": "InfluxDB" + } + ], + "__requires": [ + { + "type": "grafana", + "id": "grafana", + "name": "Grafana", + "version": "7.1.3" + }, + { + "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": "HMC metrics imported from nmon2influxdb", + "editable": true, + "gnetId": 1510, + "graphTooltip": 0, + "id": null, + "iteration": 1597311530718, + "links": [], + "panels": [ + { + "aliasColors": {}, + "bars": false, + "content": "", + "dashLength": 10, + "dashes": false, + "datasource": "${DS_INFLUXDB}", + "decimals": 2, + "editable": true, + "error": false, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 2, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 8, + "w": 24, + "x": 0, + "y": 0 + }, + "hiddenSeries": false, + "id": 2, + "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, + "links": [], + "mode": "", + "nullPointMode": "connected", + "percentage": false, + "pluginVersion": "7.1.3", + "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": "Processors", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": "cores", + "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, + "content": "", + "dashLength": 10, + "dashes": false, + "datasource": "${DS_INFLUXDB}", + "editable": true, + "error": false, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 0, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 8 + }, + "hiddenSeries": false, + "id": 12, + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 2, + "mode": "", + "nullPointMode": "connected", + "percentage": false, + "pluginVersion": "7.1.3", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "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", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [ + { + "condition": "", + "key": "partition", + "operator": "=~", + "value": "/^$Partition$/" + }, + { + "condition": "AND", + "key": "name", + "operator": "=~", + "value": "/apped/" + }, + { + "condition": "AND", + "key": "system", + "operator": "=~", + "value": "/^$ManagedSystem$/" + } + ] + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Processors", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": "cores", + "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, + "content": "", + "dashLength": 10, + "dashes": false, + "datasource": "${DS_INFLUXDB}", + "editable": true, + "error": false, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 0, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 8 + }, + "hiddenSeries": false, + "id": 4, + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 2, + "mode": "", + "nullPointMode": "connected", + "percentage": false, + "pluginVersion": "7.1.3", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "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": "partition", + "operator": "=~", + "value": "/^$Partition$/" + }, + { + "condition": "AND", + "key": "name", + "operator": "=~", + "value": "/time/" + }, + { + "condition": "AND", + "key": "system", + "operator": "=~", + "value": "/^$ManagedSystem$/" + } + ] + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Processor Time", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "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, + "content": "", + "dashLength": 10, + "dashes": false, + "datasource": "${DS_INFLUXDB}", + "editable": true, + "error": false, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 0, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 7, + "w": 24, + "x": 0, + "y": 16 + }, + "hiddenSeries": false, + "id": 3, + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 2, + "mode": "", + "nullPointMode": "connected", + "percentage": false, + "pluginVersion": "7.1.3", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "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": "PartitionMemory", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [ + { + "condition": "", + "key": "partition", + "operator": "=~", + "value": "/^$Partition$/" + }, + { + "condition": "AND", + "key": "system", + "operator": "=~", + "value": "/^$ManagedSystem$/" + } + ] + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Memory", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "decmbytes", + "label": "", + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "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_INFLUXDB}", + "editable": true, + "error": false, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 0, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 7, + "w": 12, + "x": 0, + "y": 23 + }, + "hiddenSeries": false, + "id": 5, + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": false, + "show": true, + "sort": "avg", + "sortDesc": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 2, + "mode": "", + "nullPointMode": "connected", + "percentage": false, + "pluginVersion": "7.1.3", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "style": {}, + "targets": [ + { + "alias": "$tag_partition viosid: $tag_ViosID vlan $tag_VlanID: $tag_name", + "dsType": "influxdb", + "groupBy": [ + { + "params": [ + "$interval" + ], + "type": "time" + }, + { + "params": [ + "name" + ], + "type": "tag" + }, + { + "params": [ + "VlanID" + ], + "type": "tag" + }, + { + "params": [ + "ViosID" + ], + "type": "tag" + }, + { + "params": [ + "partition" + ], + "type": "tag" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "hide": false, + "measurement": "PartitionVirtualEthernetAdapters", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [ + { + "condition": "", + "key": "partition", + "operator": "=~", + "value": "/^$Partition$/" + }, + { + "condition": "AND", + "key": "name", + "operator": "=~", + "value": "/Bytes/" + }, + { + "condition": "AND", + "key": "name", + "operator": "=~", + "value": "/PhysicalBytes/" + }, + { + "condition": "AND", + "key": "system", + "operator": "=~", + "value": "/^$ManagedSystem$/" + } + ] + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Virtual Network Adapter: physical throughput", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "Bps", + "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, + "content": "", + "dashLength": 10, + "dashes": false, + "datasource": "${DS_INFLUXDB}", + "editable": true, + "error": false, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 0, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 7, + "w": 12, + "x": 12, + "y": 23 + }, + "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", + "percentage": false, + "pluginVersion": "7.1.3", + "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", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [ + { + "condition": "", + "key": "partition", + "operator": "=~", + "value": "/^$Partition$/" + }, + { + "condition": "AND", + "key": "name", + "operator": "=~", + "value": "/Bytes/" + }, + { + "condition": "AND", + "key": "name", + "operator": "=~", + "value": "/PhysicalBytes/" + }, + { + "condition": "AND", + "key": "system", + "operator": "=~", + "value": "/^$ManagedSystem$/" + } + ] + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Virtual Network Adapter: virtual throughput", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "Bps", + "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, + "content": "", + "dashLength": 10, + "dashes": false, + "datasource": "${DS_INFLUXDB}", + "editable": true, + "error": false, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 2, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 7, + "w": 12, + "x": 0, + "y": 30 + }, + "hiddenSeries": false, + "id": 9, + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 2, + "mode": "", + "nullPointMode": "connected", + "percentage": false, + "pluginVersion": "7.1.3", + "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": [ + "name" + ], + "type": "tag" + }, + { + "params": [ + "wwpn" + ], + "type": "tag" + }, + { + "params": [ + "partition" + ], + "type": "tag" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "hide": false, + "measurement": "PartitionVirtualFiberChannelAdapters", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [ + { + "condition": "", + "key": "system", + "operator": "=~", + "value": "/^$ManagedSystem$/" + }, + { + "condition": "AND", + "key": "name", + "operator": "=~", + "value": "/Bytes/" + }, + { + "condition": "AND", + "key": "partition", + "operator": "=~", + "value": "/^$Partition$/" + }, + { + "condition": "AND", + "key": "name", + "operator": "=~", + "value": "/trans/" + } + ] + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Virtual Fiber Channel Adapters", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "Bps", + "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, + "content": "", + "dashLength": 10, + "dashes": false, + "datasource": "${DS_INFLUXDB}", + "editable": true, + "error": false, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 7, + "w": 12, + "x": 12, + "y": 30 + }, + "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", + "percentage": false, + "pluginVersion": "7.1.3", + "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": [ + "name" + ], + "type": "tag" + }, + { + "params": [ + "wwpn" + ], + "type": "tag" + }, + { + "params": [ + "partition" + ], + "type": "tag" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "hide": false, + "measurement": "PartitionVirtualFiberChannelAdapters", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [ + { + "condition": "", + "key": "system", + "operator": "=~", + "value": "/^$ManagedSystem$/" + }, + { + "condition": "AND", + "key": "name", + "operator": "=~", + "value": "/Bytes/" + }, + { + "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": "cumulative" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "Bps", + "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": false, + "schemaVersion": 26, + "style": "dark", + "tags": [ + "AIX" + ], + "templating": { + "list": [ + { + "allFormat": "regex values", + "allValue": null, + "current": {}, + "datasource": "${DS_INFLUXDB}", + "definition": "", + "hide": 0, + "includeAll": false, + "label": null, + "multi": false, + "multiFormat": "regex values", + "name": "ManagedSystem", + "options": [], + "query": "SHOW TAG VALUES FROM \"SystemProcessor\" WITH KEY = \"system\"", + "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_INFLUXDB}", + "definition": "", + "hide": 0, + "includeAll": true, + "label": null, + "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/w", + "now": false, + "to": "now" + }, + "timepicker": { + "refresh_intervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ], + "time_options": [ + "5m", + "15m", + "1h", + "6h", + "12h", + "24h", + "2d", + "7d", + "30d" + ] + }, + "timezone": "browser", + "title": "Power Systems - HMC Logical Partitions", + "uid": "Xl7oHESGz", + "version": 3 +} \ No newline at end of file diff --git a/doc/Power Systems - HMC Managed Systems-1597311518654.json b/doc/Power Systems - HMC Managed Systems-1597311518654.json new file mode 100644 index 0000000..1c5f782 --- /dev/null +++ b/doc/Power Systems - HMC Managed Systems-1597311518654.json @@ -0,0 +1,1148 @@ +{ + "__inputs": [ + { + "name": "DS_INFLUXDB", + "label": "InfluxDB", + "description": "", + "type": "datasource", + "pluginId": "influxdb", + "pluginName": "InfluxDB" + } + ], + "__requires": [ + { + "type": "grafana", + "id": "grafana", + "name": "Grafana", + "version": "7.1.3" + }, + { + "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": "nmon2influxdb HMC system view", + "editable": true, + "gnetId": 1465, + "graphTooltip": 0, + "id": null, + "iteration": 1597311329834, + "links": [], + "panels": [ + { + "collapsed": false, + "datasource": "${DS_INFLUXDB}", + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 20, + "panels": [], + "repeat": "ManagedSystem", + "title": "$ManagedSystem Processors", + "type": "row" + }, + { + "aliasColors": {}, + "bars": false, + "content": "", + "dashLength": 10, + "dashes": false, + "datasource": "${DS_INFLUXDB}", + "decimals": 2, + "editable": true, + "error": false, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 0, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 7, + "w": 12, + "x": 0, + "y": 1 + }, + "hiddenSeries": false, + "id": 19, + "legend": { + "alignAsTable": false, + "avg": true, + "current": true, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 2, + "links": [], + "mode": "", + "nullPointMode": "connected", + "percentage": false, + "pluginVersion": "7.1.3", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "style": {}, + "targets": [ + { + "alias": "$tag_pool $tag_name", + "dsType": "influxdb", + "groupBy": [ + { + "params": [ + "$interval" + ], + "type": "time" + }, + { + "params": [ + "name" + ], + "type": "tag" + }, + { + "params": [ + "pool" + ], + "type": "tag" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "hide": false, + "measurement": "SystemSharedProcessorPool", + "policy": "default", + "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": "availableProcUnits" + } + ] + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "$ManagedSystem Shared Processor Pools", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": "cores", + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "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_INFLUXDB}", + "decimals": 2, + "editable": true, + "error": false, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 0, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 7, + "w": 12, + "x": 12, + "y": 1 + }, + "hiddenSeries": false, + "id": 2, + "legend": { + "alignAsTable": false, + "avg": true, + "current": true, + "max": true, + "min": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 2, + "links": [], + "mode": "", + "nullPointMode": "connected", + "percentage": false, + "pluginVersion": "7.1.3", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "style": {}, + "targets": [ + { + "alias": "$tag_name", + "dsType": "influxdb", + "groupBy": [ + { + "params": [ + "$interval" + ], + "type": "time" + }, + { + "params": [ + "name" + ], + "type": "tag" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "hide": false, + "measurement": "SystemProcessor", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [ + { + "condition": "", + "key": "name", + "operator": "=~", + "value": "/Units/" + }, + { + "condition": "AND", + "key": "system", + "operator": "=~", + "value": "/^$ManagedSystem$/" + } + ] + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "$ManagedSystem Processors", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": "cores", + "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 + } + }, + { + "collapsed": false, + "datasource": "${DS_INFLUXDB}", + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 8 + }, + "id": 21, + "panels": [], + "repeat": "ManagedSystem", + "title": "Dashboard Row", + "type": "row" + }, + { + "aliasColors": {}, + "bars": false, + "content": "", + "dashLength": 10, + "dashes": false, + "datasource": "${DS_INFLUXDB}", + "decimals": 2, + "editable": true, + "error": false, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 2, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 7, + "w": 12, + "x": 0, + "y": 9 + }, + "hiddenSeries": false, + "id": 12, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": true, + "min": true, + "show": true, + "sort": "avg", + "sortDesc": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 2, + "links": [], + "mode": "", + "nullPointMode": "connected", + "percentage": false, + "pluginVersion": "7.1.3", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": true, + "steppedLine": false, + "style": {}, + "targets": [ + { + "alias": "$tag_partition", + "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": "$ManagedSystem Processor Usage by Partition", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": "cores", + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "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_INFLUXDB}", + "editable": true, + "error": false, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 0, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 7, + "w": 12, + "x": 12, + "y": 9 + }, + "hiddenSeries": false, + "id": 3, + "legend": { + "alignAsTable": false, + "avg": true, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 2, + "links": [], + "mode": "", + "nullPointMode": "connected", + "percentage": false, + "pluginVersion": "7.1.3", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "style": {}, + "targets": [ + { + "alias": "$tag_name", + "dsType": "influxdb", + "groupBy": [ + { + "params": [ + "$interval" + ], + "type": "time" + }, + { + "params": [ + "name" + ], + "type": "tag" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "hide": false, + "measurement": "SystemMemory", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [ + { + "condition": "", + "key": "system", + "operator": "=~", + "value": "/^$ManagedSystem$/" + } + ] + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "$ManagedSystem Memory", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "decmbytes", + "label": "", + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "collapsed": false, + "datasource": "${DS_INFLUXDB}", + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 16 + }, + "id": 22, + "panels": [], + "repeat": "ManagedSystem", + "title": "$ManagedSystem Network", + "type": "row" + }, + { + "aliasColors": {}, + "bars": false, + "content": "", + "dashLength": 10, + "dashes": false, + "datasource": "${DS_INFLUXDB}", + "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": 16, + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": false, + "rightSide": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 2, + "links": [], + "mode": "", + "nullPointMode": "connected", + "percentage": false, + "pluginVersion": "7.1.3", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": true, + "steppedLine": false, + "style": {}, + "targets": [ + { + "alias": "$tag_partition dev: $tag_device", + "dsType": "influxdb", + "groupBy": [ + { + "params": [ + "$interval" + ], + "type": "time" + }, + { + "params": [ + "partition" + ], + "type": "tag" + }, + { + "params": [ + "device" + ], + "type": "tag" + }, + { + "params": [ + "partition" + ], + "type": "tag" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "hide": false, + "measurement": "SystemFiberChannelAdapters", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [ + { + "condition": "", + "key": "system", + "operator": "=~", + "value": "/^$ManagedSystem$/" + }, + { + "condition": "AND", + "key": "name", + "operator": "=~", + "value": "/writeByt/" + } + ] + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "$ManagedSystem VIOS Physical Fiber Channel Adapters write", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "Bps", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "none", + "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_INFLUXDB}", + "editable": true, + "error": false, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 8, + "w": 24, + "x": 0, + "y": 25 + }, + "hiddenSeries": false, + "id": 11, + "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", + "percentage": false, + "pluginVersion": "7.1.3", + "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": [ + "device" + ], + "type": "tag" + }, + { + "params": [ + "partition" + ], + "type": "tag" + }, + { + "params": [ + "name" + ], + "type": "tag" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "hide": false, + "measurement": "SystemSharedAdapters", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [ + { + "condition": "", + "key": "system", + "operator": "=~", + "value": "/^$ManagedSystem$/" + }, + { + "condition": "AND", + "key": "name", + "operator": "=", + "value": "transferredBytes" + } + ] + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "$ManagedSystem SEA transfered bytes", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "Bps", + "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": "5m", + "schemaVersion": 26, + "style": "dark", + "tags": [ + "AIX" + ], + "templating": { + "list": [ + { + "allFormat": "regex values", + "allValue": null, + "current": {}, + "datasource": "${DS_INFLUXDB}", + "definition": "", + "hide": 0, + "includeAll": false, + "label": null, + "multi": true, + "multiFormat": "regex values", + "name": "ManagedSystem", + "options": [], + "query": "SHOW TAG VALUES FROM \"SystemProcessor\" WITH KEY = \"system\"", + "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_INFLUXDB}", + "definition": "", + "hide": 0, + "includeAll": true, + "label": null, + "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/w", + "now": false, + "to": "now" + }, + "timepicker": { + "refresh_intervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ], + "time_options": [ + "5m", + "15m", + "1h", + "6h", + "12h", + "24h", + "2d", + "7d", + "30d" + ] + }, + "timezone": "browser", + "title": "Power Systems - HMC Managed Systems", + "uid": "ClJhHPIGz", + "version": 4 +} \ No newline at end of file diff --git a/doc/grafana-metrics.txt b/doc/grafana-metrics.txt new file mode 100644 index 0000000..60a32db --- /dev/null +++ b/doc/grafana-metrics.txt @@ -0,0 +1,34 @@ + +PartitionProcessor + - UtilizedProcUnits => utilizedProcUnits + - /apped/ + - /Time/ => /time/ + +PartitionMemory + - + +PartitionVirtualEthernetAdapters + - /Bytes/ + - /PhysicalBytes/ + + +PartitionVirtualFiberChannelAdapters + - Bytes + - /trans/ + + +SystemSharedProcessorPool + - !availableProcUnits + + +SystemProcessor + - /Units/ + +SystemMemory + - + +SystemFiberChannelAdapters + - /writeByt/ + +SystemSharedAdapters + - transferredBytes diff --git a/src/main/groovy/biz/nellemann/hmci/InfluxClient.groovy b/src/main/groovy/biz/nellemann/hmci/InfluxClient.groovy index 4a291d8..c01a455 100644 --- a/src/main/groovy/biz/nellemann/hmci/InfluxClient.groovy +++ b/src/main/groovy/biz/nellemann/hmci/InfluxClient.groovy @@ -92,6 +92,15 @@ class InfluxClient { } + + + + + /* + Managed System + */ + + void writeManagedSystem(ManagedSystem system) { if(system.metrics == null) { @@ -107,18 +116,9 @@ class InfluxClient { BatchPoints batchPoints = BatchPoints .database(database) - //.retentionPolicy("defaultPolicy") + //.retentionPolicy("defaultPolicy") .build(); - /* - ServerProcessor processor - ServerMemory memory - PhysicalProcessorPool physicalProcessorPool - SharedProcessorPool sharedProcessorPool - - + VIOS - */ - getSystemMemory(system, timestamp).each { batchPoints.point(it) } @@ -131,9 +131,46 @@ class InfluxClient { batchPoints.point(it) } + getSystemSharedAdapters(system, timestamp).each { + batchPoints.point(it) + } + + getSystemFiberChannelAdapters(system, timestamp).each { + batchPoints.point(it) + } + influxDB.write(batchPoints); } + private static List getSystemMemory(ManagedSystem system, Instant timestamp) { + List metrics = system.getMemoryMetrics() + return processMeasurementMap(metrics, timestamp, "SystemMemory") + } + + private static List getSystemProcessor(ManagedSystem system, Instant timestamp) { + List metrics = system.getProcessorMetrics() + return processMeasurementMap(metrics, timestamp, "SystemProcessor") + } + + private static List getSystemSharedProcessorPools(ManagedSystem system, Instant timestamp) { + List metrics = system.getSharedProcessorPools() + return processMeasurementMap(metrics, timestamp, "SystemSharedProcessorPool") + } + + private static List getSystemSharedAdapters(ManagedSystem system, Instant timestamp) { + List metrics = system.getSystemSharedAdapters() + return processMeasurementMap(metrics, timestamp, "SystemSharedAdapters") + } + + private static List getSystemFiberChannelAdapters(ManagedSystem system, Instant timestamp) { + List metrics = system.getSystemFiberChannelAdapters() + return processMeasurementMap(metrics, timestamp, "SystemFiberChannelAdapters") + } + + + /* + Logical Partitions + */ void writeLogicalPartition(LogicalPartition partition) { @@ -164,113 +201,39 @@ class InfluxClient { batchPoints.point(it) } + getPartitionVirtualFiberChannelAdapter(partition, timestamp).each { + batchPoints.point(it) + } + influxDB.write(batchPoints); } - - private static List getSystemMemory(ManagedSystem system, Instant timestamp) { - - Map map = system.getMemoryMetrics() - List pointList = map.collect {fieldName, fieldValue -> - - return Point.measurement("SystemMemory") - .time(timestamp.toEpochMilli(), TimeUnit.MILLISECONDS) - .tag("system", system.name) - .tag("name", fieldName.capitalize()) // The dashboard expects it - .addField("value", fieldValue) - .build() - } - - return pointList; - } - - - private static List getSystemProcessor(ManagedSystem system, Instant timestamp) { - - Map map = system.getProcessorMetrics() - List pointList = map.collect {fieldName, fieldValue -> - - return Point.measurement("SystemProcessor") - .time(timestamp.toEpochMilli(), TimeUnit.MILLISECONDS) - .tag("system", system.name) - .tag("name", fieldName.capitalize()) // The dashboard expects it - .addField("value", fieldValue) - .build() - } - - return pointList; - } - - - private static List getSystemSharedProcessorPools(ManagedSystem system, Instant timestamp) { - - List pointList - system.getSharedProcessorPools().each {name, map -> - //log.debug(name) // Pool name - - pointList = map.collect { fieldName, fieldValue -> - - return Point.measurement("SystemSharedProcessorPool") - .time(timestamp.toEpochMilli(), TimeUnit.MILLISECONDS) - .tag("system", system.name) - .tag("pool", name) - .tag("name", fieldName) - .addField("value", fieldValue) - .build() - } - - } - - return pointList; - } - - - - private static List getPartitionMemory(LogicalPartition partition, Instant timestamp) { - - Map map = partition.getMemoryMetrics() - List pointList = map.collect {fieldName, fieldValue -> - - return Point.measurement("PartitionMemory") - .time(timestamp.toEpochMilli(), TimeUnit.MILLISECONDS) - .tag("partition", partition.name) - .tag("system", partition.system.name) - .tag("name", fieldName.capitalize()) // The dashboard expects it - .addField("value", fieldValue) - .build() - } - - return pointList; + List metrics = partition.getMemoryMetrics() + return processMeasurementMap(metrics, timestamp, "PartitionMemory") } - private static List getPartitionProcessor(LogicalPartition partition, Instant timestamp) { - - Map map = partition.getProcessorMetrics() - List pointList = map.collect {fieldName, fieldValue -> - - return Point.measurement("PartitionProcessor") - .time(timestamp.toEpochMilli(), TimeUnit.MILLISECONDS) - .tag("partition", partition.name) - .tag("system", partition.system.name) - .tag("name", fieldName.capitalize()) // The dashboard expects it - .addField("value", fieldValue) - .build() - } - - return pointList; + List metrics = partition.getProcessorMetrics() + return processMeasurementMap(metrics, timestamp, "PartitionProcessor") } - - private static List getPartitionVirtualEthernetAdapter(LogicalPartition partition, Instant timestamp) { List metrics = partition.getVirtualEthernetAdapterMetrics() return processMeasurementMap(metrics, timestamp, "PartitionVirtualEthernetAdapters") } + private static List getPartitionVirtualFiberChannelAdapter(LogicalPartition partition, Instant timestamp) { + List metrics = partition.getVirtualFiberChannelAdaptersMetrics() + return processMeasurementMap(metrics, timestamp, "PartitionVirtualFiberChannelAdapters") + } + + /* + Shared + */ + private static List processMeasurementMap(List listOfMaps, Instant timestamp, String measurement) { List list = new ArrayList<>() diff --git a/src/main/groovy/biz/nellemann/hmci/LogicalPartition.groovy b/src/main/groovy/biz/nellemann/hmci/LogicalPartition.groovy index bf154e8..82f4e4a 100644 --- a/src/main/groovy/biz/nellemann/hmci/LogicalPartition.groovy +++ b/src/main/groovy/biz/nellemann/hmci/LogicalPartition.groovy @@ -22,43 +22,63 @@ class LogicalPartition extends MetaSystem { } - Map getMemoryMetrics() { + List getMemoryMetrics() { - HashMap map = [ + List list = new ArrayList<>() + Map map = new HashMap() + + HashMap tagsMap = [ + system: system.name, + partition: name, + ] + map.put("tags", tagsMap) + log.debug(tagsMap.toString()) + + HashMap fieldsMap = [ logicalMem: metrics.systemUtil.utilSamples.first().lparsUtil.first().memory.logicalMem.first(), backedPhysicalMem: metrics.systemUtil.utilSamples.first().lparsUtil.first().memory.backedPhysicalMem.first(), ] + map.put("fields", fieldsMap) + log.debug(fieldsMap.toString()) - return map + list.add(map) + return list } - Map getProcessorMetrics() { + List getProcessorMetrics() { - HashMap map = [ - utilizedProcUnits: metrics.systemUtil.utilSamples.first().lparsUtil.first().processor.utilizedProcUnits.first(), - maxVirtualProcessors: metrics.systemUtil.utilSamples.first().lparsUtil.first().processor.maxVirtualProcessors.first(), - currentVirtualProcessors: metrics.systemUtil.utilSamples.first().lparsUtil.first().processor.currentVirtualProcessors.first(), - donatedProcUnits: metrics.systemUtil.utilSamples.first().lparsUtil.first().processor.donatedProcUnits.first(), - entitledProcUnits: metrics.systemUtil.utilSamples.first().lparsUtil.first().processor.entitledProcUnits.first(), - idleProcUnits: metrics.systemUtil.utilSamples.first().lparsUtil.first().processor.idleProcUnits.first(), - maxProcUnits: metrics.systemUtil.utilSamples.first().lparsUtil.first().processor.maxProcUnits.first(), - utilizedCappedProcUnits: metrics.systemUtil.utilSamples.first().lparsUtil.first().processor.utilizedCappedProcUnits.first(), - utilizedUncappedProcUnits: metrics.systemUtil.utilSamples.first().lparsUtil.first().processor.utilizedUncappedProcUnits.first(), - timePerInstructionExecution: metrics.systemUtil.utilSamples.first().lparsUtil.first().processor.timeSpentWaitingForDispatch.first(), - timeSpentWaitingForDispatch: metrics.systemUtil.utilSamples.first().lparsUtil.first().processor.timePerInstructionExecution.first(), + List list = new ArrayList<>() + Map map = new HashMap() + + HashMap tagsMap = [ + system: system.name, + partition: name, ] + map.put("tags", tagsMap) + log.debug(tagsMap.toString()) - return map + HashMap fieldsMap = [ + utilizedProcUnits: metrics.systemUtil.utilSamples.first().lparsUtil.first().processor.utilizedProcUnits.first(), + //maxVirtualProcessors: metrics.systemUtil.utilSamples.first().lparsUtil.first().processor.maxVirtualProcessors.first(), + //currentVirtualProcessors: metrics.systemUtil.utilSamples.first().lparsUtil.first().processor.currentVirtualProcessors.first(), + //donatedProcUnits: metrics.systemUtil.utilSamples.first().lparsUtil.first().processor.donatedProcUnits.first(), + //entitledProcUnits: metrics.systemUtil.utilSamples.first().lparsUtil.first().processor.entitledProcUnits.first(), + //idleProcUnits: metrics.systemUtil.utilSamples.first().lparsUtil.first().processor.idleProcUnits.first(), + //maxProcUnits: metrics.systemUtil.utilSamples.first().lparsUtil.first().processor.maxProcUnits.first(), + utilizedCappedProcUnits: metrics.systemUtil.utilSamples.first().lparsUtil.first().processor.utilizedCappedProcUnits.first(), + utilizedUncappedProcUnits: metrics.systemUtil.utilSamples.first().lparsUtil.first().processor.utilizedUncappedProcUnits.first(), + timePerInstructionExecution: metrics.systemUtil.utilSamples.first().lparsUtil.first().processor.timeSpentWaitingForDispatch.first(), + timeSpentWaitingForDispatch: metrics.systemUtil.utilSamples.first().lparsUtil.first().processor.timePerInstructionExecution.first(), + ] + map.put("fields", fieldsMap) + log.debug(fieldsMap.toString()) + + list.add(map) + return list } - // PartitionVSCSIAdapters - VIOS? - - // PartitionVirtualEthernetAdapters - // PartitionVirtualFiberChannelAdapters - - List getVirtualEthernetAdapterMetrics() { List list = new ArrayList<>() @@ -68,12 +88,13 @@ class LogicalPartition extends MetaSystem { HashMap tagsMap = [ system: system.name, partition: name, - sea: it.sharedEthernetAdapterId, - viosId: it.viosId, - vlanId: it.vlanId, - vswitchId: it.vswitchId, + sea: it.sharedEthernetAdapterId as String, + viosId: it.viosId as String, + vlanId: it.vlanId as String, + vswitchId: it.vswitchId as String, ] map.put("tags", tagsMap) + log.debug(tagsMap.toString()) HashMap fieldsMap = [ receivedPhysicalBytes: it.receivedPhysicalBytes.first(), @@ -81,12 +102,42 @@ class LogicalPartition extends MetaSystem { receivedBytes: it.receivedBytes.first(), sentBytes: it.sentBytes.first(), ] - map.put(it.physicalLocation, fieldsMap) + map.put("fields", fieldsMap) + log.debug(fieldsMap.toString()) list.add(map) } - + return list } + + //PartitionVirtualFiberChannelAdapters + List getVirtualFiberChannelAdaptersMetrics() { + + List list = new ArrayList<>() + Map map = new HashMap() + metrics.systemUtil.utilSamples.first().lparsUtil.first().storage?.virtualFiberChannelAdapters?.each { + + HashMap tagsMap = [ + system: system.name, + partition: name, + viosId: it.viosId as String, + wwpn: it.wwpn, + ] + map.put("tags", tagsMap) + log.debug(tagsMap.toString()) + + HashMap fieldsMap = [ + transmittedBytes: it.transmittedBytes.first(), + writeBytes: it.writeBytes.first(), + ] + map.put("fields", fieldsMap) + log.debug(fieldsMap.toString()) + + list.add(map) + } + + return list + } } diff --git a/src/main/groovy/biz/nellemann/hmci/ManagedSystem.groovy b/src/main/groovy/biz/nellemann/hmci/ManagedSystem.groovy index 9461922..8ab4eb8 100644 --- a/src/main/groovy/biz/nellemann/hmci/ManagedSystem.groovy +++ b/src/main/groovy/biz/nellemann/hmci/ManagedSystem.groovy @@ -27,73 +27,147 @@ class ManagedSystem extends MetaSystem { return "[${id}] ${name} (${type}-${model} ${serialNumber})" } - - Object getMetrics(String metric) { - switch (metric) { - case "SystemSharedProcessorPool": - return getSharedProcessorPools() - break - - } - } - Map getMemoryMetrics() { + List getMemoryMetrics() { - HashMap map = [ + List list = new ArrayList<>() + Map map = new HashMap() + + HashMap tagsMap = [ + system: name, + ] + map.put("tags", tagsMap) + log.debug(tagsMap.toString()) + + HashMap fieldsMap = [ totalMem: metrics.systemUtil.utilSamples.first().serverUtil.memory.totalMem.first(), availableMem: metrics.systemUtil.utilSamples.first().serverUtil.memory.availableMem.first(), configurableMem: metrics.systemUtil.utilSamples.first().serverUtil.memory.configurableMem.first(), assignedMemToLpars: metrics.systemUtil.utilSamples.first().serverUtil.memory.assignedMemToLpars.first(), ] + map.put("fields", fieldsMap) + log.debug(fieldsMap.toString()) - return map + list.add(map) + return list } - Map getProcessorMetrics() { + List getProcessorMetrics() { - HashMap map = [ + List list = new ArrayList<>() + Map map = new HashMap() + + HashMap tagsMap = [ + system: name, + ] + map.put("tags", tagsMap) + log.debug(tagsMap.toString()) + + HashMap fieldsMap = [ availableProcUnits: metrics.systemUtil.utilSamples.first().serverUtil.processor.totalProcUnits.first(), utilizedProcUnits: metrics.systemUtil.utilSamples.first().serverUtil.processor.utilizedProcUnits.first(), availableProcUnits: metrics.systemUtil.utilSamples.first().serverUtil.processor.availableProcUnits.first(), configurableProcUnits: metrics.systemUtil.utilSamples.first().serverUtil.processor.configurableProcUnits.first(), ] + map.put("fields", fieldsMap) + log.debug(fieldsMap.toString()) - return map + list.add(map) + return list } - Map getPhysicalProcessorPool() { - HashMap map = [ - assignedProcUnits: metrics.systemUtil.utilSamples.first().serverUtil.physicalProcessorPool.assignedProcUnits.first(), - availableProcUnits: metrics.systemUtil.utilSamples.first().serverUtil.physicalProcessorPool.availableProcUnits.first(), - ] - - return map - } - - - - Map> getSharedProcessorPools() { + List getSharedProcessorPools() { + List list = new ArrayList<>() Map map = new HashMap() metrics.systemUtil.utilSamples.first().serverUtil.sharedProcessorPool.each { - HashMap innerMap = [ + HashMap tagsMap = [ + system: name, + pool: it.name, + ] + map.put("tags", tagsMap) + log.debug(tagsMap.toString()) + + HashMap fieldsMap = [ assignedProcUnits: it.assignedProcUnits.first(), availableProcUnits: it.availableProcUnits.first(), ] - map.put(it.name, innerMap) + map.put("fields", fieldsMap) + log.debug(fieldsMap.toString()) + + list.add(map) + } - return map + + return list + + } + + List getSystemSharedAdapters() { + + List list = new ArrayList<>() + Map map = new HashMap() + metrics.systemUtil.utilSamples.first().viosUtil.each {vios -> + + vios.network.sharedAdapters.each { + + HashMap tagsMap = [ + system: name, + type: it.type, + vios: vios.name, + ] + map.put("tags", tagsMap) + log.debug(tagsMap.toString()) + + HashMap fieldsMap = [ + sentBytes: it.sentBytes.first(), + transferredBytes: it.transferredBytes.first(), + ] + map.put("fields", fieldsMap) + log.debug(fieldsMap.toString()) + + list.add(map) + } + + } + + return list } - // SystemSharedAdapters - // SystemGenericPhysicalAdapters - // SystemGenericVirtualAdapters - // SystemGenericPhysicalAdapters - // SystemGenericAdapters - // SystemFiberChannelAdapters + List getSystemFiberChannelAdapters() { + + List list = new ArrayList<>() + Map map = new HashMap() + metrics.systemUtil.utilSamples.first().viosUtil.each { vios -> + vios.storage.fiberChannelAdapters.each { + + HashMap tagsMap = [ + system: name, + wwpn: it.wwpn, + vios: vios.name, + ] + map.put("tags", tagsMap) + log.debug(tagsMap.toString()) + + HashMap fieldsMap = [ + writeBytes: it.writeBytes.first(), + readBytes: it.readBytes.first(), + ] + map.put("fields", fieldsMap) + log.debug(fieldsMap.toString()) + + list.add(map) + + } + + } + + return list + + } } diff --git a/src/main/groovy/biz/nellemann/hmci/pojo/Storage.groovy b/src/main/groovy/biz/nellemann/hmci/pojo/Storage.groovy index 7001e5a..be9832a 100644 --- a/src/main/groovy/biz/nellemann/hmci/pojo/Storage.groovy +++ b/src/main/groovy/biz/nellemann/hmci/pojo/Storage.groovy @@ -8,7 +8,7 @@ class Storage { List clientLpars List genericPhysicalAdapters List genericVirtualAdapters - List virtualFiberChannelAdapters List fiberChannelAdapters + List virtualFiberChannelAdapters } diff --git a/src/test/groovy/biz/nellemann/hmci/InfluxClientTest.groovy b/src/test/groovy/biz/nellemann/hmci/InfluxClientTest.groovy index 06ecd3a..c9a1624 100644 --- a/src/test/groovy/biz/nellemann/hmci/InfluxClientTest.groovy +++ b/src/test/groovy/biz/nellemann/hmci/InfluxClientTest.groovy @@ -1,6 +1,5 @@ package biz.nellemann.hmci -import okhttp3.mockwebserver.MockWebServer import spock.lang.Specification class InfluxClientTest extends Specification { @@ -17,7 +16,7 @@ class InfluxClientTest extends Specification { } - void "write some managed system data to influx"() { + void "write ManagedSystem data to influx"() { setup: def testFile = new File(getClass().getResource('/pcm-data-managed-system.json').toURI()) @@ -34,4 +33,22 @@ class InfluxClientTest extends Specification { } + void "write LogicalPartition data to influx"() { + + setup: + def testFile = new File(getClass().getResource('/pcm-data-logical-partition.json').toURI()) + def testJson = testFile.getText('UTF-8') + + when: + ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "TestSystem", "TestType", "TestModel", "Test s/n") + LogicalPartition lpar = new LogicalPartition("2DE05DB6-8AD5-448F-8327-0F488D287E82", "9Flash01", "OS400", system) + + lpar.processMetrics(testJson) + influxClient.writeLogicalPartition(lpar) + + then: + lpar.metrics.systemUtil.utilSamples.first().sampleInfo.status == 2 + + } + } diff --git a/src/test/groovy/biz/nellemann/hmci/LogicalPartitionTest.groovy b/src/test/groovy/biz/nellemann/hmci/LogicalPartitionTest.groovy index cf3c966..3afaab1 100644 --- a/src/test/groovy/biz/nellemann/hmci/LogicalPartitionTest.groovy +++ b/src/test/groovy/biz/nellemann/hmci/LogicalPartitionTest.groovy @@ -19,8 +19,29 @@ class LogicalPartitionTest extends Specification { then: lpar.metrics.systemUtil.utilSamples.first().lparsUtil.first().memory.logicalMem.first() == 8192.000 lpar.metrics.systemUtil.utilSamples.first().lparsUtil.first().processor.utilizedProcUnits.first() == 0.001 - lpar.metrics.systemUtil.utilSamples.first().lparsUtil.first().network.virtualEthernetAdapters.first().receivedPackets.first() == 3.867 + lpar.metrics.systemUtil.utilSamples.first().lparsUtil.first().network.virtualEthernetAdapters.first().receivedBytes.first() == 276.467 + + } + + void "test getVirtualEthernetAdapterMetrics"() { + + 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 listOfMaps = lpar.getVirtualEthernetAdapterMetrics() + + then: + listOfMaps.size() == 1 + listOfMaps.first().get("fields")['receivedBytes'] == 276.467 + listOfMaps.first().get("tags")['sea'] == 'ent5' } + + } diff --git a/src/test/groovy/biz/nellemann/hmci/ManagedSystemTest.groovy b/src/test/groovy/biz/nellemann/hmci/ManagedSystemTest.groovy index f92260b..ed31e41 100644 --- a/src/test/groovy/biz/nellemann/hmci/ManagedSystemTest.groovy +++ b/src/test/groovy/biz/nellemann/hmci/ManagedSystemTest.groovy @@ -24,4 +24,72 @@ class ManagedSystemTest extends Specification { } + void "test getMemoryMetrics"() { + + setup: + def testFile = new File(getClass().getResource('/pcm-data-managed-system.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") + + when: + system.processMetrics(testJson) + List listOfMaps = system.getMemoryMetrics() + + then: + listOfMaps.size() == 1 + listOfMaps.first().get("fields")['totalMem'] == 1048576.000 + } + + void "test getProcessorMetrics"() { + + setup: + def testFile = new File(getClass().getResource('/pcm-data-managed-system.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") + + when: + system.processMetrics(testJson) + List listOfMaps = system.getProcessorMetrics() + + then: + listOfMaps.size() == 1 + listOfMaps.first().get("fields")['availableProcUnits'] == 16.000 + } + + void "test getSystemSharedProcessorPools"() { + + setup: + def testFile = new File(getClass().getResource('/pcm-data-managed-system.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") + + when: + system.processMetrics(testJson) + List listOfMaps = system.getSharedProcessorPools() + + then: + listOfMaps.size() == 1 + listOfMaps.first().get("fields")['assignedProcUnits'] == 23.767 + } + + + /* + void "test getSharedAdapterMetrics"() { + + 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 listOfMaps = lpar.getSharedAdapterMetrics() + + then: + listOfMaps.size() == 1 + listOfMaps.first().get("fields")['receivedBytes'] == 276.467 + listOfMaps.first().get("tags")['sea'] == 'ent5' + }*/ + }