Initial work on script support
This commit is contained in:
parent
31b494163d
commit
79f3b3a81d
19
client/doc/scripts/ExampleScript.groovy
Executable file
19
client/doc/scripts/ExampleScript.groovy
Executable file
|
@ -0,0 +1,19 @@
|
|||
|
||||
class ExampleScript implements MetricScript {
|
||||
|
||||
MetricResult getMetrics() {
|
||||
Map<String,String> tags = new TreeMap<>();
|
||||
Map<String,Object> fields = new TreeMap<>();
|
||||
|
||||
tags.put("type", "temp");
|
||||
fields.put("sensor1", 23.2);
|
||||
fields.put("sensor2", 25.8);
|
||||
|
||||
Measurement measurement = new Measurement(tags, fields);
|
||||
return new MetricResult("script_sensors", measurement);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
import sysmon.shared.MetricResult
|
||||
import sysmon.shared.MetricScript
|
||||
import sysmon.shared.Measurement
|
||||
|
||||
class ExampleScript implements MetricScript {
|
||||
|
||||
@Override
|
||||
MetricResult getMetrics() {
|
||||
Map<String,String> tags = new TreeMap<>();
|
||||
Map<String,Object> fields = new TreeMap<>();
|
||||
|
||||
tags.put("location", "blabla");
|
||||
fields.put("temp1", 23);
|
||||
fields.put("temp2", 25);
|
||||
|
||||
Measurement measurement = new Measurement(tags, fields);
|
||||
return new MetricResult("script_example", measurement);
|
||||
}
|
||||
|
||||
}
|
39
plugins/linux/src/test/resources/sensors-1.json
Normal file
39
plugins/linux/src/test/resources/sensors-1.json
Normal file
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
"k10temp-pci-00c3":{
|
||||
"Adapter": "PCI adapter",
|
||||
"Tctl":{
|
||||
"temp1_input": 56.250
|
||||
}
|
||||
},
|
||||
"nvme-pci-0400":{
|
||||
"Adapter": "PCI adapter",
|
||||
"Composite":{
|
||||
"temp1_input": 35.850,
|
||||
"temp1_max": 74.850,
|
||||
"temp1_min": -20.150,
|
||||
"temp1_crit": 79.850,
|
||||
"temp1_alarm": 0.000
|
||||
}
|
||||
},
|
||||
"iwlwifi_1-virtual-0":{
|
||||
"Adapter": "Virtual device",
|
||||
"temp1":{
|
||||
"temp1_input": 37.000
|
||||
}
|
||||
},
|
||||
"amdgpu-pci-0500":{
|
||||
"Adapter": "PCI adapter",
|
||||
"vddgfx":{
|
||||
"in0_input": 0.681
|
||||
},
|
||||
"vddnb":{
|
||||
"in1_input": 0.712
|
||||
},
|
||||
"edge":{
|
||||
"temp1_input": 37.000
|
||||
},
|
||||
"PPT":{
|
||||
"power1_average": 0.000
|
||||
}
|
||||
}
|
||||
}
|
39
plugins/linux/src/test/resources/sensors-2.json
Normal file
39
plugins/linux/src/test/resources/sensors-2.json
Normal file
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
"k10temp-pci-00c3":{
|
||||
"Adapter": "PCI adapter",
|
||||
"Tctl":{
|
||||
"temp1_input": 53.875
|
||||
}
|
||||
},
|
||||
"nvme-pci-0400":{
|
||||
"Adapter": "PCI adapter",
|
||||
"Composite":{
|
||||
"temp1_input": 36.850,
|
||||
"temp1_max": 74.850,
|
||||
"temp1_min": -20.150,
|
||||
"temp1_crit": 79.850,
|
||||
"temp1_alarm": 0.000
|
||||
}
|
||||
},
|
||||
"iwlwifi_1-virtual-0":{
|
||||
"Adapter": "Virtual device",
|
||||
"temp1":{
|
||||
"temp1_input": 41.000
|
||||
}
|
||||
},
|
||||
"amdgpu-pci-0500":{
|
||||
"Adapter": "PCI adapter",
|
||||
"vddgfx":{
|
||||
"in0_input": 1.281
|
||||
},
|
||||
"vddnb":{
|
||||
"in1_input": 0.712
|
||||
},
|
||||
"edge":{
|
||||
"temp1_input": 42.000
|
||||
},
|
||||
"PPT":{
|
||||
"power1_average": 0.000
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
# AIX Plugin
|
||||
# IBM Power Plugin
|
||||
|
||||
## LPAR Processor Extension
|
||||
## Power LPAR Processor Extension
|
||||
|
||||
The processor extension works for both AIX and Linux on the Power ppc64/ppc64le architecture.
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
plugins {
|
||||
id 'groovy'
|
||||
id 'java-library'
|
||||
id 'maven-publish'
|
||||
}
|
||||
|
||||
repositories {
|
||||
|
@ -33,3 +34,21 @@ tasks.named('test') {
|
|||
// Use junit platform for unit tests.
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
publishing {
|
||||
repositories {
|
||||
maven {
|
||||
name = "GitHubPackages"
|
||||
url = uri("https://maven.pkg.github.com/Danish-Sensor-Engineering/libsensor")
|
||||
credentials {
|
||||
username = project.findProperty("gpr.user") ?: System.getenv("USERNAME")
|
||||
password = project.findProperty("gpr.key") ?: System.getenv("TOKEN")
|
||||
}
|
||||
}
|
||||
}
|
||||
publications {
|
||||
gpr(MavenPublication) {
|
||||
from(components.java)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue