Fix incorrect use of OSHI getDiskStores causing lots of reads on AIX.

This commit is contained in:
Mark Nellemann 2022-11-16 12:21:33 +01:00
parent c503032d94
commit 6ffc943a51
13 changed files with 145 additions and 98 deletions

View file

@ -2,6 +2,10 @@
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.24] - 2022-11-16
- Fix incorrect use of OSHI getDiskStores()
- Update dashboards
## [1.0.23] - 2022-11-07 ## [1.0.23] - 2022-11-07
- Update dashboards. - Update dashboards.
- Lower default interval for most plugins. - Lower default interval for most plugins.
@ -36,6 +40,7 @@ All notable changes to this project will be documented in this file.
### Changed ### Changed
- Updated 3rd party dependencies. - Updated 3rd party dependencies.
[1.0.24]: https://bitbucket.org/mnellemann/sysmon/branches/compare/v1.0.24%0Dv0.1.23
[1.0.23]: https://bitbucket.org/mnellemann/sysmon/branches/compare/v1.0.23%0Dv0.1.21 [1.0.23]: https://bitbucket.org/mnellemann/sysmon/branches/compare/v1.0.23%0Dv0.1.21
[1.0.21]: https://bitbucket.org/mnellemann/sysmon/branches/compare/v1.0.21%0Dv0.1.18 [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

View file

@ -38,7 +38,7 @@ def projectName = "sysmon-client"
application { application {
// Define the main class for the application. // Define the main class for the application.
mainClass.set('sysmon.client.Application') mainClass.set('sysmon.client.Application')
applicationDefaultJvmArgs = [ "-server", "-Xms64m", "-Xmx64m", "-XX:+ExitOnOutOfMemoryError", "-XX:+AlwaysPreTouch" ] applicationDefaultJvmArgs = [ "-Xms64m", "-Xmx64m", "-XX:+ExitOnOutOfMemoryError", "-XX:+AlwaysPreTouch" ]
} }
run { run {

View file

@ -6,6 +6,7 @@ Description=Sysmon Client
#Group=nobody #Group=nobody
TimeoutSec=20 TimeoutSec=20
Restart=on-failure Restart=on-failure
# BELOW: Specify sysmon-server URL, add '-n hostname' if needed
ExecStart=/opt/sysmon/client/bin/client -s http://10.20.30.40:9925/metrics ExecStart=/opt/sysmon/client/bin/client -s http://10.20.30.40:9925/metrics
[Install] [Install]

View file

@ -11,7 +11,7 @@
dir="/opt/sysmon/client" dir="/opt/sysmon/client"
cmd="/opt/sysmon/client/bin/client" cmd="/opt/sysmon/client/bin/client"
args="-s http://10.20.30.40:9925/metrics" # Specify sysmon-server URL here, add '-n hostname' if needed args="-s http://10.20.30.40:9925/metrics" # <- HERE: Specify sysmon-server URL, add '-n hostname' if needed
user="" user=""
name="sysmon-client" name="sysmon-client"
@ -21,7 +21,9 @@ stderr_log="/var/log/$name.err"
# Uncomment if required # Uncomment if required
#JAVA_HOME=/usr/java8_64 #JAVA_HOME=/usr/java8_64
#JAVA_HOME=/opt/ibm/ibm-semeru-certified-11-jre #JAVA_HOME=/opt/ibm-semeru-open-8-jdk
#JAVA_HOME=/opt/ibm-semeru-open-11-jdk
#JAVA_HOME=/opt/ibm-semeru-open-17-jdk
#export JAVA_HOME #export JAVA_HOME
get_pid() { get_pid() {

View file

@ -15,21 +15,7 @@
## limitations under the License. ## limitations under the License.
## --------------------------------------------------------------------------- ## ---------------------------------------------------------------------------
# to configure camel main
# here you can configure options on camel main (see MainConfigurationProperties class)
camel.main.name = sysmon-client camel.main.name = sysmon-client
camel.main.jmxEnabled = false
# enable tracing
#camel.main.tracing = true
# bean introspection to log reflection based configuration
#camel.main.beanIntrospectionExtendedStatistics=true
#camel.main.beanIntrospectionLoggingLevel=INFO
# run in lightweight mode to be tiny as possible
camel.main.lightweight = true camel.main.lightweight = true
# and eager load classes camel.component.seda.queue-size = 100
#camel.main.eager-classloading = true
# limit the seda queue size
camel.component.seda.queue-size=10

View file

@ -1457,7 +1457,7 @@
"type": "linear" "type": "linear"
}, },
"showPoints": "never", "showPoints": "never",
"spanNulls": true, "spanNulls": 3600000,
"stacking": { "stacking": {
"group": "A", "group": "A",
"mode": "normal" "mode": "normal"
@ -1532,7 +1532,7 @@
}, },
{ {
"params": [ "params": [
"null" "none"
], ],
"type": "fill" "type": "fill"
} }
@ -1554,16 +1554,18 @@
"params": [], "params": [],
"type": "mean" "type": "mean"
}, },
{
"params": [
"$__interval"
],
"type": "non_negative_derivative"
},
{ {
"params": [ "params": [
5 5
], ],
"type": "moving_average" "type": "moving_average"
}, },
{
"params": [],
"type": "non_negative_difference"
},
{ {
"params": [ "params": [
"read" "read"
@ -1690,7 +1692,7 @@
}, },
{ {
"params": [ "params": [
"null" "none"
], ],
"type": "fill" "type": "fill"
} }
@ -1712,16 +1714,18 @@
"params": [], "params": [],
"type": "mean" "type": "mean"
}, },
{
"params": [
"$__interval"
],
"type": "non_negative_derivative"
},
{ {
"params": [ "params": [
5 5
], ],
"type": "moving_average" "type": "moving_average"
}, },
{
"params": [],
"type": "non_negative_difference"
},
{ {
"params": [ "params": [
"write" "write"
@ -1843,7 +1847,7 @@
}, },
{ {
"params": [ "params": [
"null" "none"
], ],
"type": "fill" "type": "fill"
} }
@ -1872,8 +1876,10 @@
"type": "moving_average" "type": "moving_average"
}, },
{ {
"params": [], "params": [
"type": "non_negative_difference" "$__interval"
],
"type": "non_negative_derivative"
}, },
{ {
"params": [ "params": [
@ -1996,7 +2002,7 @@
}, },
{ {
"params": [ "params": [
"null" "none"
], ],
"type": "fill" "type": "fill"
} }
@ -2025,8 +2031,10 @@
"type": "moving_average" "type": "moving_average"
}, },
{ {
"params": [], "params": [
"type": "non_negative_difference" "$__interval"
],
"type": "non_negative_derivative"
}, },
{ {
"params": [ "params": [
@ -2230,11 +2238,13 @@
}, },
{ {
"params": [], "params": [],
"type": "mean" "type": "last"
}, },
{ {
"params": [], "params": [
"type": "non_negative_difference" "$__interval"
],
"type": "non_negative_derivative"
}, },
{ {
"params": [ "params": [
@ -2252,11 +2262,13 @@
}, },
{ {
"params": [], "params": [],
"type": "mean" "type": "last"
}, },
{ {
"params": [], "params": [
"type": "non_negative_difference" "$__interval"
],
"type": "non_negative_derivative"
}, },
{ {
"params": [ "params": [
@ -2274,11 +2286,13 @@
}, },
{ {
"params": [], "params": [],
"type": "mean" "type": "last"
}, },
{ {
"params": [], "params": [
"type": "non_negative_difference" "$__interval"
],
"type": "non_negative_derivative"
}, },
{ {
"params": [ "params": [
@ -2296,11 +2310,13 @@
}, },
{ {
"params": [], "params": [],
"type": "mean" "type": "last"
}, },
{ {
"params": [], "params": [
"type": "non_negative_difference" "$__interval"
],
"type": "non_negative_derivative"
}, },
{ {
"params": [ "params": [
@ -2318,11 +2334,13 @@
}, },
{ {
"params": [], "params": [],
"type": "mean" "type": "last"
}, },
{ {
"params": [], "params": [
"type": "non_negative_difference" "$__interval"
],
"type": "non_negative_derivative"
}, },
{ {
"params": [ "params": [
@ -2340,15 +2358,13 @@
}, },
{ {
"params": [], "params": [],
"type": "mean" "type": "last"
}, },
{ {
"params": [], "params": [
"type": "non_negative_difference" "$__interval"
}, ],
{ "type": "non_negative_derivative"
"params": [],
"type": "non_negative_difference"
}, },
{ {
"params": [ "params": [
@ -2366,11 +2382,13 @@
}, },
{ {
"params": [], "params": [],
"type": "mean" "type": "last"
}, },
{ {
"params": [], "params": [
"type": "non_negative_difference" "$__interval"
],
"type": "non_negative_derivative"
}, },
{ {
"params": [ "params": [
@ -2388,11 +2406,13 @@
}, },
{ {
"params": [], "params": [],
"type": "mean" "type": "last"
}, },
{ {
"params": [], "params": [
"type": "non_negative_difference" "$__interval"
],
"type": "non_negative_derivative"
}, },
{ {
"params": [ "params": [
@ -2545,14 +2565,16 @@
"type": "mean" "type": "mean"
}, },
{ {
"params": [], "params": [
"type": "non_negative_difference" 5
],
"type": "moving_average"
}, },
{ {
"params": [ "params": [
10 "$__interval"
], ],
"type": "moving_average" "type": "non_negative_derivative"
} }
] ]
], ],
@ -3129,6 +3151,6 @@
"timezone": "", "timezone": "",
"title": "Sysmon - Host Overview", "title": "Sysmon - Host Overview",
"uid": "QkVPjseMt", "uid": "QkVPjseMt",
"version": 15, "version": 18,
"weekStart": "" "weekStart": ""
} }

View file

@ -196,7 +196,7 @@
}, },
{ {
"params": [ "params": [
"null" "none"
], ],
"type": "fill" "type": "fill"
} }
@ -218,6 +218,12 @@
"params": [], "params": [],
"type": "mean" "type": "mean"
}, },
{
"params": [
10
],
"type": "moving_average"
},
{ {
"params": [ "params": [
"5min" "5min"
@ -340,7 +346,7 @@
}, },
{ {
"params": [ "params": [
"null" "none"
], ],
"type": "fill" "type": "fill"
} }
@ -361,6 +367,12 @@
{ {
"params": [], "params": [],
"type": "mean" "type": "mean"
},
{
"params": [
10
],
"type": "moving_average"
} }
] ]
], ],
@ -478,7 +490,7 @@
}, },
{ {
"params": [ "params": [
"null" "none"
], ],
"type": "fill" "type": "fill"
} }
@ -499,6 +511,12 @@
{ {
"params": [], "params": [],
"type": "mean" "type": "mean"
},
{
"params": [
10
],
"type": "moving_average"
} }
] ]
], ],
@ -617,7 +635,7 @@
}, },
{ {
"params": [ "params": [
"null" "none"
], ],
"type": "fill" "type": "fill"
} }
@ -638,6 +656,12 @@
{ {
"params": [], "params": [],
"type": "mean" "type": "mean"
},
{
"params": [
10
],
"type": "moving_average"
} }
] ]
], ],
@ -709,6 +733,6 @@
"timezone": "", "timezone": "",
"title": "Sysmon - IBM Power", "title": "Sysmon - IBM Power",
"uid": "3zPCIbN4z", "uid": "3zPCIbN4z",
"version": 6, "version": 7,
"weekStart": "" "weekStart": ""
} }

View file

@ -697,7 +697,7 @@
}, },
{ {
"params": [ "params": [
"null" "none"
], ],
"type": "fill" "type": "fill"
} }
@ -722,8 +722,10 @@
"type": "sum" "type": "sum"
}, },
{ {
"params": [], "params": [
"type": "non_negative_difference" "$__interval"
],
"type": "non_negative_derivative"
}, },
{ {
"params": [ "params": [
@ -744,8 +746,10 @@
"type": "sum" "type": "sum"
}, },
{ {
"params": [], "params": [
"type": "non_negative_difference" "$__interval"
],
"type": "non_negative_derivative"
}, },
{ {
"params": [ "params": [
@ -961,7 +965,9 @@
"refresh": "1m", "refresh": "1m",
"schemaVersion": 37, "schemaVersion": 37,
"style": "dark", "style": "dark",
"tags": [], "tags": [
"sysmon"
],
"templating": { "templating": {
"list": [ "list": [
{ {
@ -1049,6 +1055,6 @@
"timezone": "", "timezone": "",
"title": "Sysmon - Process Explorer", "title": "Sysmon - Process Explorer",
"uid": "Vjut5mS7k", "uid": "Vjut5mS7k",
"version": 3, "version": 5,
"weekStart": "" "weekStart": ""
} }

View file

@ -1,4 +1,4 @@
version = 1.0.23 version = 1.0.24
pf4jVersion = 3.7.0 pf4jVersion = 3.7.0
slf4jVersion = 2.0.3 slf4jVersion = 2.0.3
camelVersion = 3.14.5 camelVersion = 3.14.5

View file

@ -27,6 +27,8 @@ public class BaseDiskExtension implements MetricExtension {
private String interval = "10s"; private String interval = "10s";
private HardwareAbstractionLayer hardwareAbstractionLayer; private HardwareAbstractionLayer hardwareAbstractionLayer;
private List<HWDiskStore> diskStores;
private int refreshCounter = 0;
@Override @Override
@ -82,10 +84,15 @@ public class BaseDiskExtension implements MetricExtension {
public MetricResult getMetrics() { public MetricResult getMetrics() {
ArrayList<Measurement> measurementList = new ArrayList<>(); ArrayList<Measurement> measurementList = new ArrayList<>();
List<HWDiskStore> diskStores = hardwareAbstractionLayer.getDiskStores(); if(diskStores == null || refreshCounter++ > 360) {
log.info("getMetrics() - refreshing list of disk stores");
diskStores = hardwareAbstractionLayer.getDiskStores();
refreshCounter = 0;
}
for(HWDiskStore store : diskStores) { for(HWDiskStore store : diskStores) {
store.updateAttributes();
String name = store.getName(); String name = store.getName();
if (name.matches("h?disk[0-9]+") || if (name.matches("h?disk[0-9]+") ||
//name.matches("/dev/dm-[0-9]+") || //name.matches("/dev/dm-[0-9]+") ||

View file

@ -36,6 +36,8 @@ public class BaseFilesystemExtension implements MetricExtension {
private HardwareAbstractionLayer hardwareAbstractionLayer; private HardwareAbstractionLayer hardwareAbstractionLayer;
private SystemInfo systemInfo; private SystemInfo systemInfo;
private List<OSFileStore> fileStores;
private int refreshCounter = 0;
@Override @Override
@ -103,7 +105,10 @@ public class BaseFilesystemExtension implements MetricExtension {
ArrayList<String> alreadyProcessed = new ArrayList<>(); ArrayList<String> alreadyProcessed = new ArrayList<>();
ArrayList<Measurement> measurementList = new ArrayList<>(); ArrayList<Measurement> measurementList = new ArrayList<>();
List<OSFileStore> fileStores = systemInfo.getOperatingSystem().getFileSystem().getFileStores(true);
if(fileStores == null || refreshCounter++ > 360) {
fileStores = systemInfo.getOperatingSystem().getFileSystem().getFileStores(true);
}
for(OSFileStore store : fileStores) { for(OSFileStore store : fileStores) {
@ -125,7 +130,9 @@ public class BaseFilesystemExtension implements MetricExtension {
log.debug("Skipping name: " + name); log.debug("Skipping name: " + name);
continue; continue;
} }
alreadyProcessed.add(name); alreadyProcessed.add(name);
store.updateAttributes();
TreeMap<String, String> tagsMap = new TreeMap<String, String>() {{ TreeMap<String, String> tagsMap = new TreeMap<String, String>() {{
put("name", name); put("name", name);

View file

@ -28,7 +28,7 @@ def projectName = "sysmon-server"
application { application {
// Define the main class for the application. // Define the main class for the application.
mainClass.set('sysmon.server.Application') mainClass.set('sysmon.server.Application')
applicationDefaultJvmArgs = [ "-server", "-Xms64m", "-Xmx64m", "-XX:+ExitOnOutOfMemoryError", "-XX:+AlwaysPreTouch" ] applicationDefaultJvmArgs = [ "-Xms64m", "-Xmx64m", "-XX:+ExitOnOutOfMemoryError", "-XX:+AlwaysPreTouch" ]
} }
run { run {

View file

@ -15,18 +15,5 @@
## limitations under the License. ## limitations under the License.
## --------------------------------------------------------------------------- ## ---------------------------------------------------------------------------
# to configure camel main
# here you can configure options on camel main (see MainConfigurationProperties class)
camel.main.name = sysmon-server camel.main.name = sysmon-server
# enable tracing
#camel.main.tracing = true
# bean introspection to log reflection based configuration
#camel.main.beanIntrospectionExtendedStatistics=true
#camel.main.beanIntrospectionLoggingLevel=INFO
# run in lightweight mode to be tiny as possible
camel.main.lightweight = true camel.main.lightweight = true
# and eager load classes
#camel.main.eager-classloading = true