Detect windows disks.

This commit is contained in:
Mark Nellemann 2022-03-30 13:36:54 +02:00
parent b5ae2e29dc
commit c96274fa4f
3 changed files with 10 additions and 7 deletions

View file

@ -1,6 +1,7 @@
version = 0.1.11 version = 0.1.12
pf4jVersion = 3.6.0 pf4jVersion = 3.6.0
slf4jVersion = 1.7.36 slf4jVersion = 1.7.36
camelVersion = 3.14.1 camelVersion = 3.14.2
groovyVersion = 3.0.10
picocliVersion = 4.6.3 picocliVersion = 4.6.3
oshiVersion = 6.1.4 oshiVersion = 6.1.5

View file

@ -81,7 +81,7 @@ 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]")) { 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")) {
HashMap<String, String> tagsMap = new HashMap<String, String>() {{ HashMap<String, String> tagsMap = new HashMap<String, String>() {{
put("name", name); put("name", name);
@ -96,6 +96,8 @@ 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 {
log.debug("getMetrics() - skipping device: {}", name);
} }
} }

View file

@ -17,9 +17,9 @@ repositories {
} }
dependencies { dependencies {
testImplementation 'org.codehaus.groovy:groovy:3.0.9' testImplementation "org.codehaus.groovy:groovy:${groovyVersion}"
testImplementation 'org.spockframework:spock-core:2.0-groovy-3.0' testImplementation "org.spockframework:spock-core:2.0-groovy-3.0"
testImplementation 'junit:junit:4.13.2' testImplementation "junit:junit:4.13.2"
testImplementation "org.slf4j:slf4j-api:${slf4jVersion}" testImplementation "org.slf4j:slf4j-api:${slf4jVersion}"
implementation "org.slf4j:slf4j-api:${slf4jVersion}" implementation "org.slf4j:slf4j-api:${slf4jVersion}"