diff --git a/build.gradle b/build.gradle index 3175af8..d07ef80 100644 --- a/build.gradle +++ b/build.gradle @@ -43,5 +43,4 @@ tasks.create("packages") { dependsOn ":plugins:buildDeb" dependsOn ":plugins:buildRpm" - } diff --git a/doc/Sysmon - Host Overview-1632317598140.json b/doc/Sysmon - Host Overview-1634225578630.json similarity index 91% rename from doc/Sysmon - Host Overview-1632317598140.json rename to doc/Sysmon - Host Overview-1634225578630.json index 509e9ec..5fab82c 100644 --- a/doc/Sysmon - Host Overview-1632317598140.json +++ b/doc/Sysmon - Host Overview-1634225578630.json @@ -77,7 +77,7 @@ "gnetId": null, "graphTooltip": 0, "id": null, - "iteration": 1632317456870, + "iteration": 1634215058842, "links": [], "panels": [ { @@ -129,6 +129,456 @@ }, "hiddenSeries": false, "id": 2, + "legend": { + "alignAsTable": false, + "avg": true, + "current": true, + "max": true, + "min": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "alias": "$col", + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "linear" + ], + "type": "fill" + } + ], + "measurement": "base_load", + "orderByTime": "ASC", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "1min" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + }, + { + "params": [ + "1min" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "5min" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + }, + { + "params": [ + "5min" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "15min" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + }, + { + "params": [ + "15min" + ], + "type": "alias" + } + ] + ], + "tags": [ + { + "key": "hostname", + "operator": "=~", + "value": "/^$hostname$/" + } + ] + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "System Load Average", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:42", + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "$$hashKey": "object:43", + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "datasource": "${DS_INFLUXDB-SYSMON}", + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "string" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "aix_processor.mode" + }, + "properties": [ + { + "id": "displayName", + "value": "Mode" + }, + { + "id": "noValue", + "value": "N/A" + }, + { + "id": "unit", + "value": "string" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "aix_processor.type" + }, + "properties": [ + { + "id": "displayName", + "value": "Type" + }, + { + "id": "noValue", + "value": "N/A" + }, + { + "id": "unit", + "value": "string" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "aix_processor.ent" + }, + "properties": [ + { + "id": "displayName", + "value": "eCPU" + }, + { + "id": "noValue", + "value": "N/A" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "aix_processor.lcpu" + }, + "properties": [ + { + "id": "displayName", + "value": "vCPU" + }, + { + "id": "noValue", + "value": "N/A" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "aix_processor.smt" + }, + "properties": [ + { + "id": "displayName", + "value": "SMT" + } + ] + } + ] + }, + "gridPos": { + "h": 5, + "w": 12, + "x": 12, + "y": 4 + }, + "id": 16, + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/.*/", + "values": false + }, + "text": {}, + "textMode": "value_and_name" + }, + "pluginVersion": "8.1.4", + "targets": [ + { + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "previous" + ], + "type": "fill" + } + ], + "measurement": "aix_processor", + "orderByTime": "ASC", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "mode" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + }, + { + "params": [ + "mode" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "type" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + }, + { + "params": [ + "type" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "ent" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + }, + { + "params": [ + "ent" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "lcpu" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + }, + { + "params": [ + "lcpu" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "smt" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + }, + { + "params": [ + "smt" + ], + "type": "alias" + } + ] + ], + "slimit": "1", + "tags": [ + { + "key": "hostname", + "operator": "=~", + "value": "/^$hostname$/" + } + ] + } + ], + "timeFrom": null, + "timeShift": null, + "title": "LPAR Details (IBM Power)", + "transformations": [ + { + "id": "filterFieldsByName", + "options": { + "include": { + "names": [ + "aix_processor.mode", + "aix_processor.type", + "aix_processor.ent", + "aix_processor.lcpu", + "aix_processor.smt" + ] + } + } + } + ], + "type": "stat" + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "${DS_INFLUXDB-SYSMON}", + "description": "", + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 6, + "w": 12, + "x": 0, + "y": 9 + }, + "hiddenSeries": false, + "id": 29, "legend": { "avg": false, "current": false, @@ -298,7 +748,7 @@ "timeFrom": null, "timeRegions": [], "timeShift": null, - "title": "Processor Usage", + "title": "Processor Utilization", "tooltip": { "shared": true, "sort": 0, @@ -337,447 +787,6 @@ "alignLevel": null } }, - { - "datasource": "${DS_INFLUXDB-SYSMON}", - "description": "", - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "string" - }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "aix_processor.mode" - }, - "properties": [ - { - "id": "displayName", - "value": "Mode" - }, - { - "id": "noValue", - "value": "N/A" - }, - { - "id": "unit", - "value": "string" - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "aix_processor.type" - }, - "properties": [ - { - "id": "displayName", - "value": "Type" - }, - { - "id": "noValue", - "value": "N/A" - }, - { - "id": "unit", - "value": "string" - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "aix_processor.ent" - }, - "properties": [ - { - "id": "displayName", - "value": "Entitlements" - }, - { - "id": "noValue", - "value": "N/A" - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "aix_processor.lcpu" - }, - "properties": [ - { - "id": "displayName", - "value": "Logical CPUs" - }, - { - "id": "noValue", - "value": "N/A" - } - ] - } - ] - }, - "gridPos": { - "h": 5, - "w": 12, - "x": 12, - "y": 4 - }, - "id": 16, - "options": { - "colorMode": "value", - "graphMode": "none", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "/.*/", - "values": false - }, - "text": {}, - "textMode": "value_and_name" - }, - "pluginVersion": "8.1.4", - "targets": [ - { - "groupBy": [ - { - "params": [ - "$__interval" - ], - "type": "time" - }, - { - "params": [ - "previous" - ], - "type": "fill" - } - ], - "measurement": "aix_processor", - "orderByTime": "ASC", - "policy": "default", - "refId": "A", - "resultFormat": "time_series", - "select": [ - [ - { - "params": [ - "mode" - ], - "type": "field" - }, - { - "params": [], - "type": "last" - }, - { - "params": [ - "mode" - ], - "type": "alias" - } - ], - [ - { - "params": [ - "type" - ], - "type": "field" - }, - { - "params": [], - "type": "last" - }, - { - "params": [ - "type" - ], - "type": "alias" - } - ], - [ - { - "params": [ - "ent" - ], - "type": "field" - }, - { - "params": [], - "type": "last" - }, - { - "params": [ - "ent" - ], - "type": "alias" - } - ], - [ - { - "params": [ - "lcpu" - ], - "type": "field" - }, - { - "params": [], - "type": "last" - }, - { - "params": [ - "lcpu" - ], - "type": "alias" - } - ] - ], - "slimit": "1", - "tags": [ - { - "key": "hostname", - "operator": "=~", - "value": "/^$hostname$/" - } - ] - } - ], - "timeFrom": null, - "timeShift": null, - "title": "LPAR Details (IBM Power)", - "transformations": [ - { - "id": "filterFieldsByName", - "options": { - "include": { - "names": [ - "aix_processor.mode", - "aix_processor.type", - "aix_processor.ent", - "aix_processor.lcpu" - ] - } - } - } - ], - "type": "stat" - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": "${DS_INFLUXDB-SYSMON}", - "fieldConfig": { - "defaults": { - "unit": "bytes" - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 6, - "w": 12, - "x": 0, - "y": 9 - }, - "hiddenSeries": false, - "id": 8, - "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": "8.1.4", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "alias": "$col", - "groupBy": [ - { - "params": [ - "$__interval" - ], - "type": "time" - }, - { - "params": [ - "linear" - ], - "type": "fill" - } - ], - "measurement": "base_memory", - "orderByTime": "ASC", - "policy": "default", - "refId": "A", - "resultFormat": "time_series", - "select": [ - [ - { - "params": [ - "available" - ], - "type": "field" - }, - { - "params": [], - "type": "mean" - }, - { - "params": [ - "available" - ], - "type": "alias" - } - ], - [ - { - "params": [ - "paged" - ], - "type": "field" - }, - { - "params": [], - "type": "mean" - }, - { - "params": [ - "paged" - ], - "type": "alias" - } - ], - [ - { - "params": [ - "virtual" - ], - "type": "field" - }, - { - "params": [], - "type": "mean" - }, - { - "params": [ - "virtual" - ], - "type": "alias" - } - ], - [ - { - "params": [ - "total" - ], - "type": "field" - }, - { - "params": [], - "type": "mean" - }, - { - "params": [ - "total" - ], - "type": "alias" - } - ] - ], - "tags": [ - { - "key": "hostname", - "operator": "=~", - "value": "/^$hostname$/" - } - ] - } - ], - "thresholds": [], - "timeFrom": null, - "timeRegions": [], - "timeShift": null, - "title": "Memory Usage", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "buckets": null, - "mode": "time", - "name": null, - "show": true, - "values": [] - }, - "yaxes": [ - { - "$$hashKey": "object:144", - "format": "bytes", - "label": null, - "logBase": 1, - "max": null, - "min": null, - "show": true - }, - { - "$$hashKey": "object:145", - "format": "short", - "label": null, - "logBase": 1, - "max": null, - "min": null, - "show": true - } - ], - "yaxis": { - "align": false, - "alignLevel": null - } - }, { "datasource": "${DS_INFLUXDB-SYSMON}", "fieldConfig": { @@ -991,6 +1000,10 @@ { "id": "displayName", "value": "Busy Logical CPUs" + }, + { + "id": "unit", + "value": "percent" } ] } @@ -1810,6 +1823,200 @@ "alignLevel": null } }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "${DS_INFLUXDB-SYSMON}", + "fieldConfig": { + "defaults": { + "unit": "bytes" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 34 + }, + "hiddenSeries": false, + "id": 8, + "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": "8.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "alias": "$col", + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "linear" + ], + "type": "fill" + } + ], + "measurement": "base_memory", + "orderByTime": "ASC", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "available" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + }, + { + "params": [ + "available" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "paged" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + }, + { + "params": [ + "paged" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "virtual" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + }, + { + "params": [ + "virtual" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "total" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + }, + { + "params": [ + "total" + ], + "type": "alias" + } + ] + ], + "tags": [ + { + "key": "hostname", + "operator": "=~", + "value": "/^$hostname$/" + } + ] + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Memory Usage", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:144", + "format": "bytes", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "$$hashKey": "object:145", + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, { "datasource": "${DS_INFLUXDB-SYSMON}", "fieldConfig": { @@ -1863,9 +2070,9 @@ "overrides": [] }, "gridPos": { - "h": 10, + "h": 8, "w": 12, - "x": 0, + "x": 12, "y": 34 }, "id": 25, @@ -2064,10 +2271,10 @@ ] }, "gridPos": { - "h": 10, - "w": 12, - "x": 12, - "y": 34 + "h": 6, + "w": 24, + "x": 0, + "y": 42 }, "id": 22, "options": { @@ -2302,7 +2509,7 @@ ] }, "time": { - "from": "now-3h", + "from": "now-15m", "to": "now-30s" }, "timepicker": { @@ -2321,5 +2528,5 @@ "timezone": "", "title": "Sysmon - Host Overview", "uid": "QkVPjseMk", - "version": 62 + "version": 67 } \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 4c9311f..e6e8ae6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -version=0.1.3 +version=0.1.5 pf4jVersion=3.6.0 slf4jVersion=1.7.32 camelVersion=3.11.2 diff --git a/plugins/os-aix/src/main/java/sysmon/plugins/os_aix/AixProcessorStat.java b/plugins/os-aix/src/main/java/sysmon/plugins/os_aix/AixProcessorStat.java index 488a424..7c4f576 100644 --- a/plugins/os-aix/src/main/java/sysmon/plugins/os_aix/AixProcessorStat.java +++ b/plugins/os-aix/src/main/java/sysmon/plugins/os_aix/AixProcessorStat.java @@ -26,12 +26,12 @@ public class AixProcessorStat { private static final Pattern patternLinux = Pattern.compile("^type=(\\S+) mode=(\\S+) smt=(\\d+) lcpu=(\\d+) mem=(\\d+) kB cpus=(\\d+) ent=(\\d+\\.?\\d*)"); - private String type; - private String mode; - private int smt; - private int lcpu; - private int psize; - private float ent; + private String type; // Indicates the partition type. The value can be either dedicated or shared. + private String mode; // Indicates whether the partition processor capacity is capped uncapped. + private int smt; // Indicates whether simultaneous multithreading is enabled or disabled in the partition. + private int lcpu; // Indicates the number of online logical processors. + //private int psize; // Indicates the number of online physical processors in the pool. + private float ent; // Indicates the entitled processing capacity in processor units (shared mode only). private final float user; // Indicates the percentage of the entitled processing capacity used while executing at the user level (application). private final float sys; // Indicates the percentage of the entitled processing capacity used while executing at the system level (kernel). @@ -56,7 +56,7 @@ public class AixProcessorStat { mode = matcher.group(2); smt = Integer.parseInt(matcher.group(3)); lcpu = Integer.parseInt(matcher.group(4)); - psize = Integer.parseInt(matcher.group(5)); + //psize = Integer.parseInt(matcher.group(6)); ent = Float.parseFloat(matcher.group(7)); } matcher = patternAixDedicated.matcher(line); @@ -75,8 +75,8 @@ public class AixProcessorStat { type = matcher.group(1); mode = matcher.group(2); smt = Integer.parseInt(matcher.group(3)); + //psize = Integer.parseInt(matcher.group(4)); lcpu = Integer.parseInt(matcher.group(4)); - psize = Integer.parseInt(matcher.group(6)); ent = Float.parseFloat(matcher.group(7)); } } @@ -156,6 +156,7 @@ public class AixProcessorStat { put("lbusy", lbusy); put("mode", mode); put("type", type); + put("smt", smt); }}; } } diff --git a/plugins/os-base/src/main/java/sysmon/plugins/os_base/BaseLoadExtension.java b/plugins/os-base/src/main/java/sysmon/plugins/os_base/BaseLoadExtension.java new file mode 100644 index 0000000..545ad4b --- /dev/null +++ b/plugins/os-base/src/main/java/sysmon/plugins/os_base/BaseLoadExtension.java @@ -0,0 +1,76 @@ +package sysmon.plugins.os_base; + +import org.pf4j.Extension; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import oshi.hardware.HardwareAbstractionLayer; +import sysmon.shared.Measurement; +import sysmon.shared.MetricExtension; +import sysmon.shared.MetricResult; + +import java.util.HashMap; +import java.util.Map; + +@Extension +public class BaseLoadExtension implements MetricExtension { + + private static final Logger log = LoggerFactory.getLogger(BaseLoadExtension.class); + + // Extension details + private final String name = "base_load"; + private final String provides = "load"; + private final String description = "Base Load Average Metrics"; + + // Configuration / Options + private boolean enabled = true; + + private HardwareAbstractionLayer hardwareAbstractionLayer; + + @Override + public boolean isEnabled() { + return enabled; + } + + @Override + public boolean isSupported() { + hardwareAbstractionLayer = BasePlugin.getHardwareAbstractionLayer(); + return hardwareAbstractionLayer != null; + } + + @Override + public String getName() { + return name; + } + + @Override + public String getProvides() { + return provides; + } + + @Override + public String getDescription() { + return description; + } + + @Override + public void setConfiguration(Map map) { + if (map.containsKey("enabled")) { + enabled = (boolean) map.get("enabled"); + } + } + + @Override + public MetricResult getMetrics() { + + double[] loadAvg = hardwareAbstractionLayer.getProcessor().getSystemLoadAverage(3); + HashMap fieldsMap = new HashMap() {{ + put("1min", loadAvg[0]); + put("5min", loadAvg[1]); + put("15min", loadAvg[2]); + }}; + + log.debug(fieldsMap.toString()); + return new MetricResult(name, new Measurement(new HashMap(), fieldsMap)); + } + +}