Bump OSHI dependency and version.

This commit is contained in:
Mark Nellemann 2022-11-30 08:58:07 +01:00
parent 6ffc943a51
commit d9cc633626
3 changed files with 10 additions and 23 deletions

View file

@ -1,9 +1,9 @@
version = 1.0.24 version = 1.0.25
pf4jVersion = 3.7.0 pf4jVersion = 3.7.0
slf4jVersion = 2.0.3 slf4jVersion = 2.0.4
camelVersion = 3.14.5 camelVersion = 3.14.5
groovyVersion = 3.0.13 groovyVersion = 3.0.13
picocliVersion = 4.7.0 picocliVersion = 4.7.0
oshiVersion = 6.3.1 oshiVersion = 6.3.2
spockVersion = 2.3-groovy-3.0 spockVersion = 2.3-groovy-3.0
tomljVersion = 1.1.0 tomljVersion = 1.1.0

View file

@ -27,6 +27,8 @@ public class BaseNetworkExtension implements MetricExtension {
private String interval = "10s"; private String interval = "10s";
private HardwareAbstractionLayer hardwareAbstractionLayer; private HardwareAbstractionLayer hardwareAbstractionLayer;
private List<NetworkIF> interfaces;
private int refreshCounter = 0;
@Override @Override
@ -82,8 +84,12 @@ public class BaseNetworkExtension implements MetricExtension {
public MetricResult getMetrics() { public MetricResult getMetrics() {
ArrayList<Measurement> measurementList = new ArrayList<>(); ArrayList<Measurement> measurementList = new ArrayList<>();
if(interfaces == null || refreshCounter++ > 360) {
log.info("getMetrics() - refreshing list of network interfaces");
interfaces = hardwareAbstractionLayer.getNetworkIFs();
refreshCounter = 0;
}
List<NetworkIF> interfaces = hardwareAbstractionLayer.getNetworkIFs();
for(NetworkIF netif : interfaces) { for(NetworkIF netif : interfaces) {
TreeMap<String, String> tagsMap = new TreeMap<String, String>() {{ TreeMap<String, String> tagsMap = new TreeMap<String, String>() {{

View file

@ -38,25 +38,6 @@ public class ComboResultToPointProcessor implements Processor {
.tag(measurement.getTags()) .tag(measurement.getTags())
.fields(measurement.getFields()); .fields(measurement.getFields());
/*
for (Map.Entry<String,String> entry : measurement.getTags().entrySet()) {
//log.info("process() - tag: " + entry.getKey() + "=" + entry.getValue());
point.tag(entry.getKey(), entry.getValue());
}
for (Map.Entry<String,Object> entry : measurement.getFields().entrySet()) {
//log.info("process() - field: " + entry.getKey() + "=" + entry.getValue());
if(entry.getValue() instanceof Number) {
Number num = (Number) entry.getValue();
point.addField(entry.getKey(), num);
} else if(entry.getValue() instanceof Boolean) {
Boolean bol = (Boolean) entry.getValue();
point.addField(entry.getKey(), bol);
} else {
String str = (String) entry.getValue();
point.addField(entry.getKey(), str);
}
}*/
batchPoints.point(point.build()); batchPoints.point(point.build());
} }