changeset 597:e5e096814c43

SNMP CPU Idle and User
author Devel 3
date Wed, 04 Oct 2017 14:45:22 +0200
parents db129043835c
children 7cc4c88a12b5
files stress-tester-reporter/src/main/java/com/passus/st/reporter/snmp/SnmpLogger.java
diffstat 1 files changed, 15 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/stress-tester-reporter/src/main/java/com/passus/st/reporter/snmp/SnmpLogger.java	Wed Oct 04 13:26:22 2017 +0200
+++ b/stress-tester-reporter/src/main/java/com/passus/st/reporter/snmp/SnmpLogger.java	Wed Oct 04 14:45:22 2017 +0200
@@ -31,6 +31,8 @@
     private OID oid_ramTotal = new OID(".1.3.6.1.4.1.2021.4.5.0");
     private OID oid_swapFree = new OID(".1.3.6.1.4.1.2021.4.4.0");
     private OID oid_swapTotal = new OID(".1.3.6.1.4.1.2021.4.3.0");
+    private OID oid_cpuUser = new OID(".1.3.6.1.4.1.2021.11.9.0");
+    private OID oid_cpuIdle = new OID(".1.3.6.1.4.1.2021.11.11.0");
 
     private final ScheduledExecutorService scheduler
             = Executors.newScheduledThreadPool(1);
@@ -90,15 +92,26 @@
             String swapFree = getAsString(oid_swapFree);
             String ramTotal = getAsString(oid_ramTotal);
             String swapTotal = getAsString(oid_swapTotal);
+            
+            String cpuUser = this.getAsString(oid_cpuUser);
+            String cpuIdle = this.getAsString(oid_cpuIdle);
             builder.append(cpuLoad1m);
             builder.append(";");
             builder.append(cpuLoad5m);
             builder.append(";");
             builder.append(cpuLoad15m);
             builder.append(";");
-            builder.append(Integer.parseInt(ramTotal) - Integer.parseInt(ramFree));
+            builder.append((Long.parseLong(ramTotal) - Long.parseLong(ramFree))*1024);
             builder.append(";");
-            builder.append(Integer.parseInt(swapTotal) - Integer.parseInt(swapFree));
+            builder.append((Long.parseLong(swapTotal) - Long.parseLong(swapFree))*1024);
+            builder.append(";");
+            builder.append((Long.parseLong(ramTotal))*1024);
+            builder.append(";");
+            builder.append((Long.parseLong(swapTotal))*1024);
+            builder.append(";");
+            builder.append(cpuUser);
+            builder.append(";");
+            builder.append(cpuIdle);
             builder.append("\n");
 
             out.write(builder.toString());