Small improvements and bump to version 1.0.22
This commit is contained in:
parent
56c47fa1fb
commit
8b82af339a
|
@ -2,6 +2,11 @@
|
||||||
|
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
## [1.0.22] - 2022-11-07
|
||||||
|
- Update dashboards.
|
||||||
|
- Lower default interval for most plugins.
|
||||||
|
- Simplify metrics-results to influx points code.
|
||||||
|
|
||||||
## [1.0.21] - 2022-10-30
|
## [1.0.21] - 2022-10-30
|
||||||
- Update dashboard
|
- Update dashboard
|
||||||
- Add IP connections
|
- Add IP connections
|
||||||
|
@ -30,7 +35,8 @@ All notable changes to this project will be documented in this file.
|
||||||
### Changed
|
### Changed
|
||||||
- Updated 3rd party dependencies.
|
- Updated 3rd party dependencies.
|
||||||
|
|
||||||
[1.0.19]: https://bitbucket.org/mnellemann/sysmon/branches/compare/v1.0.21%0Dv0.1.18
|
[1.0.22]: https://bitbucket.org/mnellemann/sysmon/branches/compare/v1.0.22%0Dv0.1.21
|
||||||
|
[1.0.21]: https://bitbucket.org/mnellemann/sysmon/branches/compare/v1.0.21%0Dv0.1.18
|
||||||
[1.0.18]: https://bitbucket.org/mnellemann/sysmon/branches/compare/v1.0.18%0Dv0.1.13
|
[1.0.18]: https://bitbucket.org/mnellemann/sysmon/branches/compare/v1.0.18%0Dv0.1.13
|
||||||
[0.1.13]: https://bitbucket.org/mnellemann/sysmon/branches/compare/v0.1.13%0Dv0.1.11
|
[0.1.13]: https://bitbucket.org/mnellemann/sysmon/branches/compare/v0.1.13%0Dv0.1.11
|
||||||
[0.1.11]: https://bitbucket.org/mnellemann/sysmon/branches/compare/v0.1.11%0Dv0.1.10
|
[0.1.11]: https://bitbucket.org/mnellemann/sysmon/branches/compare/v0.1.11%0Dv0.1.10
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
###
|
###
|
||||||
### Sysmon Client
|
### Sysmon Client
|
||||||
###
|
###
|
||||||
### Example configuration with default values.
|
### Example configuration with some default values.
|
||||||
###
|
###
|
||||||
|
|
||||||
[extension.base_info]
|
[extension.base_info]
|
||||||
|
@ -10,14 +10,17 @@ interval = '60m'
|
||||||
|
|
||||||
[extension.base_disk]
|
[extension.base_disk]
|
||||||
enabled = true
|
enabled = true
|
||||||
|
interval = '10s'
|
||||||
|
|
||||||
[extension.base_filesystem]
|
[extension.base_filesystem]
|
||||||
enabled = true
|
enabled = true
|
||||||
|
interval = '10s'
|
||||||
exclude_type = [ "tmpfs", "ahafs" ]
|
exclude_type = [ "tmpfs", "ahafs" ]
|
||||||
exclude_mount = [ "/boot/efi" ]
|
exclude_mount = [ "/boot/efi" ]
|
||||||
|
|
||||||
[extension.base_process]
|
[extension.base_process]
|
||||||
enabled = true
|
enabled = true
|
||||||
|
interval = '5m'
|
||||||
include = [
|
include = [
|
||||||
"java", "node", "httpd", "mongod", "mysqld",
|
"java", "node", "httpd", "mongod", "mysqld",
|
||||||
"postgres", "influxd", "haproxy", "beam.smp",
|
"postgres", "influxd", "haproxy", "beam.smp",
|
||||||
|
|
|
@ -29,8 +29,8 @@ public class ClientRouteBuilder extends RouteBuilder {
|
||||||
Registry registry = getContext().getRegistry();
|
Registry registry = getContext().getRegistry();
|
||||||
Configuration configuration = (Configuration) registry.lookupByName("configuration");
|
Configuration configuration = (Configuration) registry.lookupByName("configuration");
|
||||||
|
|
||||||
Path[] pluginpaths = { Paths.get(registry.lookupByNameAndType("pluginPath", String.class)) };
|
Path[] pluginPaths = { Paths.get(registry.lookupByNameAndType("pluginPath", String.class)) };
|
||||||
PluginManager pluginManager = new JarPluginManager(pluginpaths);
|
PluginManager pluginManager = new JarPluginManager(pluginPaths);
|
||||||
pluginManager.loadPlugins();
|
pluginManager.loadPlugins();
|
||||||
pluginManager.startPlugins();
|
pluginManager.startPlugins();
|
||||||
|
|
||||||
|
@ -49,7 +49,6 @@ public class ClientRouteBuilder extends RouteBuilder {
|
||||||
|
|
||||||
if(ext.isSupported() && ext.isEnabled()) {
|
if(ext.isSupported() && ext.isEnabled()) {
|
||||||
|
|
||||||
// Check that another extension has not already been loaded - TODO: Is this required ?
|
|
||||||
if(providers.contains(provides)) {
|
if(providers.contains(provides)) {
|
||||||
log.warn("Skipping extension (already provided): " + ext.getName());
|
log.warn("Skipping extension (already provided): " + ext.getName());
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -908,7 +908,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"params": [
|
"params": [
|
||||||
"none"
|
"null"
|
||||||
],
|
],
|
||||||
"type": "fill"
|
"type": "fill"
|
||||||
}
|
}
|
||||||
|
@ -932,7 +932,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"params": [
|
"params": [
|
||||||
10
|
5
|
||||||
],
|
],
|
||||||
"type": "moving_average"
|
"type": "moving_average"
|
||||||
},
|
},
|
||||||
|
@ -956,7 +956,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"params": [
|
"params": [
|
||||||
10
|
5
|
||||||
],
|
],
|
||||||
"type": "moving_average"
|
"type": "moving_average"
|
||||||
},
|
},
|
||||||
|
@ -980,7 +980,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"params": [
|
"params": [
|
||||||
10
|
5
|
||||||
],
|
],
|
||||||
"type": "moving_average"
|
"type": "moving_average"
|
||||||
},
|
},
|
||||||
|
@ -1004,7 +1004,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"params": [
|
"params": [
|
||||||
10
|
5
|
||||||
],
|
],
|
||||||
"type": "moving_average"
|
"type": "moving_average"
|
||||||
},
|
},
|
||||||
|
@ -1028,7 +1028,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"params": [
|
"params": [
|
||||||
10
|
5
|
||||||
],
|
],
|
||||||
"type": "moving_average"
|
"type": "moving_average"
|
||||||
},
|
},
|
||||||
|
@ -1052,7 +1052,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"params": [
|
"params": [
|
||||||
10
|
5
|
||||||
],
|
],
|
||||||
"type": "moving_average"
|
"type": "moving_average"
|
||||||
},
|
},
|
||||||
|
@ -1169,7 +1169,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"params": [
|
"params": [
|
||||||
"none"
|
"null"
|
||||||
],
|
],
|
||||||
"type": "fill"
|
"type": "fill"
|
||||||
}
|
}
|
||||||
|
@ -1189,13 +1189,11 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"params": [],
|
"params": [],
|
||||||
"type": "mean"
|
"type": "last"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"params": [
|
"params": [],
|
||||||
"1s"
|
"type": "non_negative_difference"
|
||||||
],
|
|
||||||
"type": "non_negative_derivative"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"params": [
|
"params": [
|
||||||
|
@ -1213,13 +1211,11 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"params": [],
|
"params": [],
|
||||||
"type": "mean"
|
"type": "last"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"params": [
|
"params": [],
|
||||||
"10s"
|
"type": "non_negative_difference"
|
||||||
],
|
|
||||||
"type": "non_negative_derivative"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"params": [
|
"params": [
|
||||||
|
@ -1536,7 +1532,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"params": [
|
"params": [
|
||||||
"none"
|
"null"
|
||||||
],
|
],
|
||||||
"type": "fill"
|
"type": "fill"
|
||||||
}
|
}
|
||||||
|
@ -1560,16 +1556,14 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"params": [
|
"params": [
|
||||||
"1s"
|
5
|
||||||
],
|
|
||||||
"type": "non_negative_derivative"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"params": [
|
|
||||||
10
|
|
||||||
],
|
],
|
||||||
"type": "moving_average"
|
"type": "moving_average"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"params": [],
|
||||||
|
"type": "non_negative_difference"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"params": [
|
"params": [
|
||||||
"read"
|
"read"
|
||||||
|
@ -1696,7 +1690,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"params": [
|
"params": [
|
||||||
"none"
|
"null"
|
||||||
],
|
],
|
||||||
"type": "fill"
|
"type": "fill"
|
||||||
}
|
}
|
||||||
|
@ -1720,16 +1714,14 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"params": [
|
"params": [
|
||||||
"1s"
|
5
|
||||||
],
|
|
||||||
"type": "non_negative_derivative"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"params": [
|
|
||||||
10
|
|
||||||
],
|
],
|
||||||
"type": "moving_average"
|
"type": "moving_average"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"params": [],
|
||||||
|
"type": "non_negative_difference"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"params": [
|
"params": [
|
||||||
"write"
|
"write"
|
||||||
|
@ -1851,7 +1843,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"params": [
|
"params": [
|
||||||
"none"
|
"null"
|
||||||
],
|
],
|
||||||
"type": "fill"
|
"type": "fill"
|
||||||
}
|
}
|
||||||
|
@ -1875,16 +1867,14 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"params": [
|
"params": [
|
||||||
"1s"
|
5
|
||||||
],
|
|
||||||
"type": "non_negative_derivative"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"params": [
|
|
||||||
10
|
|
||||||
],
|
],
|
||||||
"type": "moving_average"
|
"type": "moving_average"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"params": [],
|
||||||
|
"type": "non_negative_difference"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"params": [
|
"params": [
|
||||||
"rx"
|
"rx"
|
||||||
|
@ -2006,7 +1996,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"params": [
|
"params": [
|
||||||
"none"
|
"null"
|
||||||
],
|
],
|
||||||
"type": "fill"
|
"type": "fill"
|
||||||
}
|
}
|
||||||
|
@ -2030,9 +2020,13 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"params": [
|
"params": [
|
||||||
"1s"
|
5
|
||||||
],
|
],
|
||||||
"type": "non_negative_derivative"
|
"type": "moving_average"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"params": [],
|
||||||
|
"type": "non_negative_difference"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"params": [
|
"params": [
|
||||||
|
@ -2238,6 +2232,10 @@
|
||||||
"params": [],
|
"params": [],
|
||||||
"type": "mean"
|
"type": "mean"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"params": [],
|
||||||
|
"type": "non_negative_difference"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"params": [
|
"params": [
|
||||||
"ip_conn"
|
"ip_conn"
|
||||||
|
@ -2348,6 +2346,10 @@
|
||||||
"params": [],
|
"params": [],
|
||||||
"type": "non_negative_difference"
|
"type": "non_negative_difference"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"params": [],
|
||||||
|
"type": "non_negative_difference"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"params": [
|
"params": [
|
||||||
"udp4_recv"
|
"udp4_recv"
|
||||||
|
@ -2693,7 +2695,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"params": [],
|
"params": [],
|
||||||
"type": "last"
|
"type": "mean"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
@ -3107,12 +3109,13 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"time": {
|
"time": {
|
||||||
"from": "now-2d",
|
"from": "now-24h",
|
||||||
"to": "now-30s"
|
"to": "now-10s"
|
||||||
},
|
},
|
||||||
"timepicker": {
|
"timepicker": {
|
||||||
"nowDelay": "30s",
|
"nowDelay": "10s",
|
||||||
"refresh_intervals": [
|
"refresh_intervals": [
|
||||||
|
"10s",
|
||||||
"30s",
|
"30s",
|
||||||
"1m",
|
"1m",
|
||||||
"5m",
|
"5m",
|
||||||
|
@ -3126,6 +3129,6 @@
|
||||||
"timezone": "",
|
"timezone": "",
|
||||||
"title": "Sysmon - Host Overview",
|
"title": "Sysmon - Host Overview",
|
||||||
"uid": "QkVPjseMt",
|
"uid": "QkVPjseMt",
|
||||||
"version": 9,
|
"version": 15,
|
||||||
"weekStart": ""
|
"weekStart": ""
|
||||||
}
|
}
|
|
@ -15,7 +15,7 @@
|
||||||
"type": "grafana",
|
"type": "grafana",
|
||||||
"id": "grafana",
|
"id": "grafana",
|
||||||
"name": "Grafana",
|
"name": "Grafana",
|
||||||
"version": "9.1.3"
|
"version": "9.1.6"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "datasource",
|
"type": "datasource",
|
||||||
|
@ -82,7 +82,7 @@
|
||||||
"content": "## Metrics are collected by an agent running inside of each LPAR / VM / Host.\n \n For more information: [bitbucket.org/mnellemann/sysmon](https://bitbucket.org/mnellemann/sysmon)\n ",
|
"content": "## Metrics are collected by an agent running inside of each LPAR / VM / Host.\n \n For more information: [bitbucket.org/mnellemann/sysmon](https://bitbucket.org/mnellemann/sysmon)\n ",
|
||||||
"mode": "markdown"
|
"mode": "markdown"
|
||||||
},
|
},
|
||||||
"pluginVersion": "9.1.3",
|
"pluginVersion": "9.1.6",
|
||||||
"targets": [
|
"targets": [
|
||||||
{
|
{
|
||||||
"datasource": {
|
"datasource": {
|
||||||
|
@ -126,8 +126,8 @@
|
||||||
"scaleDistribution": {
|
"scaleDistribution": {
|
||||||
"type": "linear"
|
"type": "linear"
|
||||||
},
|
},
|
||||||
"showPoints": "never",
|
"showPoints": "auto",
|
||||||
"spanNulls": false,
|
"spanNulls": 3600000,
|
||||||
"stacking": {
|
"stacking": {
|
||||||
"group": "A",
|
"group": "A",
|
||||||
"mode": "none"
|
"mode": "none"
|
||||||
|
@ -196,7 +196,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"params": [
|
"params": [
|
||||||
"none"
|
"null"
|
||||||
],
|
],
|
||||||
"type": "fill"
|
"type": "fill"
|
||||||
}
|
}
|
||||||
|
@ -270,7 +270,7 @@
|
||||||
"type": "linear"
|
"type": "linear"
|
||||||
},
|
},
|
||||||
"showPoints": "auto",
|
"showPoints": "auto",
|
||||||
"spanNulls": false,
|
"spanNulls": 3600000,
|
||||||
"stacking": {
|
"stacking": {
|
||||||
"group": "A",
|
"group": "A",
|
||||||
"mode": "none"
|
"mode": "none"
|
||||||
|
@ -340,7 +340,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"params": [
|
"params": [
|
||||||
"none"
|
"null"
|
||||||
],
|
],
|
||||||
"type": "fill"
|
"type": "fill"
|
||||||
}
|
}
|
||||||
|
@ -408,7 +408,7 @@
|
||||||
"type": "linear"
|
"type": "linear"
|
||||||
},
|
},
|
||||||
"showPoints": "auto",
|
"showPoints": "auto",
|
||||||
"spanNulls": false,
|
"spanNulls": 3600000,
|
||||||
"stacking": {
|
"stacking": {
|
||||||
"group": "A",
|
"group": "A",
|
||||||
"mode": "none"
|
"mode": "none"
|
||||||
|
@ -478,7 +478,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"params": [
|
"params": [
|
||||||
"none"
|
"null"
|
||||||
],
|
],
|
||||||
"type": "fill"
|
"type": "fill"
|
||||||
}
|
}
|
||||||
|
@ -547,7 +547,7 @@
|
||||||
"type": "linear"
|
"type": "linear"
|
||||||
},
|
},
|
||||||
"showPoints": "auto",
|
"showPoints": "auto",
|
||||||
"spanNulls": false,
|
"spanNulls": 3600000,
|
||||||
"stacking": {
|
"stacking": {
|
||||||
"group": "A",
|
"group": "A",
|
||||||
"mode": "none"
|
"mode": "none"
|
||||||
|
@ -617,7 +617,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"params": [
|
"params": [
|
||||||
"none"
|
"null"
|
||||||
],
|
],
|
||||||
"type": "fill"
|
"type": "fill"
|
||||||
}
|
}
|
||||||
|
@ -690,11 +690,12 @@
|
||||||
},
|
},
|
||||||
"time": {
|
"time": {
|
||||||
"from": "now-7d",
|
"from": "now-7d",
|
||||||
"to": "now-30s"
|
"to": "now-10s"
|
||||||
},
|
},
|
||||||
"timepicker": {
|
"timepicker": {
|
||||||
"nowDelay": "30s",
|
"nowDelay": "10s",
|
||||||
"refresh_intervals": [
|
"refresh_intervals": [
|
||||||
|
"10s",
|
||||||
"30s",
|
"30s",
|
||||||
"1m",
|
"1m",
|
||||||
"5m",
|
"5m",
|
||||||
|
@ -706,8 +707,8 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"timezone": "",
|
"timezone": "",
|
||||||
"title": "Sysmon - Power Performance",
|
"title": "Sysmon - IBM Power",
|
||||||
"uid": "3zPCIbN4z",
|
"uid": "3zPCIbN4z",
|
||||||
"version": 7,
|
"version": 5,
|
||||||
"weekStart": ""
|
"weekStart": ""
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
version = 1.0.21
|
version = 1.0.22
|
||||||
pf4jVersion = 3.7.0
|
pf4jVersion = 3.7.0
|
||||||
slf4jVersion = 2.0.3
|
slf4jVersion = 2.0.3
|
||||||
camelVersion = 3.14.5
|
camelVersion = 3.14.5
|
||||||
|
|
|
@ -1,109 +0,0 @@
|
||||||
package sysmon.plugins.os_aix;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import sysmon.shared.Measurement;
|
|
||||||
import sysmon.shared.MetricExtension;
|
|
||||||
import sysmon.shared.MetricResult;
|
|
||||||
import sysmon.shared.PluginHelper;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
// Disabled
|
|
||||||
//@Extension
|
|
||||||
public class AixNetstatExtension implements MetricExtension {
|
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(AixNetstatExtension.class);
|
|
||||||
|
|
||||||
// Extension details
|
|
||||||
private final String name = "aix_network_netstat";
|
|
||||||
private final String provides = "network_netstat";
|
|
||||||
private final String description = "AIX Netstat Metrics";
|
|
||||||
|
|
||||||
// Configuration / Options
|
|
||||||
private boolean enabled = true;
|
|
||||||
private boolean threaded = false;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isEnabled() {
|
|
||||||
return enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isThreaded() {
|
|
||||||
return threaded;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isSupported() {
|
|
||||||
|
|
||||||
if(!System.getProperty("os.name").toLowerCase().contains("aix")) {
|
|
||||||
log.warn("Requires AIX.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(PluginHelper.notExecutable("netstat")) {
|
|
||||||
log.warn("Requires the 'netstat' command.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getInterval() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getProvides() {
|
|
||||||
return provides;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setConfiguration(Map<String, Object> map) {
|
|
||||||
if (map.containsKey("enabled")) {
|
|
||||||
enabled = (boolean) map.get("enabled");
|
|
||||||
}
|
|
||||||
if(map.containsKey("threaded")) {
|
|
||||||
threaded = (boolean) map.get("threaded");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public MetricResult getMetrics() throws Exception {
|
|
||||||
|
|
||||||
HashMap<String, String> tagsMap;
|
|
||||||
HashMap<String, Object> fieldsMap;
|
|
||||||
|
|
||||||
try (InputStream buf = PluginHelper.executeCommand("netstat -s -f inet")) {
|
|
||||||
AixNetstatParser parser = processCommandOutput(buf);
|
|
||||||
tagsMap = parser.getTags();
|
|
||||||
fieldsMap = parser.getFields();
|
|
||||||
}
|
|
||||||
|
|
||||||
log.debug(fieldsMap.toString());
|
|
||||||
return new MetricResult(name, new Measurement(tagsMap, fieldsMap));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
protected AixNetstatParser processCommandOutput(InputStream input) throws IOException {
|
|
||||||
return new AixNetstatParser(input);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,155 +0,0 @@
|
||||||
package sysmon.plugins.os_aix;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
public class AixNetstatParser {
|
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(AixNetstatParser.class);
|
|
||||||
|
|
||||||
private long ipTotalPacketsReceived;
|
|
||||||
private long ipForwarded;
|
|
||||||
|
|
||||||
private long tcpConnectionsEstablished;
|
|
||||||
private long tcpPacketsReceved;
|
|
||||||
private long tcpPacketsSent;
|
|
||||||
|
|
||||||
private long udpPacketsReceived;
|
|
||||||
private long udpPacketsSent;
|
|
||||||
|
|
||||||
|
|
||||||
public AixNetstatParser(InputStream inputStream) throws IOException {
|
|
||||||
|
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
|
|
||||||
while (reader.ready()) {
|
|
||||||
String line = reader.readLine();
|
|
||||||
log.debug("AixNetstatParser() - Line: " + line);
|
|
||||||
|
|
||||||
if(line.startsWith("tcp:")) {
|
|
||||||
parseTcp(reader);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(line.startsWith("udp:")) {
|
|
||||||
parseUdp(reader);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(line.startsWith("ip:")) {
|
|
||||||
parseIp(reader);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
inputStream.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
protected void parseIp(BufferedReader reader) throws IOException {
|
|
||||||
|
|
||||||
while (reader.ready()) {
|
|
||||||
reader.mark(64);
|
|
||||||
String line = reader.readLine();
|
|
||||||
|
|
||||||
if(!line.startsWith(" ")) {
|
|
||||||
reader.reset();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
line = line.trim();
|
|
||||||
|
|
||||||
if(line.matches("(\\d+) total packets received")) {
|
|
||||||
ipTotalPacketsReceived = getFirstLong(line);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(line.matches("(\\d+) packets forwarded")) {
|
|
||||||
ipForwarded = getFirstLong(line);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
protected void parseTcp(BufferedReader reader) throws IOException {
|
|
||||||
|
|
||||||
while (reader.ready()) {
|
|
||||||
reader.mark(64);
|
|
||||||
String line = reader.readLine();
|
|
||||||
|
|
||||||
if(!line.startsWith(" ")) {
|
|
||||||
reader.reset();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
line = line.trim();
|
|
||||||
|
|
||||||
if(line.matches("(\\d+) connections established \\(including accepts\\)")) {
|
|
||||||
tcpConnectionsEstablished = getFirstLong(line);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(line.matches("(\\d+) packets received")) {
|
|
||||||
tcpPacketsReceved = getFirstLong(line);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(line.matches("(\\d+) packets sent")) {
|
|
||||||
tcpPacketsSent = getFirstLong(line);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void parseUdp(BufferedReader reader) throws IOException {
|
|
||||||
|
|
||||||
while (reader.ready()) {
|
|
||||||
reader.mark(64);
|
|
||||||
String line = reader.readLine();
|
|
||||||
|
|
||||||
if(!line.startsWith(" ")) {
|
|
||||||
reader.reset();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
line = line.trim();
|
|
||||||
|
|
||||||
if(line.matches("(\\d+) datagrams received")) {
|
|
||||||
udpPacketsReceived = getFirstLong(line);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(line.matches("(\\d+) datagrams output")) {
|
|
||||||
udpPacketsSent = getFirstLong(line);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public HashMap<String, String> getTags() {
|
|
||||||
return new HashMap<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public HashMap<String, Object> getFields() {
|
|
||||||
HashMap<String, Object> fields = new HashMap<>();
|
|
||||||
fields.put("ip_forwarded", ipForwarded);
|
|
||||||
fields.put("ip_received", ipTotalPacketsReceived);
|
|
||||||
|
|
||||||
fields.put("tcp_connections", tcpConnectionsEstablished);
|
|
||||||
fields.put("tcp_pkts_recv", tcpPacketsReceved);
|
|
||||||
fields.put("tcp_pkts_sent", tcpPacketsSent);
|
|
||||||
|
|
||||||
fields.put("udp_pkts_recv", udpPacketsReceived);
|
|
||||||
fields.put("udp_pkts_sent", udpPacketsSent);
|
|
||||||
|
|
||||||
return fields;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Long getFirstLong(String line) {
|
|
||||||
return Long.parseLong(line.substring(0, line.indexOf(" ")));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -12,6 +12,7 @@ import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
|
||||||
@Extension
|
@Extension
|
||||||
public class AixProcessorExtension implements MetricExtension {
|
public class AixProcessorExtension implements MetricExtension {
|
||||||
|
@ -26,7 +27,7 @@ public class AixProcessorExtension implements MetricExtension {
|
||||||
// Configuration / Options
|
// Configuration / Options
|
||||||
private boolean enabled = true;
|
private boolean enabled = true;
|
||||||
private boolean threaded = true;
|
private boolean threaded = true;
|
||||||
|
private String interval = "10s";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isEnabled() {
|
public boolean isEnabled() {
|
||||||
|
@ -62,7 +63,7 @@ public class AixProcessorExtension implements MetricExtension {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getInterval() {
|
public String getInterval() {
|
||||||
return null;
|
return interval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -83,13 +84,16 @@ public class AixProcessorExtension implements MetricExtension {
|
||||||
if(map.containsKey("threaded")) {
|
if(map.containsKey("threaded")) {
|
||||||
threaded = (boolean) map.get("threaded");
|
threaded = (boolean) map.get("threaded");
|
||||||
}
|
}
|
||||||
|
if(map.containsKey("interval")) {
|
||||||
|
interval = (String) map.get("interval");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MetricResult getMetrics() throws Exception {
|
public MetricResult getMetrics() throws Exception {
|
||||||
|
|
||||||
HashMap<String, String> tagsMap = null;
|
TreeMap<String, String> tagsMap = null;
|
||||||
HashMap<String, Object> fieldsMap = null;
|
TreeMap<String, Object> fieldsMap = null;
|
||||||
|
|
||||||
try (InputStream buf = PluginHelper.executeCommand("lparstat 3 1")) {
|
try (InputStream buf = PluginHelper.executeCommand("lparstat 3 1")) {
|
||||||
AixProcessorStat processorStat = processCommandOutput(buf);
|
AixProcessorStat processorStat = processCommandOutput(buf);
|
||||||
|
|
|
@ -10,6 +10,7 @@ import java.io.InputStreamReader;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.TreeMap;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
@ -154,12 +155,12 @@ public class AixProcessorStat {
|
||||||
return 100 - idle;
|
return 100 - idle;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HashMap<String, String> getTags() {
|
public TreeMap<String, String> getTags() {
|
||||||
return new HashMap<>();
|
return new TreeMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public HashMap<String, Object> getFields() {
|
public TreeMap<String, Object> getFields() {
|
||||||
return new HashMap<String, Object>() {{
|
return new TreeMap<String, Object>() {{
|
||||||
put("lcpu", lcpu);
|
put("lcpu", lcpu);
|
||||||
put("ent", ent);
|
put("ent", ent);
|
||||||
put("user", user);
|
put("user", user);
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
import spock.lang.Specification
|
|
||||||
import sysmon.plugins.os_aix.AixNetstatParser
|
|
||||||
|
|
||||||
class AixNetstatTest extends Specification {
|
|
||||||
|
|
||||||
void "test netstat parsing"() {
|
|
||||||
|
|
||||||
setup:
|
|
||||||
InputStream inputStream = getClass().getResourceAsStream('/netstat-aix.txt')
|
|
||||||
|
|
||||||
when:
|
|
||||||
AixNetstatParser parser = new AixNetstatParser(inputStream)
|
|
||||||
|
|
||||||
then:
|
|
||||||
parser.getFields().size() > 0
|
|
||||||
parser.getFields().get('ip_received') == 76229L
|
|
||||||
parser.getFields().get('ip_forwarded') == 24L
|
|
||||||
parser.getFields().get('tcp_connections') == 85L
|
|
||||||
parser.getFields().get('tcp_pkts_sent') == 31274L
|
|
||||||
parser.getFields().get('tcp_pkts_recv') == 39830L
|
|
||||||
parser.getFields().get('udp_pkts_sent') == 26332L
|
|
||||||
parser.getFields().get('udp_pkts_recv') == 34559L
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,157 +0,0 @@
|
||||||
icmp:
|
|
||||||
12 calls to icmp_error
|
|
||||||
0 errors not generated because old message was icmp
|
|
||||||
Output histogram:
|
|
||||||
destination unreachable: 12
|
|
||||||
0 messages with bad code fields
|
|
||||||
0 messages < minimum length
|
|
||||||
0 bad checksums
|
|
||||||
0 messages with bad length
|
|
||||||
Input histogram:
|
|
||||||
destination unreachable: 3
|
|
||||||
0 message responses generated
|
|
||||||
igmp:
|
|
||||||
0 messages received
|
|
||||||
0 messages received with too few bytes
|
|
||||||
0 messages received with bad checksum
|
|
||||||
0 membership queries received
|
|
||||||
0 membership queries received with invalid field(s)
|
|
||||||
0 membership reports received
|
|
||||||
0 membership reports received with invalid field(s)
|
|
||||||
0 membership reports received for groups to which we belong
|
|
||||||
2 membership reports sent
|
|
||||||
tcp:
|
|
||||||
31274 packets sent
|
|
||||||
27328 data packets (82928168 bytes)
|
|
||||||
86 data packets (108992 bytes) retransmitted
|
|
||||||
2938 ack-only packets (2698 delayed)
|
|
||||||
0 URG only packets
|
|
||||||
0 window probe packets
|
|
||||||
784 window update packets
|
|
||||||
138 control packets
|
|
||||||
3812 large sends
|
|
||||||
74913716 bytes sent using largesend
|
|
||||||
64069 bytes is the biggest largesend
|
|
||||||
39830 packets received
|
|
||||||
22701 acks (for 82928732 bytes)
|
|
||||||
112 duplicate acks
|
|
||||||
0 acks for unsent data
|
|
||||||
15579 packets (5876585 bytes) received in-sequence
|
|
||||||
62 completely duplicate packets (320 bytes)
|
|
||||||
57 old duplicate packets
|
|
||||||
0 packets with some dup. data (0 bytes duped)
|
|
||||||
75 out-of-order packets (6408 bytes)
|
|
||||||
0 packets (0 bytes) of data after window
|
|
||||||
0 window probes
|
|
||||||
1723 window update packets
|
|
||||||
0 packets received after close
|
|
||||||
0 packets with bad hardware assisted checksum
|
|
||||||
0 discarded for bad checksums
|
|
||||||
0 discarded for bad header offset fields
|
|
||||||
0 discarded because packet too short
|
|
||||||
1 discarded by listeners
|
|
||||||
0 discarded due to listener's queue full
|
|
||||||
3207 ack packet headers correctly predicted
|
|
||||||
15050 data packet headers correctly predicted
|
|
||||||
63 connection requests
|
|
||||||
23 connection accepts
|
|
||||||
85 connections established (including accepts)
|
|
||||||
114 connections closed (including 0 drops)
|
|
||||||
0 connections with ECN capability
|
|
||||||
0 times responded to ECN
|
|
||||||
0 embryonic connections dropped
|
|
||||||
20314 segments updated rtt (of 16791 attempts)
|
|
||||||
0 segments with congestion window reduced bit set
|
|
||||||
0 segments with congestion experienced bit set
|
|
||||||
0 resends due to path MTU discovery
|
|
||||||
2 path MTU discovery terminations due to retransmits
|
|
||||||
25 retransmit timeouts
|
|
||||||
0 connections dropped by rexmit timeout
|
|
||||||
4 fast retransmits
|
|
||||||
1 when congestion window less than 4 segments
|
|
||||||
28 newreno retransmits
|
|
||||||
4 times avoided false fast retransmits
|
|
||||||
0 persist timeouts
|
|
||||||
0 connections dropped due to persist timeout
|
|
||||||
0 keepalive timeouts
|
|
||||||
0 keepalive probes sent
|
|
||||||
0 connections dropped by keepalive
|
|
||||||
0 times SACK blocks array is extended
|
|
||||||
0 times SACK holes array is extended
|
|
||||||
0 packets dropped due to memory allocation failure
|
|
||||||
0 connections in timewait reused
|
|
||||||
0 delayed ACKs for SYN
|
|
||||||
0 delayed ACKs for FIN
|
|
||||||
0 send_and_disconnects
|
|
||||||
0 spliced connections
|
|
||||||
0 spliced connections closed
|
|
||||||
0 spliced connections reset
|
|
||||||
0 spliced connections timeout
|
|
||||||
0 spliced connections persist timeout
|
|
||||||
0 spliced connections keepalive timeout
|
|
||||||
0 TCP checksum offload disabled during retransmit
|
|
||||||
0 Connections dropped due to bad ACKs
|
|
||||||
0 Connections dropped due to duplicate SYN packets
|
|
||||||
0 fastpath loopback connections
|
|
||||||
0 fastpath loopback sent packets (0 bytes)
|
|
||||||
0 fastpath loopback received packets (0 bytes)
|
|
||||||
0 fake SYN segments dropped
|
|
||||||
0 fake RST segments dropped
|
|
||||||
0 data injection segments dropped
|
|
||||||
0 TCPTR maximum connections dropped
|
|
||||||
0 TCPTR connections dropped for no memory
|
|
||||||
0 TCPTR maximum per host connections dropped
|
|
||||||
0 connections dropped due to max assembly queue depth
|
|
||||||
udp:
|
|
||||||
34559 datagrams received
|
|
||||||
0 incomplete headers
|
|
||||||
0 bad data length fields
|
|
||||||
0 bad checksums
|
|
||||||
1849 dropped due to no socket
|
|
||||||
8218 broadcast/multicast datagrams dropped due to no socket
|
|
||||||
0 socket buffer overflows
|
|
||||||
24492 delivered
|
|
||||||
26332 datagrams output
|
|
||||||
ip:
|
|
||||||
76229 total packets received
|
|
||||||
0 bad header checksums
|
|
||||||
0 with size smaller than minimum
|
|
||||||
0 with data size < data length
|
|
||||||
0 with header length < data size
|
|
||||||
0 with data length < header length
|
|
||||||
0 with bad options
|
|
||||||
0 with incorrect version number
|
|
||||||
0 fragments received
|
|
||||||
0 fragments dropped (dup or out of space)
|
|
||||||
0 fragments dropped after timeout
|
|
||||||
0 packets reassembled ok
|
|
||||||
72552 packets for this host
|
|
||||||
3 packets for unknown/unsupported protocol
|
|
||||||
24 packets forwarded
|
|
||||||
0 packets not forwardable
|
|
||||||
0 redirects sent
|
|
||||||
55784 packets sent from this host
|
|
||||||
0 packets sent with fabricated ip header
|
|
||||||
0 output packets dropped due to no bufs, etc.
|
|
||||||
0 output packets discarded due to no route
|
|
||||||
0 output datagrams fragmented
|
|
||||||
0 fragments created
|
|
||||||
0 datagrams that can't be fragmented
|
|
||||||
0 IP Multicast packets dropped due to no receiver
|
|
||||||
0 successful path MTU discovery cycles
|
|
||||||
0 path MTU rediscovery cycles attempted
|
|
||||||
0 path MTU discovery no-response estimates
|
|
||||||
0 path MTU discovery response timeouts
|
|
||||||
0 path MTU discovery decreases detected
|
|
||||||
0 path MTU discovery packets sent
|
|
||||||
0 path MTU discovery memory allocation failures
|
|
||||||
0 ipintrq overflows
|
|
||||||
0 with illegal source
|
|
||||||
0 packets processed by threads
|
|
||||||
0 packets dropped by threads
|
|
||||||
0 packets dropped due to the full socket receive buffer
|
|
||||||
0 dead gateway detection packets sent
|
|
||||||
0 dead gateway detection packet allocation failures
|
|
||||||
0 dead gateway detection gateway allocation failures
|
|
||||||
0 incoming packets dropped due to MLS filters
|
|
||||||
0 packets not sent due to MLS filters
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Base Plugin
|
# Base Plugin
|
||||||
|
|
||||||
The base plugin uses the [oshi](https://github.com/oshi/oshi) library to get it's metrics.
|
The base plugins uses the [oshi](https://github.com/oshi/oshi) library to get it's metrics.
|
||||||
|
|
||||||
## Processor Extension
|
## Processor Extension
|
||||||
|
|
||||||
|
@ -51,6 +51,7 @@ Metrics reported are:
|
||||||
```toml
|
```toml
|
||||||
[extension.base_filesystem]
|
[extension.base_filesystem]
|
||||||
enabled = true
|
enabled = true
|
||||||
|
interval = "10s"
|
||||||
exclude_type = [ "tmpfs", "ahafs" ]
|
exclude_type = [ "tmpfs", "ahafs" ]
|
||||||
exclude_mount = [ "/boot/efi" ]
|
exclude_mount = [ "/boot/efi" ]
|
||||||
```
|
```
|
||||||
|
@ -79,5 +80,6 @@ The **include** option let's you specify what processes to report for.
|
||||||
```toml
|
```toml
|
||||||
[extension.base_process]
|
[extension.base_process]
|
||||||
enabled = true # true or false
|
enabled = true # true or false
|
||||||
|
interval = "10s"
|
||||||
include = [ "java", "influxd", "grafana-server" ]
|
include = [ "java", "influxd", "grafana-server" ]
|
||||||
```
|
```
|
||||||
|
|
|
@ -9,10 +9,7 @@ import sysmon.shared.Measurement;
|
||||||
import sysmon.shared.MetricExtension;
|
import sysmon.shared.MetricExtension;
|
||||||
import sysmon.shared.MetricResult;
|
import sysmon.shared.MetricResult;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Extension
|
@Extension
|
||||||
public class BaseDiskExtension implements MetricExtension {
|
public class BaseDiskExtension implements MetricExtension {
|
||||||
|
@ -27,6 +24,7 @@ public class BaseDiskExtension implements MetricExtension {
|
||||||
// Configuration / Options
|
// Configuration / Options
|
||||||
private boolean enabled = true;
|
private boolean enabled = true;
|
||||||
private boolean threaded = false;
|
private boolean threaded = false;
|
||||||
|
private String interval = "10s";
|
||||||
|
|
||||||
private HardwareAbstractionLayer hardwareAbstractionLayer;
|
private HardwareAbstractionLayer hardwareAbstractionLayer;
|
||||||
|
|
||||||
|
@ -54,7 +52,7 @@ public class BaseDiskExtension implements MetricExtension {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getInterval() {
|
public String getInterval() {
|
||||||
return null;
|
return interval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -75,6 +73,9 @@ public class BaseDiskExtension implements MetricExtension {
|
||||||
if(map.containsKey("threaded")) {
|
if(map.containsKey("threaded")) {
|
||||||
threaded = (boolean) map.get("threaded");
|
threaded = (boolean) map.get("threaded");
|
||||||
}
|
}
|
||||||
|
if(map.containsKey("interval")) {
|
||||||
|
interval = (String) map.get("interval");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -86,13 +87,18 @@ public class BaseDiskExtension implements MetricExtension {
|
||||||
for(HWDiskStore store : diskStores) {
|
for(HWDiskStore store : diskStores) {
|
||||||
|
|
||||||
String name = store.getName();
|
String name = store.getName();
|
||||||
if (name.matches("h?disk[0-9]+") || name.matches("/dev/x?[sv]d[a-z]") || name.matches("/dev/nvme[0-9]n[0-9]") || name.startsWith("\\\\.\\PHYSICALDRIVE")) {
|
if (name.matches("h?disk[0-9]+") ||
|
||||||
|
//name.matches("/dev/dm-[0-9]+") ||
|
||||||
|
name.matches("/dev/x?[sv]d[a-z]") ||
|
||||||
|
name.matches("/dev/nvme[0-9]n[0-9]") ||
|
||||||
|
name.startsWith("\\\\.\\PHYSICALDRIVE")
|
||||||
|
) {
|
||||||
|
|
||||||
HashMap<String, String> tagsMap = new HashMap<String, String>() {{
|
TreeMap<String, String> tagsMap = new TreeMap<String, String>() {{
|
||||||
put("name", name);
|
put("name", name);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
HashMap<String, Object> fieldsMap = new HashMap<String, Object>() {{
|
TreeMap<String, Object> fieldsMap = new TreeMap<String, Object>() {{
|
||||||
put("read", store.getReadBytes());
|
put("read", store.getReadBytes());
|
||||||
put("write", store.getWriteBytes());
|
put("write", store.getWriteBytes());
|
||||||
put("iotime", store.getTransferTime());
|
put("iotime", store.getTransferTime());
|
||||||
|
@ -102,7 +108,7 @@ public class BaseDiskExtension implements MetricExtension {
|
||||||
log.debug("getMetrics() - tags: {}, fields: {}", tagsMap, fieldsMap);
|
log.debug("getMetrics() - tags: {}, fields: {}", tagsMap, fieldsMap);
|
||||||
measurementList.add(new Measurement(tagsMap, fieldsMap));
|
measurementList.add(new Measurement(tagsMap, fieldsMap));
|
||||||
} else {
|
} else {
|
||||||
log.debug("getMetrics() - skipping device: {}", name);
|
log.warn("getMetrics() - skipping device: {}", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,10 +10,7 @@ import sysmon.shared.Measurement;
|
||||||
import sysmon.shared.MetricExtension;
|
import sysmon.shared.MetricExtension;
|
||||||
import sysmon.shared.MetricResult;
|
import sysmon.shared.MetricResult;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Extension
|
@Extension
|
||||||
public class BaseFilesystemExtension implements MetricExtension {
|
public class BaseFilesystemExtension implements MetricExtension {
|
||||||
|
@ -28,6 +25,7 @@ public class BaseFilesystemExtension implements MetricExtension {
|
||||||
// Configuration / Options
|
// Configuration / Options
|
||||||
private boolean enabled = true;
|
private boolean enabled = true;
|
||||||
private boolean threaded = false;
|
private boolean threaded = false;
|
||||||
|
private String interval = "10s";
|
||||||
private List<?> excludeType = new ArrayList<String>() {{
|
private List<?> excludeType = new ArrayList<String>() {{
|
||||||
add("tmpfs");
|
add("tmpfs");
|
||||||
add("ahafs");
|
add("ahafs");
|
||||||
|
@ -64,7 +62,7 @@ public class BaseFilesystemExtension implements MetricExtension {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getInterval() {
|
public String getInterval() {
|
||||||
return null;
|
return interval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -87,6 +85,10 @@ public class BaseFilesystemExtension implements MetricExtension {
|
||||||
threaded = (boolean) map.get("threaded");
|
threaded = (boolean) map.get("threaded");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(map.containsKey("interval")) {
|
||||||
|
interval = (String) map.get("interval");
|
||||||
|
}
|
||||||
|
|
||||||
if(map.containsKey("exclude_type")) {
|
if(map.containsKey("exclude_type")) {
|
||||||
excludeType = (List<?>) map.get("exclude_type");
|
excludeType = (List<?>) map.get("exclude_type");
|
||||||
}
|
}
|
||||||
|
@ -125,13 +127,13 @@ public class BaseFilesystemExtension implements MetricExtension {
|
||||||
}
|
}
|
||||||
alreadyProcessed.add(name);
|
alreadyProcessed.add(name);
|
||||||
|
|
||||||
HashMap<String, String> tagsMap = new HashMap<String, String>() {{
|
TreeMap<String, String> tagsMap = new TreeMap<String, String>() {{
|
||||||
put("name", name);
|
put("name", name);
|
||||||
put("type", type);
|
put("type", type);
|
||||||
put("mount", mount);
|
put("mount", mount);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
HashMap<String, Object> fieldsMap = new HashMap<String, Object>() {{
|
TreeMap<String, Object> fieldsMap = new TreeMap<String, Object>() {{
|
||||||
put("free_bytes", store.getFreeSpace());
|
put("free_bytes", store.getFreeSpace());
|
||||||
put("total_bytes", store.getTotalSpace());
|
put("total_bytes", store.getTotalSpace());
|
||||||
put("free_inodes", store.getFreeInodes());
|
put("free_inodes", store.getFreeInodes());
|
||||||
|
|
|
@ -10,6 +10,7 @@ import sysmon.shared.MetricResult;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
|
||||||
@Extension
|
@Extension
|
||||||
public class BaseInfoExtension implements MetricExtension {
|
public class BaseInfoExtension implements MetricExtension {
|
||||||
|
@ -80,7 +81,7 @@ public class BaseInfoExtension implements MetricExtension {
|
||||||
@Override
|
@Override
|
||||||
public MetricResult getMetrics() {
|
public MetricResult getMetrics() {
|
||||||
|
|
||||||
HashMap<String, Object> fieldsMap = new HashMap<String, Object>() {{
|
TreeMap<String, Object> fieldsMap = new TreeMap<String, Object>() {{
|
||||||
put("os_manufacturer", systemInfo.getOperatingSystem().getManufacturer()); // GNU/Linux / IBM
|
put("os_manufacturer", systemInfo.getOperatingSystem().getManufacturer()); // GNU/Linux / IBM
|
||||||
put("os_family", systemInfo.getOperatingSystem().getFamily()); // Freedesktop.org / AIX
|
put("os_family", systemInfo.getOperatingSystem().getFamily()); // Freedesktop.org / AIX
|
||||||
put("os_codename", systemInfo.getOperatingSystem().getVersionInfo().getCodeName()); // Flatpak runtime / ppc64
|
put("os_codename", systemInfo.getOperatingSystem().getVersionInfo().getCodeName()); // Flatpak runtime / ppc64
|
||||||
|
|
|
@ -10,6 +10,7 @@ import sysmon.shared.MetricResult;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
|
||||||
@Extension
|
@Extension
|
||||||
public class BaseLoadExtension implements MetricExtension {
|
public class BaseLoadExtension implements MetricExtension {
|
||||||
|
@ -24,6 +25,7 @@ public class BaseLoadExtension implements MetricExtension {
|
||||||
// Configuration / Options
|
// Configuration / Options
|
||||||
private boolean enabled = true;
|
private boolean enabled = true;
|
||||||
private boolean threaded = false;
|
private boolean threaded = false;
|
||||||
|
private String interval = "10s";
|
||||||
|
|
||||||
private HardwareAbstractionLayer hardwareAbstractionLayer;
|
private HardwareAbstractionLayer hardwareAbstractionLayer;
|
||||||
|
|
||||||
|
@ -50,7 +52,7 @@ public class BaseLoadExtension implements MetricExtension {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getInterval() {
|
public String getInterval() {
|
||||||
return null;
|
return interval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -71,20 +73,23 @@ public class BaseLoadExtension implements MetricExtension {
|
||||||
if(map.containsKey("threaded")) {
|
if(map.containsKey("threaded")) {
|
||||||
threaded = (boolean) map.get("threaded");
|
threaded = (boolean) map.get("threaded");
|
||||||
}
|
}
|
||||||
|
if(map.containsKey("interval")) {
|
||||||
|
interval = (String) map.get("interval");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MetricResult getMetrics() {
|
public MetricResult getMetrics() {
|
||||||
|
|
||||||
double[] loadAvg = hardwareAbstractionLayer.getProcessor().getSystemLoadAverage(3);
|
double[] loadAvg = hardwareAbstractionLayer.getProcessor().getSystemLoadAverage(3);
|
||||||
HashMap<String, Object> fieldsMap = new HashMap<String, Object>() {{
|
TreeMap<String, Object> fieldsMap = new TreeMap<String, Object>() {{
|
||||||
put("1min", loadAvg[0]);
|
put("1min", loadAvg[0]);
|
||||||
put("5min", loadAvg[1]);
|
put("5min", loadAvg[1]);
|
||||||
put("15min", loadAvg[2]);
|
put("15min", loadAvg[2]);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
log.debug(fieldsMap.toString());
|
log.debug(fieldsMap.toString());
|
||||||
return new MetricResult(name, new Measurement(new HashMap<String, String>(), fieldsMap));
|
return new MetricResult(name, new Measurement(new TreeMap<>(), fieldsMap));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ import sysmon.shared.MetricResult;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
|
||||||
@Extension
|
@Extension
|
||||||
public class BaseMemoryExtension implements MetricExtension {
|
public class BaseMemoryExtension implements MetricExtension {
|
||||||
|
@ -24,6 +25,7 @@ public class BaseMemoryExtension implements MetricExtension {
|
||||||
// Configuration / Options
|
// Configuration / Options
|
||||||
private boolean enabled = true;
|
private boolean enabled = true;
|
||||||
private boolean threaded = false;
|
private boolean threaded = false;
|
||||||
|
private String interval = "10s";
|
||||||
|
|
||||||
private HardwareAbstractionLayer hardwareAbstractionLayer;
|
private HardwareAbstractionLayer hardwareAbstractionLayer;
|
||||||
|
|
||||||
|
@ -51,7 +53,7 @@ public class BaseMemoryExtension implements MetricExtension {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getInterval() {
|
public String getInterval() {
|
||||||
return null;
|
return interval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -72,13 +74,16 @@ public class BaseMemoryExtension implements MetricExtension {
|
||||||
if(map.containsKey("threaded")) {
|
if(map.containsKey("threaded")) {
|
||||||
threaded = (boolean) map.get("threaded");
|
threaded = (boolean) map.get("threaded");
|
||||||
}
|
}
|
||||||
|
if(map.containsKey("interval")) {
|
||||||
|
interval = (String) map.get("interval");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MetricResult getMetrics() {
|
public MetricResult getMetrics() {
|
||||||
|
|
||||||
HashMap<String, String> tagsMap = new HashMap<>();
|
TreeMap<String, String> tagsMap = new TreeMap<>();
|
||||||
HashMap<String, Object> fieldsMap = new HashMap<>();
|
TreeMap<String, Object> fieldsMap = new TreeMap<>();
|
||||||
|
|
||||||
long total = hardwareAbstractionLayer.getMemory().getTotal();
|
long total = hardwareAbstractionLayer.getMemory().getTotal();
|
||||||
long available = hardwareAbstractionLayer.getMemory().getAvailable();
|
long available = hardwareAbstractionLayer.getMemory().getAvailable();
|
||||||
|
|
|
@ -10,6 +10,7 @@ import sysmon.shared.MetricResult;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
|
||||||
@Extension
|
@Extension
|
||||||
public class BaseNetstatExtension implements MetricExtension {
|
public class BaseNetstatExtension implements MetricExtension {
|
||||||
|
@ -24,6 +25,7 @@ public class BaseNetstatExtension implements MetricExtension {
|
||||||
// Configuration / Options
|
// Configuration / Options
|
||||||
private boolean enabled = true;
|
private boolean enabled = true;
|
||||||
private boolean threaded = false;
|
private boolean threaded = false;
|
||||||
|
private String interval = "10s";
|
||||||
|
|
||||||
private SystemInfo systemInfo;
|
private SystemInfo systemInfo;
|
||||||
|
|
||||||
|
@ -51,7 +53,7 @@ public class BaseNetstatExtension implements MetricExtension {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getInterval() {
|
public String getInterval() {
|
||||||
return null;
|
return interval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -72,12 +74,15 @@ public class BaseNetstatExtension implements MetricExtension {
|
||||||
if (map.containsKey("threaded")) {
|
if (map.containsKey("threaded")) {
|
||||||
threaded = (boolean) map.get("threaded");
|
threaded = (boolean) map.get("threaded");
|
||||||
}
|
}
|
||||||
|
if(map.containsKey("interval")) {
|
||||||
|
interval = (String) map.get("interval");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MetricResult getMetrics() {
|
public MetricResult getMetrics() {
|
||||||
|
|
||||||
HashMap<String, Object> fieldsMap = new HashMap<String, Object>() {{
|
TreeMap<String, Object> fieldsMap = new TreeMap<String, Object>() {{
|
||||||
|
|
||||||
put("ip_conn_total", systemInfo.getOperatingSystem().getInternetProtocolStats().getConnections().size());
|
put("ip_conn_total", systemInfo.getOperatingSystem().getInternetProtocolStats().getConnections().size());
|
||||||
|
|
||||||
|
@ -103,7 +108,7 @@ public class BaseNetstatExtension implements MetricExtension {
|
||||||
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
return new MetricResult(name, new Measurement(new HashMap<>(), fieldsMap));
|
return new MetricResult(name, new Measurement(new TreeMap<>(), fieldsMap));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,10 +9,7 @@ import sysmon.shared.Measurement;
|
||||||
import sysmon.shared.MetricExtension;
|
import sysmon.shared.MetricExtension;
|
||||||
import sysmon.shared.MetricResult;
|
import sysmon.shared.MetricResult;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Extension
|
@Extension
|
||||||
public class BaseNetworkExtension implements MetricExtension {
|
public class BaseNetworkExtension implements MetricExtension {
|
||||||
|
@ -27,6 +24,7 @@ public class BaseNetworkExtension implements MetricExtension {
|
||||||
// Configuration / Options
|
// Configuration / Options
|
||||||
private boolean enabled = true;
|
private boolean enabled = true;
|
||||||
private boolean threaded = false;
|
private boolean threaded = false;
|
||||||
|
private String interval = "10s";
|
||||||
|
|
||||||
private HardwareAbstractionLayer hardwareAbstractionLayer;
|
private HardwareAbstractionLayer hardwareAbstractionLayer;
|
||||||
|
|
||||||
|
@ -54,7 +52,7 @@ public class BaseNetworkExtension implements MetricExtension {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getInterval() {
|
public String getInterval() {
|
||||||
return null;
|
return interval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -75,6 +73,9 @@ public class BaseNetworkExtension implements MetricExtension {
|
||||||
if(map.containsKey("threaded")) {
|
if(map.containsKey("threaded")) {
|
||||||
threaded = (boolean) map.get("threaded");
|
threaded = (boolean) map.get("threaded");
|
||||||
}
|
}
|
||||||
|
if(map.containsKey("interval")) {
|
||||||
|
interval = (String) map.get("interval");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -85,11 +86,11 @@ public class BaseNetworkExtension implements MetricExtension {
|
||||||
List<NetworkIF> interfaces = hardwareAbstractionLayer.getNetworkIFs();
|
List<NetworkIF> interfaces = hardwareAbstractionLayer.getNetworkIFs();
|
||||||
for(NetworkIF netif : interfaces) {
|
for(NetworkIF netif : interfaces) {
|
||||||
|
|
||||||
HashMap<String, String> tagsMap = new HashMap<String, String>() {{
|
TreeMap<String, String> tagsMap = new TreeMap<String, String>() {{
|
||||||
put("name", netif.getName());
|
put("name", netif.getName());
|
||||||
}};
|
}};
|
||||||
|
|
||||||
HashMap<String, Object> fieldsMap = new HashMap<String, Object>() {{
|
TreeMap<String, Object> fieldsMap = new TreeMap<String, Object>() {{
|
||||||
put("rx_pkts", netif.getPacketsRecv());
|
put("rx_pkts", netif.getPacketsRecv());
|
||||||
put("tx_pkts", netif.getPacketsSent());
|
put("tx_pkts", netif.getPacketsSent());
|
||||||
put("rx_bytes", netif.getBytesRecv());
|
put("rx_bytes", netif.getBytesRecv());
|
||||||
|
|
|
@ -24,6 +24,8 @@ public class BaseProcessExtension implements MetricExtension {
|
||||||
// Configuration / Options
|
// Configuration / Options
|
||||||
private boolean enabled = true;
|
private boolean enabled = true;
|
||||||
private boolean threaded = false;
|
private boolean threaded = false;
|
||||||
|
private String interval = "60s";
|
||||||
|
|
||||||
private List<?> includeList = new ArrayList<Object>() {{
|
private List<?> includeList = new ArrayList<Object>() {{
|
||||||
add("java");
|
add("java");
|
||||||
add("node");
|
add("node");
|
||||||
|
@ -70,7 +72,7 @@ public class BaseProcessExtension implements MetricExtension {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getInterval() {
|
public String getInterval() {
|
||||||
return null;
|
return interval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -91,6 +93,9 @@ public class BaseProcessExtension implements MetricExtension {
|
||||||
if(map.containsKey("threaded")) {
|
if(map.containsKey("threaded")) {
|
||||||
threaded = (boolean) map.get("threaded");
|
threaded = (boolean) map.get("threaded");
|
||||||
}
|
}
|
||||||
|
if(map.containsKey("interval")) {
|
||||||
|
interval = (String) map.get("interval");
|
||||||
|
}
|
||||||
if(map.containsKey("include")) {
|
if(map.containsKey("include")) {
|
||||||
includeList = (List<?>) map.get("include");
|
includeList = (List<?>) map.get("include");
|
||||||
}
|
}
|
||||||
|
@ -121,12 +126,12 @@ public class BaseProcessExtension implements MetricExtension {
|
||||||
}
|
}
|
||||||
log.debug("pid: " + p.getProcessID() + ", name: " + p.getName() + ", virt: " + p.getVirtualSize() + " rss: " + p.getResidentSetSize());
|
log.debug("pid: " + p.getProcessID() + ", name: " + p.getName() + ", virt: " + p.getVirtualSize() + " rss: " + p.getResidentSetSize());
|
||||||
|
|
||||||
HashMap<String, String> tagsMap = new HashMap<String, String>() {{
|
TreeMap<String, String> tagsMap = new TreeMap<String, String>() {{
|
||||||
put("pid", String.valueOf(p.getProcessID()));
|
put("pid", String.valueOf(p.getProcessID()));
|
||||||
put("name", p.getName());
|
put("name", p.getName());
|
||||||
}};
|
}};
|
||||||
|
|
||||||
HashMap<String, Object> fieldsMap = new HashMap<String, Object>() {{
|
TreeMap<String, Object> fieldsMap = new TreeMap<String, Object>() {{
|
||||||
put("mem_rss", p.getResidentSetSize());
|
put("mem_rss", p.getResidentSetSize());
|
||||||
put("mem_vsz", p.getVirtualSize());
|
put("mem_vsz", p.getVirtualSize());
|
||||||
put("kernel_time", p.getKernelTime());
|
put("kernel_time", p.getKernelTime());
|
||||||
|
|
|
@ -11,6 +11,7 @@ import sysmon.shared.MetricResult;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
|
||||||
@Extension
|
@Extension
|
||||||
public class BaseProcessorExtension implements MetricExtension {
|
public class BaseProcessorExtension implements MetricExtension {
|
||||||
|
@ -25,6 +26,7 @@ public class BaseProcessorExtension implements MetricExtension {
|
||||||
// Configuration / Options
|
// Configuration / Options
|
||||||
private boolean enabled = true;
|
private boolean enabled = true;
|
||||||
private boolean threaded = false;
|
private boolean threaded = false;
|
||||||
|
private String interval = "10s";
|
||||||
|
|
||||||
private HardwareAbstractionLayer hardwareAbstractionLayer;
|
private HardwareAbstractionLayer hardwareAbstractionLayer;
|
||||||
private long[] oldTicks;
|
private long[] oldTicks;
|
||||||
|
@ -52,7 +54,7 @@ public class BaseProcessorExtension implements MetricExtension {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getInterval() {
|
public String getInterval() {
|
||||||
return null;
|
return interval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -73,13 +75,16 @@ public class BaseProcessorExtension implements MetricExtension {
|
||||||
if(map.containsKey("threaded")) {
|
if(map.containsKey("threaded")) {
|
||||||
threaded = (boolean) map.get("threaded");
|
threaded = (boolean) map.get("threaded");
|
||||||
}
|
}
|
||||||
|
if(map.containsKey("interval")) {
|
||||||
|
interval = (String) map.get("interval");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MetricResult getMetrics() {
|
public MetricResult getMetrics() {
|
||||||
|
|
||||||
HashMap<String, String> tagsMap = new HashMap<>();
|
TreeMap<String, String> tagsMap = new TreeMap<>();
|
||||||
HashMap<String, Object> fieldsMap = new HashMap<>();
|
TreeMap<String, Object> fieldsMap = new TreeMap<>();
|
||||||
|
|
||||||
long[] ticks = hardwareAbstractionLayer.getProcessor().getSystemCpuLoadTicks();
|
long[] ticks = hardwareAbstractionLayer.getProcessor().getSystemCpuLoadTicks();
|
||||||
if(oldTicks == null || oldTicks.length != ticks.length) {
|
if(oldTicks == null || oldTicks.length != ticks.length) {
|
||||||
|
|
|
@ -6,44 +6,33 @@ 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;
|
import java.sql.Connection;
|
||||||
|
import java.sql.DriverManager;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
public class IbmIPlugin extends Plugin {
|
public class IbmIPlugin extends Plugin {
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(IbmIPlugin.class);
|
private static final Logger log = LoggerFactory.getLogger(IbmIPlugin.class);
|
||||||
|
|
||||||
private static SystemStatus systemStatus;
|
|
||||||
private static AS400 as400;
|
private static AS400 as400;
|
||||||
|
private static SystemStatus systemStatus;
|
||||||
|
private static Connection connection;
|
||||||
|
|
||||||
|
|
||||||
public IbmIPlugin(PluginWrapper wrapper) {
|
public IbmIPlugin(PluginWrapper wrapper) {
|
||||||
super(wrapper);
|
super(wrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static SystemStatus getSystemStatus() {
|
|
||||||
|
|
||||||
try {
|
|
||||||
if (as400 == null) {
|
|
||||||
as400 = IbmIPlugin.getAS400();
|
|
||||||
}
|
|
||||||
if(systemStatus == null) {
|
|
||||||
systemStatus = new SystemStatus(as400);
|
|
||||||
}
|
|
||||||
} catch (Exception exception) {
|
|
||||||
log.error("getSystemStatus() - {}", exception.getMessage());
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return systemStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static AS400 getAS400() {
|
public static AS400 getAS400() {
|
||||||
|
|
||||||
|
if(as400 != null) {
|
||||||
|
return as400;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check platform
|
||||||
String osArch = System.getProperty("os.arch").toLowerCase();
|
String osArch = System.getProperty("os.arch").toLowerCase();
|
||||||
String osName = System.getProperty("os.name").toLowerCase();
|
String osName = System.getProperty("os.name").toLowerCase();
|
||||||
|
|
||||||
if(!osArch.equals("ppc64") && !osName.equals("os/400")) {
|
if(!osArch.equals("ppc64") && !osName.equals("os/400")) {
|
||||||
log.info("getAS400() - OS Arch: {}", osArch);
|
log.info("getAS400() - OS Arch: {}", osArch);
|
||||||
log.info("getAS400() - OS Name: {}", osName);
|
log.info("getAS400() - OS Name: {}", osName);
|
||||||
|
@ -52,15 +41,57 @@ public class IbmIPlugin extends Plugin {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
as400 = new AS400("localhost", "*CURRENT");
|
as400 = new AS400("localhost", "*CURRENT");
|
||||||
|
//as400 = new AS400("localhost", "*LOCAL");
|
||||||
//as400 = new AS400("10.32.64.142");
|
//as400 = new AS400("10.32.64.142");
|
||||||
|
return as400;
|
||||||
} catch (Exception exception) {
|
} catch (Exception exception) {
|
||||||
log.error("getAS400() - {}", exception.getMessage());
|
log.error("getAS400() - {}", exception.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return as400;
|
|
||||||
|
public static SystemStatus getSystemStatus() {
|
||||||
|
|
||||||
|
if(systemStatus != null) {
|
||||||
|
return systemStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (as400 == null) {
|
||||||
|
as400 = IbmIPlugin.getAS400();
|
||||||
|
}
|
||||||
|
if(systemStatus == null && as400 != null) {
|
||||||
|
systemStatus = new SystemStatus(as400);
|
||||||
|
return systemStatus;
|
||||||
|
}
|
||||||
|
} catch (Exception exception) {
|
||||||
|
log.error("getSystemStatus() - {}", exception.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static Connection getConnection() {
|
||||||
|
|
||||||
|
if(connection != null) {
|
||||||
|
return connection;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
DriverManager.registerDriver(new com.ibm.as400.access.AS400JDBCDriver());
|
||||||
|
connection = DriverManager.getConnection("jdbc:as400://localhost");
|
||||||
|
return connection;
|
||||||
|
} catch (SQLException exception) {
|
||||||
|
log.error("getConnection() - {}", exception.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ import sysmon.shared.MetricResult;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
|
||||||
//@Extension
|
//@Extension
|
||||||
public class TestExtension implements MetricExtension {
|
public class TestExtension implements MetricExtension {
|
||||||
|
@ -25,6 +26,7 @@ public class TestExtension implements MetricExtension {
|
||||||
// Configuration / Options
|
// Configuration / Options
|
||||||
private boolean enabled = true;
|
private boolean enabled = true;
|
||||||
private boolean threaded = false;
|
private boolean threaded = false;
|
||||||
|
private String interval = "10s";
|
||||||
|
|
||||||
private SystemStatus systemStatus;
|
private SystemStatus systemStatus;
|
||||||
|
|
||||||
|
@ -52,7 +54,7 @@ public class TestExtension implements MetricExtension {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getInterval() {
|
public String getInterval() {
|
||||||
return null;
|
return interval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -73,6 +75,9 @@ public class TestExtension implements MetricExtension {
|
||||||
if(map.containsKey("threaded")) {
|
if(map.containsKey("threaded")) {
|
||||||
threaded = (boolean) map.get("threaded");
|
threaded = (boolean) map.get("threaded");
|
||||||
}
|
}
|
||||||
|
if(map.containsKey("interval")) {
|
||||||
|
interval = (String) map.get("interval");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -121,8 +126,7 @@ public class TestExtension implements MetricExtension {
|
||||||
System.out.println("Temp Addresses Used:" + systemStatus.getPercentTemporaryAddresses());
|
System.out.println("Temp Addresses Used:" + systemStatus.getPercentTemporaryAddresses());
|
||||||
|
|
||||||
|
|
||||||
|
TreeMap<String, Object> fieldsMap = new TreeMap<String, Object>() {{
|
||||||
HashMap<String, Object> fieldsMap = new HashMap<String, Object>() {{
|
|
||||||
put("jobs_total", jobsInSystem);
|
put("jobs_total", jobsInSystem);
|
||||||
put("jobs_running", batchJobsRunning);
|
put("jobs_running", batchJobsRunning);
|
||||||
put("jobs_active", activeJobs);
|
put("jobs_active", activeJobs);
|
||||||
|
@ -130,7 +134,7 @@ public class TestExtension implements MetricExtension {
|
||||||
put("users", onlineUsers);
|
put("users", onlineUsers);
|
||||||
|
|
||||||
}};
|
}};
|
||||||
return new MetricResult(name, new Measurement(new HashMap<>(), fieldsMap));
|
return new MetricResult(name, new Measurement(new TreeMap<>(), fieldsMap));
|
||||||
|
|
||||||
} catch (AS400SecurityException | ErrorCompletingRequestException | InterruptedException | IOException | ObjectDoesNotExistException e) {
|
} catch (AS400SecurityException | ErrorCompletingRequestException | InterruptedException | IOException | ObjectDoesNotExistException e) {
|
||||||
log.error("getMetrics() {}", e.getMessage());
|
log.error("getMetrics() {}", e.getMessage());
|
||||||
|
|
|
@ -11,6 +11,7 @@ import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
|
||||||
// Disabled
|
// Disabled
|
||||||
//@Extension
|
//@Extension
|
||||||
|
@ -87,8 +88,8 @@ public class LinuxNetstatExtension implements MetricExtension {
|
||||||
@Override
|
@Override
|
||||||
public MetricResult getMetrics() throws Exception {
|
public MetricResult getMetrics() throws Exception {
|
||||||
|
|
||||||
HashMap<String, String> tagsMap;
|
TreeMap<String, String> tagsMap;
|
||||||
HashMap<String, Object> fieldsMap;
|
TreeMap<String, Object> fieldsMap;
|
||||||
|
|
||||||
try (InputStream inputStream = PluginHelper.executeCommand("netstat -s")) {
|
try (InputStream inputStream = PluginHelper.executeCommand("netstat -s")) {
|
||||||
LinuxNetstatParser parser = processCommandOutput(inputStream);
|
LinuxNetstatParser parser = processCommandOutput(inputStream);
|
||||||
|
|
|
@ -8,6 +8,7 @@ import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
|
||||||
public class LinuxNetstatParser {
|
public class LinuxNetstatParser {
|
||||||
|
|
||||||
|
@ -139,12 +140,12 @@ public class LinuxNetstatParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public HashMap<String, String> getTags() {
|
public TreeMap<String, String> getTags() {
|
||||||
return new HashMap<>();
|
return new TreeMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public HashMap<String, Object> getFields() {
|
public TreeMap<String, Object> getFields() {
|
||||||
return new HashMap<String, Object>() {{
|
return new TreeMap<String, Object>() {{
|
||||||
put("ip_forwarded", ipForwarded);
|
put("ip_forwarded", ipForwarded);
|
||||||
put("ip_received", ipTotalPacketsReceived);
|
put("ip_received", ipTotalPacketsReceived);
|
||||||
put("ip_dropped", ipOutgoingPacketsDropped);
|
put("ip_dropped", ipOutgoingPacketsDropped);
|
||||||
|
|
|
@ -11,6 +11,7 @@ import sysmon.shared.PluginHelper;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
|
||||||
@Extension
|
@Extension
|
||||||
public class LinuxSocketExtension implements MetricExtension {
|
public class LinuxSocketExtension implements MetricExtension {
|
||||||
|
@ -83,8 +84,8 @@ public class LinuxSocketExtension implements MetricExtension {
|
||||||
|
|
||||||
LinuxSocketStat sockStat = processSockOutput(PluginHelper.readFile("/proc/net/sockstat"));
|
LinuxSocketStat sockStat = processSockOutput(PluginHelper.readFile("/proc/net/sockstat"));
|
||||||
|
|
||||||
HashMap<String, String> tagsMap = sockStat.getTags();
|
TreeMap<String, String> tagsMap = sockStat.getTags();
|
||||||
HashMap<String, Object> fieldsMap = sockStat.getFields();
|
TreeMap<String, Object> fieldsMap = sockStat.getFields();
|
||||||
|
|
||||||
log.debug("getMetrics() - tags: {}, fields: {}", tagsMap, fieldsMap);
|
log.debug("getMetrics() - tags: {}, fields: {}", tagsMap, fieldsMap);
|
||||||
return new MetricResult(name, new Measurement(tagsMap, fieldsMap));
|
return new MetricResult(name, new Measurement(tagsMap, fieldsMap));
|
||||||
|
|
|
@ -5,6 +5,7 @@ import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.TreeMap;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
@ -75,13 +76,13 @@ public class LinuxSocketStat {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public HashMap<String, String> getTags() {
|
public TreeMap<String, String> getTags() {
|
||||||
return new HashMap<>();
|
return new TreeMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public HashMap<String, Object> getFields() {
|
public TreeMap<String, Object> getFields() {
|
||||||
return new HashMap<String, Object>() {{
|
return new TreeMap<String, Object>() {{
|
||||||
put("sockets", sockets);
|
put("sockets", sockets);
|
||||||
put("tcp_inuse", tcp_inuse);
|
put("tcp_inuse", tcp_inuse);
|
||||||
put("tcp_alloc", tcp_alloc);
|
put("tcp_alloc", tcp_alloc);
|
||||||
|
|
|
@ -34,8 +34,11 @@ public class ComboResultToPointProcessor implements Processor {
|
||||||
|
|
||||||
Point.Builder point = Point.measurement(metricResult.getName())
|
Point.Builder point = Point.measurement(metricResult.getName())
|
||||||
.time(metricResult.getTimestamp(), TimeUnit.MILLISECONDS)
|
.time(metricResult.getTimestamp(), TimeUnit.MILLISECONDS)
|
||||||
.tag("hostname", metricResult.getHostname());
|
.tag("hostname", metricResult.getHostname())
|
||||||
|
.tag(measurement.getTags())
|
||||||
|
.fields(measurement.getFields());
|
||||||
|
|
||||||
|
/*
|
||||||
for (Map.Entry<String,String> entry : measurement.getTags().entrySet()) {
|
for (Map.Entry<String,String> entry : measurement.getTags().entrySet()) {
|
||||||
//log.info("process() - tag: " + entry.getKey() + "=" + entry.getValue());
|
//log.info("process() - tag: " + entry.getKey() + "=" + entry.getValue());
|
||||||
point.tag(entry.getKey(), entry.getValue());
|
point.tag(entry.getKey(), entry.getValue());
|
||||||
|
@ -53,7 +56,7 @@ public class ComboResultToPointProcessor implements Processor {
|
||||||
String str = (String) entry.getValue();
|
String str = (String) entry.getValue();
|
||||||
point.addField(entry.getKey(), str);
|
point.addField(entry.getKey(), str);
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
batchPoints.point(point.build());
|
batchPoints.point(point.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,26 +35,39 @@ public class MetricResultToPointProcessor implements Processor {
|
||||||
for(Measurement measurement : measurementList) {
|
for(Measurement measurement : measurementList) {
|
||||||
|
|
||||||
Point.Builder point = Point.measurement(metricResult.getName())
|
Point.Builder point = Point.measurement(metricResult.getName())
|
||||||
.time(metricResult.getTimestamp(), TimeUnit.MILLISECONDS);
|
.time(metricResult.getTimestamp(), TimeUnit.MILLISECONDS)
|
||||||
|
.fields(measurement.getFields())
|
||||||
|
.tag(measurement.getTags());
|
||||||
|
|
||||||
|
/*
|
||||||
for (Map.Entry<String,String> entry : measurement.getTags().entrySet()) {
|
for (Map.Entry<String,String> entry : measurement.getTags().entrySet()) {
|
||||||
//log.info("process() - tag: " + entry.getKey() + "=" + entry.getValue());
|
//log.info("process() - tag: " + entry.getKey() + "=" + entry.getValue());
|
||||||
point.tag(entry.getKey(), entry.getValue());
|
point.tag(entry.getKey(), entry.getValue());
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
/*
|
||||||
for (Map.Entry<String,Object> entry : measurement.getFields().entrySet()) {
|
for (Map.Entry<String,Object> entry : measurement.getFields().entrySet()) {
|
||||||
//log.info("process() - field: " + entry.getKey() + "=" + entry.getValue());
|
//log.info("process() - field: " + entry.getKey() + "=" + entry.getValue());
|
||||||
if(entry.getValue() instanceof Number) {
|
if(entry.getValue() instanceof Float) {
|
||||||
Number num = (Number) entry.getValue();
|
float num = (float) entry.getValue();
|
||||||
|
point.addField(entry.getKey(), num);
|
||||||
|
} else if(entry.getValue() instanceof Long) {
|
||||||
|
long num = (long) entry.getValue();
|
||||||
|
point.addField(entry.getKey(), num);
|
||||||
|
} else if(entry.getValue() instanceof Integer) {
|
||||||
|
int num = (int) entry.getValue();
|
||||||
point.addField(entry.getKey(), num);
|
point.addField(entry.getKey(), num);
|
||||||
} else if(entry.getValue() instanceof Boolean) {
|
} else if(entry.getValue() instanceof Boolean) {
|
||||||
Boolean bol = (Boolean) entry.getValue();
|
boolean bol = (Boolean) entry.getValue();
|
||||||
point.addField(entry.getKey(), bol);
|
point.addField(entry.getKey(), bol);
|
||||||
|
} else if(entry.getValue() instanceof Number) {
|
||||||
|
Number num = (Number) entry.getValue();
|
||||||
|
point.addField(entry.getKey(), num);
|
||||||
} else {
|
} else {
|
||||||
String str = (String) entry.getValue();
|
String str = (String) entry.getValue();
|
||||||
point.addField(entry.getKey(), str);
|
point.addField(entry.getKey(), str);
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
batchPoints.point(point.build());
|
batchPoints.point(point.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,19 +4,20 @@ import java.io.Serializable;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
|
||||||
public class Measurement implements Serializable {
|
public class Measurement implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private HashMap<String, String> tags = new HashMap<>();
|
private Map<String, String> tags = new TreeMap<>();
|
||||||
private HashMap<String, Object> fields = new HashMap<>();
|
private Map<String, Object> fields = new TreeMap<>();
|
||||||
|
|
||||||
|
|
||||||
public Measurement() {
|
public Measurement() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Measurement(HashMap<String, String> tags, HashMap<String, Object> fields) {
|
public Measurement(Map<String, String> tags, TreeMap<String, Object> fields) {
|
||||||
this.tags = Objects.requireNonNull(tags);
|
this.tags = Objects.requireNonNull(tags);
|
||||||
this.fields = Objects.requireNonNull(fields);
|
this.fields = Objects.requireNonNull(fields);
|
||||||
}
|
}
|
||||||
|
@ -29,12 +30,12 @@ public class Measurement implements Serializable {
|
||||||
return fields;
|
return fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTags(HashMap<String, String> tags) {
|
public void setTags(TreeMap<String, String> tags) {
|
||||||
Objects.requireNonNull(tags);
|
Objects.requireNonNull(tags);
|
||||||
this.tags = tags;
|
this.tags = tags;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFields(HashMap<String, Object> fields) {
|
public void setFields(TreeMap<String, Object> fields) {
|
||||||
Objects.requireNonNull(fields);
|
Objects.requireNonNull(fields);
|
||||||
this.fields = fields;
|
this.fields = fields;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue