Disable netstat extension.

Update example dashboard.
This commit is contained in:
Mark Nellemann 2021-06-11 02:21:32 +02:00
parent 30806780e0
commit 13cc0bbcfc
10 changed files with 280 additions and 586 deletions

View file

@ -2,17 +2,20 @@
Java based system monitoring solution with support for plugins. Java based system monitoring solution with support for plugins.
- Example Grafana [dashboard](https://bitbucket.org/mnellemann/sysmon/downloads/sysmon-example-dashboard.png) showing metrics from a host running *sysmon*.
## Client ## Components
Runs on your hosts and collects metrics. Metrics are aggregated and sent to the central *server*. ### Client
Runs on your hosts and collects metrics, which are sent to the central *server*.
## Server ### Server
Receives aggregated measurements from clients and saves metrics into InfluxDB. Receives aggregated metrics from clients and saves these into InfluxDB.
## Plugins ### Plugins
Loaded by the client and provides extensions for doing the actual metric monitoring. Loaded by the client and provides extensions for doing the actual collecting of metrics.

View file

@ -1,4 +1,46 @@
{ {
"__inputs": [
{
"name": "DS_INFLUXDB-SYSMON",
"label": "InfluxDB-sysmon",
"description": "",
"type": "datasource",
"pluginId": "influxdb",
"pluginName": "InfluxDB"
}
],
"__requires": [
{
"type": "panel",
"id": "gauge",
"name": "Gauge",
"version": ""
},
{
"type": "grafana",
"id": "grafana",
"name": "Grafana",
"version": "8.0.0"
},
{
"type": "panel",
"id": "graph",
"name": "Graph (old)",
"version": ""
},
{
"type": "datasource",
"id": "influxdb",
"name": "InfluxDB",
"version": "1.0.0"
},
{
"type": "panel",
"id": "stat",
"name": "Stat",
"version": ""
}
],
"annotations": { "annotations": {
"list": [ "list": [
{ {
@ -12,11 +54,12 @@
} }
] ]
}, },
"description": "Metrics from within host / guest / partition.",
"editable": true, "editable": true,
"gnetId": null, "gnetId": null,
"graphTooltip": 0, "graphTooltip": 0,
"id": 43, "id": null,
"iteration": 1623307961363, "iteration": 1623356323404,
"links": [], "links": [],
"panels": [ "panels": [
{ {
@ -31,13 +74,6 @@
"id": 4, "id": 4,
"panels": [], "panels": [],
"repeat": "hostname", "repeat": "hostname",
"scopedVars": {
"hostname": {
"selected": true,
"text": "S824Rhel71le",
"value": "S824Rhel71le"
}
},
"title": "${hostname}", "title": "${hostname}",
"type": "row" "type": "row"
}, },
@ -46,16 +82,12 @@
"bars": false, "bars": false,
"dashLength": 10, "dashLength": 10,
"dashes": false, "dashes": false,
"datasource": "InfluxDB-sysmon", "datasource": "${DS_INFLUXDB-SYSMON}",
"description": "", "description": "",
"fieldConfig": {
"defaults": {},
"overrides": []
},
"fill": 1, "fill": 1,
"fillGradient": 0, "fillGradient": 0,
"gridPos": { "gridPos": {
"h": 7, "h": 10,
"w": 10, "w": 10,
"x": 0, "x": 0,
"y": 1 "y": 1
@ -78,17 +110,10 @@
"alertThreshold": true "alertThreshold": true
}, },
"percentage": false, "percentage": false,
"pluginVersion": "7.5.2", "pluginVersion": "8.0.0",
"pointradius": 2, "pointradius": 2,
"points": false, "points": false,
"renderer": "flot", "renderer": "flot",
"scopedVars": {
"hostname": {
"selected": true,
"text": "S824Rhel71le",
"value": "S824Rhel71le"
}
},
"seriesOverrides": [], "seriesOverrides": [],
"spaceLength": 10, "spaceLength": 10,
"stack": true, "stack": true,
@ -275,7 +300,7 @@
} }
}, },
{ {
"datasource": "InfluxDB-sysmon", "datasource": "${DS_INFLUXDB-SYSMON}",
"description": "", "description": "",
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
@ -349,7 +374,7 @@
] ]
}, },
"gridPos": { "gridPos": {
"h": 7, "h": 3,
"w": 4, "w": 4,
"x": 10, "x": 10,
"y": 1 "y": 1
@ -370,14 +395,7 @@
"text": {}, "text": {},
"textMode": "value_and_name" "textMode": "value_and_name"
}, },
"pluginVersion": "7.5.2", "pluginVersion": "8.0.0",
"scopedVars": {
"hostname": {
"selected": true,
"text": "S824Rhel71le",
"value": "S824Rhel71le"
}
},
"targets": [ "targets": [
{ {
"groupBy": [ "groupBy": [
@ -484,11 +502,11 @@
], ],
"timeFrom": null, "timeFrom": null,
"timeShift": null, "timeShift": null,
"title": "LPAR Processor Details", "title": "Power LPAR Details",
"type": "stat" "type": "stat"
}, },
{ {
"datasource": "InfluxDB-sysmon", "datasource": "${DS_INFLUXDB-SYSMON}",
"description": "", "description": "",
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
@ -547,7 +565,7 @@
] ]
}, },
"gridPos": { "gridPos": {
"h": 7, "h": 10,
"w": 10, "w": 10,
"x": 14, "x": 14,
"y": 1 "y": 1
@ -568,14 +586,7 @@
"text": {}, "text": {},
"textMode": "auto" "textMode": "auto"
}, },
"pluginVersion": "7.5.2", "pluginVersion": "8.0.0",
"scopedVars": {
"hostname": {
"selected": true,
"text": "S824Rhel71le",
"value": "S824Rhel71le"
}
},
"targets": [ "targets": [
{ {
"groupBy": [ "groupBy": [
@ -664,15 +675,168 @@
], ],
"timeFrom": null, "timeFrom": null,
"timeShift": null, "timeShift": null,
"title": "LPAR Processor Usage", "title": "Power LPAR Processor Usage",
"type": "stat" "type": "stat"
}, },
{
"datasource": "${DS_INFLUXDB-SYSMON}",
"fieldConfig": {
"defaults": {
"color": {
"mode": "continuous-GrYlRd"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
},
"unit": "none"
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "disk.iotime"
},
"properties": [
{
"id": "displayName",
"value": "I/O Time"
},
{
"id": "unit",
"value": "ms"
}
]
},
{
"matcher": {
"id": "byName",
"options": "disk.queue"
},
"properties": [
{
"id": "displayName",
"value": "Queue"
},
{
"id": "unit",
"value": "none"
}
]
}
]
},
"gridPos": {
"h": 7,
"w": 4,
"x": 10,
"y": 4
},
"id": 19,
"options": {
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"showThresholdLabels": false,
"showThresholdMarkers": true,
"text": {}
},
"pluginVersion": "8.0.0",
"targets": [
{
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"linear"
],
"type": "fill"
}
],
"measurement": "disk",
"orderByTime": "ASC",
"policy": "default",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"iotime"
],
"type": "field"
},
{
"params": [],
"type": "last"
},
{
"params": [
"1s"
],
"type": "non_negative_derivative"
},
{
"params": [
"iotime"
],
"type": "alias"
}
],
[
{
"params": [
"queue"
],
"type": "field"
},
{
"params": [],
"type": "last"
},
{
"params": [
"queue"
],
"type": "alias"
}
]
],
"tags": [
{
"key": "hostname",
"operator": "=~",
"value": "/^$hostname$/"
}
]
}
],
"timeFrom": null,
"timeShift": null,
"title": "Disk Metrics",
"type": "gauge"
},
{ {
"aliasColors": {}, "aliasColors": {},
"bars": false, "bars": false,
"dashLength": 10, "dashLength": 10,
"dashes": false, "dashes": false,
"datasource": "InfluxDB-sysmon", "datasource": "${DS_INFLUXDB-SYSMON}",
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"unit": "bytes" "unit": "bytes"
@ -682,10 +846,10 @@
"fill": 1, "fill": 1,
"fillGradient": 0, "fillGradient": 0,
"gridPos": { "gridPos": {
"h": 7, "h": 10,
"w": 10, "w": 10,
"x": 0, "x": 0,
"y": 8 "y": 11
}, },
"hiddenSeries": false, "hiddenSeries": false,
"id": 8, "id": 8,
@ -705,17 +869,10 @@
"alertThreshold": true "alertThreshold": true
}, },
"percentage": false, "percentage": false,
"pluginVersion": "7.5.2", "pluginVersion": "8.0.0",
"pointradius": 2, "pointradius": 2,
"points": false, "points": false,
"renderer": "flot", "renderer": "flot",
"scopedVars": {
"hostname": {
"selected": true,
"text": "S824Rhel71le",
"value": "S824Rhel71le"
}
},
"seriesOverrides": [], "seriesOverrides": [],
"spaceLength": 10, "spaceLength": 10,
"stack": false, "stack": false,
@ -865,172 +1022,12 @@
"alignLevel": null "alignLevel": null
} }
}, },
{
"datasource": "InfluxDB-sysmon",
"fieldConfig": {
"defaults": {
"color": {
"mode": "continuous-GrYlRd"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
},
"unit": "none"
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "disk.iotime"
},
"properties": [
{
"id": "displayName",
"value": "I/O Time"
},
{
"id": "unit",
"value": "ms"
}
]
},
{
"matcher": {
"id": "byName",
"options": "disk.queue"
},
"properties": [
{
"id": "displayName",
"value": "Queue"
},
{
"id": "unit",
"value": "none"
}
]
}
]
},
"gridPos": {
"h": 7,
"w": 4,
"x": 10,
"y": 8
},
"id": 19,
"options": {
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"showThresholdLabels": false,
"showThresholdMarkers": true,
"text": {}
},
"pluginVersion": "7.5.2",
"scopedVars": {
"hostname": {
"selected": true,
"text": "S824Rhel71le",
"value": "S824Rhel71le"
}
},
"targets": [
{
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"linear"
],
"type": "fill"
}
],
"measurement": "disk",
"orderByTime": "ASC",
"policy": "default",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"iotime"
],
"type": "field"
},
{
"params": [],
"type": "last"
},
{
"params": [
"1s"
],
"type": "non_negative_derivative"
},
{
"params": [
"iotime"
],
"type": "alias"
}
],
[
{
"params": [
"queue"
],
"type": "field"
},
{
"params": [],
"type": "last"
},
{
"params": [
"queue"
],
"type": "alias"
}
]
],
"tags": [
{
"key": "hostname",
"operator": "=~",
"value": "/^$hostname$/"
}
]
}
],
"timeFrom": null,
"timeShift": null,
"title": "Disk Metrics",
"type": "gauge"
},
{ {
"aliasColors": {}, "aliasColors": {},
"bars": false, "bars": false,
"dashLength": 10, "dashLength": 10,
"dashes": false, "dashes": false,
"datasource": "InfluxDB-sysmon", "datasource": "${DS_INFLUXDB-SYSMON}",
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"unit": "binBps" "unit": "binBps"
@ -1040,10 +1037,10 @@
"fill": 1, "fill": 1,
"fillGradient": 0, "fillGradient": 0,
"gridPos": { "gridPos": {
"h": 7, "h": 10,
"w": 10, "w": 14,
"x": 14, "x": 10,
"y": 8 "y": 11
}, },
"hiddenSeries": false, "hiddenSeries": false,
"id": 10, "id": 10,
@ -1063,17 +1060,10 @@
"alertThreshold": true "alertThreshold": true
}, },
"percentage": false, "percentage": false,
"pluginVersion": "7.5.2", "pluginVersion": "8.0.0",
"pointradius": 2, "pointradius": 2,
"points": false, "points": false,
"renderer": "flot", "renderer": "flot",
"scopedVars": {
"hostname": {
"selected": true,
"text": "S824Rhel71le",
"value": "S824Rhel71le"
}
},
"seriesOverrides": [], "seriesOverrides": [],
"spaceLength": 10, "spaceLength": 10,
"stack": false, "stack": false,
@ -1204,7 +1194,7 @@
"bars": false, "bars": false,
"dashLength": 10, "dashLength": 10,
"dashes": false, "dashes": false,
"datasource": "InfluxDB-sysmon", "datasource": "${DS_INFLUXDB-SYSMON}",
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"unit": "binBps" "unit": "binBps"
@ -1214,10 +1204,10 @@
"fill": 1, "fill": 1,
"fillGradient": 0, "fillGradient": 0,
"gridPos": { "gridPos": {
"h": 7, "h": 11,
"w": 10, "w": 10,
"x": 0, "x": 0,
"y": 15 "y": 21
}, },
"hiddenSeries": false, "hiddenSeries": false,
"id": 18, "id": 18,
@ -1237,17 +1227,10 @@
"alertThreshold": true "alertThreshold": true
}, },
"percentage": false, "percentage": false,
"pluginVersion": "7.5.2", "pluginVersion": "8.0.0",
"pointradius": 2, "pointradius": 2,
"points": false, "points": false,
"renderer": "flot", "renderer": "flot",
"scopedVars": {
"hostname": {
"selected": true,
"text": "S824Rhel71le",
"value": "S824Rhel71le"
}
},
"seriesOverrides": [], "seriesOverrides": [],
"spaceLength": 10, "spaceLength": 10,
"stack": false, "stack": false,
@ -1374,271 +1357,8 @@
} }
}, },
{ {
"datasource": "InfluxDB-sysmon", "datasource": "${DS_INFLUXDB-SYSMON}",
"fieldConfig": { "description": "",
"defaults": {
"color": {
"mode": "continuous-GrYlRd"
},
"decimals": 2,
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
},
"unit": "none"
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "network_netstat.tcp_connections"
},
"properties": [
{
"id": "displayName",
"value": "TCP Connections"
}
]
},
{
"matcher": {
"id": "byName",
"options": "network_netstat.tcp_pkts_recv"
},
"properties": [
{
"id": "displayName",
"value": "TCP Segments Recv."
}
]
},
{
"matcher": {
"id": "byName",
"options": "network_netstat.tcp_pkts_sent"
},
"properties": [
{
"id": "displayName",
"value": "TCP Segments Sent"
}
]
},
{
"matcher": {
"id": "byName",
"options": "network_netstat.udp_pkts_recv"
},
"properties": [
{
"id": "displayName",
"value": "UDP Datagrams Recv."
}
]
},
{
"matcher": {
"id": "byName",
"options": "network_netstat.udp_pkts_sent"
},
"properties": [
{
"id": "displayName",
"value": "UDP Datagrams Sent"
}
]
}
]
},
"gridPos": {
"h": 7,
"w": 7,
"x": 10,
"y": 15
},
"id": 21,
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"text": {},
"textMode": "auto"
},
"pluginVersion": "7.5.2",
"scopedVars": {
"hostname": {
"selected": true,
"text": "S824Rhel71le",
"value": "S824Rhel71le"
}
},
"targets": [
{
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"linear"
],
"type": "fill"
}
],
"measurement": "network_netstat",
"orderByTime": "ASC",
"policy": "default",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"tcp_connections"
],
"type": "field"
},
{
"params": [],
"type": "last"
},
{
"params": [
"tcp_connections"
],
"type": "alias"
}
],
[
{
"params": [
"tcp_pkts_recv"
],
"type": "field"
},
{
"params": [],
"type": "mean"
},
{
"params": [
"1s"
],
"type": "non_negative_derivative"
},
{
"params": [
"tcp_pkts_recv"
],
"type": "alias"
}
],
[
{
"params": [
"tcp_pkts_sent"
],
"type": "field"
},
{
"params": [],
"type": "mean"
},
{
"params": [
"1s"
],
"type": "non_negative_derivative"
},
{
"params": [
"tcp_pkts_sent"
],
"type": "alias"
}
],
[
{
"params": [
"udp_pkts_recv"
],
"type": "field"
},
{
"params": [],
"type": "mean"
},
{
"params": [
"1s"
],
"type": "non_negative_derivative"
},
{
"params": [
"udp_pkts_recv"
],
"type": "alias"
}
],
[
{
"params": [
"udp_pkts_sent"
],
"type": "field"
},
{
"params": [],
"type": "mean"
},
{
"params": [
"1s"
],
"type": "non_negative_derivative"
},
{
"params": [
"udp_pkts_sent"
],
"type": "alias"
}
]
],
"tags": [
{
"key": "hostname",
"operator": "=~",
"value": "/^$hostname$/"
}
]
}
],
"timeFrom": null,
"timeShift": null,
"title": "Network Statistics",
"type": "stat"
},
{
"datasource": "InfluxDB-sysmon",
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"color": { "color": {
@ -1756,10 +1476,10 @@
] ]
}, },
"gridPos": { "gridPos": {
"h": 7, "h": 11,
"w": 7, "w": 14,
"x": 17, "x": 10,
"y": 15 "y": 21
}, },
"id": 22, "id": 22,
"options": { "options": {
@ -1777,14 +1497,7 @@
"text": {}, "text": {},
"textMode": "auto" "textMode": "auto"
}, },
"pluginVersion": "7.5.2", "pluginVersion": "8.0.0",
"scopedVars": {
"hostname": {
"selected": true,
"text": "S824Rhel71le",
"value": "S824Rhel71le"
}
},
"targets": [ "targets": [
{ {
"groupBy": [ "groupBy": [
@ -1963,29 +1676,20 @@
], ],
"timeFrom": null, "timeFrom": null,
"timeShift": null, "timeShift": null,
"title": "Network Sockets", "title": "Network Sockets (Linux)",
"type": "stat" "type": "stat"
} }
], ],
"refresh": "30s", "refresh": "30s",
"schemaVersion": 27, "schemaVersion": 30,
"style": "dark", "style": "dark",
"tags": [], "tags": [],
"templating": { "templating": {
"list": [ "list": [
{ {
"allValue": null, "allValue": null,
"current": { "current": {},
"selected": true, "datasource": "${DS_INFLUXDB-SYSMON}",
"tags": [],
"text": [
"S824Rhel71le"
],
"value": [
"S824Rhel71le"
]
},
"datasource": "InfluxDB-sysmon",
"definition": "SHOW TAG VALUES FROM \"processor\" WITH KEY = \"hostname\" WHERE time > now() - 24h", "definition": "SHOW TAG VALUES FROM \"processor\" WITH KEY = \"hostname\" WHERE time > now() - 24h",
"description": null, "description": null,
"error": null, "error": null,
@ -2001,7 +1705,6 @@
"skipUrlSync": false, "skipUrlSync": false,
"sort": 0, "sort": 0,
"tagValuesQuery": "", "tagValuesQuery": "",
"tags": [],
"tagsQuery": "", "tagsQuery": "",
"type": "query", "type": "query",
"useTags": false "useTags": false
@ -2027,7 +1730,7 @@
] ]
}, },
"timezone": "", "timezone": "",
"title": "Sysmon-Example", "title": "Sysmon Agent",
"uid": "QkVPjseMk", "uid": "QkVPjseMk",
"version": 25 "version": 30
} }

View file

@ -1,4 +1,4 @@
version=0.0.2 version=0.0.3
pf4jVersion=3.6.0 pf4jVersion=3.6.0
slf4jVersion=1.7.30 slf4jVersion=1.7.30
camelVersion=3.7.4 camelVersion=3.7.4

View file

@ -12,7 +12,8 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.Map; import java.util.Map;
@Extension // Disabled
//@Extension
public class AixNetstatExtension implements MetricExtension { public class AixNetstatExtension implements MetricExtension {
private static final Logger log = LoggerFactory.getLogger(AixNetstatExtension.class); private static final Logger log = LoggerFactory.getLogger(AixNetstatExtension.class);

View file

@ -19,22 +19,13 @@ public class BaseDiskExtension implements MetricExtension {
private static final Logger log = LoggerFactory.getLogger(BaseDiskExtension.class); private static final Logger log = LoggerFactory.getLogger(BaseDiskExtension.class);
private SystemInfo systemInfo;
private HardwareAbstractionLayer hardwareAbstractionLayer; private HardwareAbstractionLayer hardwareAbstractionLayer;
@Override @Override
public boolean isSupported() { public boolean isSupported() {
hardwareAbstractionLayer = BasePlugin.getHardwareAbstractionLayer();
try { return hardwareAbstractionLayer != null;
systemInfo = new SystemInfo();
hardwareAbstractionLayer = systemInfo.getHardware();
return true;
} catch (UnsupportedOperationException e) {
log.warn(e.getMessage());
}
return false;
} }
@Override @Override

View file

@ -17,21 +17,12 @@ public class BaseMemoryExtension implements MetricExtension {
private static final Logger log = LoggerFactory.getLogger(BaseMemoryExtension.class); private static final Logger log = LoggerFactory.getLogger(BaseMemoryExtension.class);
private SystemInfo systemInfo;
private HardwareAbstractionLayer hardwareAbstractionLayer; private HardwareAbstractionLayer hardwareAbstractionLayer;
@Override @Override
public boolean isSupported() { public boolean isSupported() {
hardwareAbstractionLayer = BasePlugin.getHardwareAbstractionLayer();
try { return hardwareAbstractionLayer != null;
systemInfo = new SystemInfo();
hardwareAbstractionLayer = systemInfo.getHardware();
return true;
} catch (UnsupportedOperationException e) {
log.warn(e.getMessage());
}
return false;
} }
@Override @Override

View file

@ -19,21 +19,12 @@ public class BaseNetworkExtension implements MetricExtension {
private static final Logger log = LoggerFactory.getLogger(BaseNetworkExtension.class); private static final Logger log = LoggerFactory.getLogger(BaseNetworkExtension.class);
private SystemInfo systemInfo;
private HardwareAbstractionLayer hardwareAbstractionLayer; private HardwareAbstractionLayer hardwareAbstractionLayer;
@Override @Override
public boolean isSupported() { public boolean isSupported() {
hardwareAbstractionLayer = BasePlugin.getHardwareAbstractionLayer();
try { return hardwareAbstractionLayer != null;
systemInfo = new SystemInfo();
hardwareAbstractionLayer = systemInfo.getHardware();
return true;
} catch (UnsupportedOperationException e) {
log.warn(e.getMessage());
}
return false;
} }
@Override @Override

View file

@ -4,14 +4,36 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.pf4j.Plugin; import org.pf4j.Plugin;
import org.pf4j.PluginWrapper; import org.pf4j.PluginWrapper;
import oshi.SystemInfo;
import oshi.hardware.HardwareAbstractionLayer;
public class BasePlugin extends Plugin { public class BasePlugin extends Plugin {
private static final Logger log = LoggerFactory.getLogger(BasePlugin.class); private static final Logger log = LoggerFactory.getLogger(BasePlugin.class);
private static SystemInfo systemInfo;
private static HardwareAbstractionLayer hardwareAbstractionLayer;
public BasePlugin(PluginWrapper wrapper) { public BasePlugin(PluginWrapper wrapper) {
super(wrapper); super(wrapper);
} }
public static HardwareAbstractionLayer getHardwareAbstractionLayer() {
try {
if(systemInfo == null) {
systemInfo = new SystemInfo();
}
if(hardwareAbstractionLayer == null) {
hardwareAbstractionLayer = systemInfo.getHardware();
}
} catch (UnsupportedOperationException e) {
log.warn(e.getMessage());
}
return hardwareAbstractionLayer;
}
} }

View file

@ -24,22 +24,13 @@ public class BaseProcessorExtension implements MetricExtension {
private static final Logger log = LoggerFactory.getLogger(BaseProcessorExtension.class); private static final Logger log = LoggerFactory.getLogger(BaseProcessorExtension.class);
private SystemInfo systemInfo;
private HardwareAbstractionLayer hardwareAbstractionLayer; private HardwareAbstractionLayer hardwareAbstractionLayer;
private long[] oldTicks; private long[] oldTicks;
@Override @Override
public boolean isSupported() { public boolean isSupported() {
hardwareAbstractionLayer = BasePlugin.getHardwareAbstractionLayer();
try { return hardwareAbstractionLayer != null;
systemInfo = new SystemInfo();
hardwareAbstractionLayer = systemInfo.getHardware();
return true;
} catch (UnsupportedOperationException e) {
log.warn(e.getMessage());
}
return false;
} }
@Override @Override

View file

@ -12,7 +12,8 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.Map; import java.util.Map;
@Extension // Disabled
//@Extension
public class LinuxNetstatExtension implements MetricExtension { public class LinuxNetstatExtension implements MetricExtension {
private static final Logger log = LoggerFactory.getLogger(LinuxNetstatExtension.class); private static final Logger log = LoggerFactory.getLogger(LinuxNetstatExtension.class);