This is an automated email from the ASF dual-hosted git repository.
donalevans pushed a commit to branch support/1.13
in repository https://gitbox.apache.org/repos/asf/geode.git
The following commit(s) were added to refs/heads/support/1.13 by this push:
new 66d33fe GEODE-8734: Parse netstat file to ensure correct stats are
retrieved (#5782)
66d33fe is described below
commit 66d33fe3593d7b4a59da06045fd0d20636883579
Author: Donal Evans <[email protected]>
AuthorDate: Tue Dec 1 09:33:25 2020 -0800
GEODE-8734: Parse netstat file to ensure correct stats are retrieved (#5782)
Authored-by: Donal Evans <[email protected]>
(cherry picked from commit 790af0d473bbe2444fb896d8b77c64116c463774)
---
...eplicateWithExpirationClearIntegrationTest.java | 4 +-
.../internal/statistics/LinuxSystemStatsTest.java | 66 ++++-
.../statistics/platform/LinuxProcFsStatistics.java | 76 ++++--
.../statistics/platform/LinuxSystemStats.java | 280 +++++++++++++--------
4 files changed, 285 insertions(+), 141 deletions(-)
diff --git
a/geode-core/src/test/java/org/apache/geode/internal/cache/ReplicateWithExpirationClearIntegrationTest.java
b/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/ReplicateWithExpirationClearIntegrationTest.java
similarity index 97%
rename from
geode-core/src/test/java/org/apache/geode/internal/cache/ReplicateWithExpirationClearIntegrationTest.java
rename to
geode-core/src/integrationTest/java/org/apache/geode/internal/cache/ReplicateWithExpirationClearIntegrationTest.java
index 6ddb31c..d6aec35 100644
---
a/geode-core/src/test/java/org/apache/geode/internal/cache/ReplicateWithExpirationClearIntegrationTest.java
+++
b/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/ReplicateWithExpirationClearIntegrationTest.java
@@ -50,7 +50,9 @@ public class ReplicateWithExpirationClearIntegrationTest {
@After
public void tearDown() {
- cache.close();
+ if (cache != null) {
+ cache.close();
+ }
}
@Test
diff --git
a/geode-core/src/integrationTest/java/org/apache/geode/internal/statistics/LinuxSystemStatsTest.java
b/geode-core/src/integrationTest/java/org/apache/geode/internal/statistics/LinuxSystemStatsTest.java
index e096be0..61e8766 100644
---
a/geode-core/src/integrationTest/java/org/apache/geode/internal/statistics/LinuxSystemStatsTest.java
+++
b/geode-core/src/integrationTest/java/org/apache/geode/internal/statistics/LinuxSystemStatsTest.java
@@ -14,6 +14,14 @@
*/
package org.apache.geode.internal.statistics;
+import static
org.apache.geode.internal.statistics.platform.LinuxProcFsStatistics.TCP_LISTEN_DROPS_NAME;
+import static
org.apache.geode.internal.statistics.platform.LinuxProcFsStatistics.TCP_LISTEN_OVERFLOWS_NAME;
+import static
org.apache.geode.internal.statistics.platform.LinuxProcFsStatistics.TCP_SYNCOOKIES_RECV_NAME;
+import static
org.apache.geode.internal.statistics.platform.LinuxProcFsStatistics.TCP_SYNCOOKIES_SENT_NAME;
+import static
org.apache.geode.internal.statistics.platform.LinuxSystemStats.TCP_EXT_LISTEN_DROPS;
+import static
org.apache.geode.internal.statistics.platform.LinuxSystemStats.TCP_EXT_LISTEN_OVERFLOWS;
+import static
org.apache.geode.internal.statistics.platform.LinuxSystemStats.TCP_EXT_SYN_COOKIES_RECV;
+import static
org.apache.geode.internal.statistics.platform.LinuxSystemStats.TCP_EXT_SYN_COOKIES_SENT;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.anyString;
@@ -93,7 +101,7 @@ public class LinuxSystemStatsTest extends
StatSamplerTestCase {
// add on 4 clicks 4 idle 0 steal
"cpu 0 0 0 4 0 0 0 0 0 0"};
- doTest(results, 0);
+ doStealTimeTest(results, 0);
}
@Test
@@ -102,7 +110,7 @@ public class LinuxSystemStatsTest extends
StatSamplerTestCase {
// add on 4 clicks 3 idle 1 steal
"cpu 0 0 0 3 0 0 0 1 0 0"};
- doTest(results, 25);
+ doStealTimeTest(results, 25);
}
@Test
@@ -111,7 +119,7 @@ public class LinuxSystemStatsTest extends
StatSamplerTestCase {
// add on 3 clicks 1 idle 2 steal
"cpu 0 0 0 1 0 0 0 2 0 0"};
- doTest(results, 66);
+ doStealTimeTest(results, 66);
}
@Test
@@ -120,10 +128,38 @@ public class LinuxSystemStatsTest extends
StatSamplerTestCase {
// add on 1 clicks 0 idle 1 steal
"cpu 0 0 0 0 0 0 0 1 0 0"};
- doTest(results, 100);
+ doStealTimeTest(results, 100);
}
- private void doTest(String[] results, int expectedStatValue) throws
Exception {
+ @Test
+ public void netstatStatsTest() throws Exception {
+ long expectedSyncookiesSent = 1L;
+ long expectedSyncookiesRecv = 2L;
+ long dummyStatValue = -1L;
+ long expectedListenOverflows = 3L;
+ long expectedListenDrops = 4L;
+
+ // This string simulates the contents of the /proc/net/netstat file,
omitting all stats that
+ // aren't parsed in the LinuxProcFsStatistics.getNetStatStats() method and
including a dummy
+ // stat that should not be parsed
+ String mockNetstatStats = "TcpExt: " + TCP_SYNCOOKIES_SENT_NAME + " " +
TCP_SYNCOOKIES_RECV_NAME
+ + " DummyStat " + TCP_LISTEN_OVERFLOWS_NAME + " " +
TCP_LISTEN_DROPS_NAME + "\n"
+ + "TcpExt: " + expectedSyncookiesSent + " " + expectedSyncookiesRecv +
" " + dummyStatValue
+ + " " + expectedListenOverflows + " " + expectedListenDrops;
+
+ Answer<FileInputStream> answer = new MyNetstatAnswer(mockNetstatStats);
+
PowerMockito.whenNew(FileInputStream.class).withArguments(anyString()).thenAnswer(answer);
+
+ LinuxProcFsStatistics.refreshSystem(localStats);
+
+ Statistics statistics =
getStatisticsManager().findStatisticsByTextId("LinuxSystemStats")[0];
+
assertThat(statistics.getLong(TCP_EXT_SYN_COOKIES_SENT)).isEqualTo(expectedSyncookiesSent);
+
assertThat(statistics.getLong(TCP_EXT_SYN_COOKIES_RECV)).isEqualTo(expectedSyncookiesRecv);
+
assertThat(statistics.getLong(TCP_EXT_LISTEN_OVERFLOWS)).isEqualTo(expectedListenOverflows);
+
assertThat(statistics.getLong(TCP_EXT_LISTEN_DROPS)).isEqualTo(expectedListenDrops);
+ }
+
+ private void doStealTimeTest(String[] results, int expectedStatValue) throws
Exception {
Answer<FileInputStream> answer = new MyStealTimeAnswer(results);
PowerMockito.whenNew(FileInputStream.class).withArguments(anyString()).thenAnswer(answer);
@@ -186,4 +222,24 @@ public class LinuxSystemStatsTest extends
StatSamplerTestCase {
return bogus;
}
}
+
+ private class MyNetstatAnswer implements Answer<FileInputStream> {
+
+ private final FileInputStream results;
+ private final FileInputStream bogus;
+
+ MyNetstatAnswer(String sample) throws IOException {
+ results = new FileInputStream(writeStringToFile(sample));
+ bogus = new FileInputStream(writeStringToFile(""));
+ }
+
+ @Override
+ public FileInputStream answer(InvocationOnMock invocation) throws
Throwable {
+ // Since we are mocking the test we can run this test on any OS.
+ if ("/proc/net/netstat".equals(invocation.getArgument(0))) {
+ return results;
+ }
+ return bogus;
+ }
+ }
}
diff --git
a/geode-core/src/main/java/org/apache/geode/internal/statistics/platform/LinuxProcFsStatistics.java
b/geode-core/src/main/java/org/apache/geode/internal/statistics/platform/LinuxProcFsStatistics.java
index bd60ac3..90ad333 100644
---
a/geode-core/src/main/java/org/apache/geode/internal/statistics/platform/LinuxProcFsStatistics.java
+++
b/geode-core/src/main/java/org/apache/geode/internal/statistics/platform/LinuxProcFsStatistics.java
@@ -20,8 +20,10 @@ import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
+import java.util.HashSet;
import java.util.List;
import java.util.NoSuchElementException;
+import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -85,6 +87,12 @@ public class LinuxProcFsStatistics {
private static final String PSWPIN = "pswpin ";
private static final String PSWPOUT = "pswpout ";
+ /** /proc/net/netstat tokens */
+ public static final String TCP_SYNCOOKIES_SENT_NAME = "SyncookiesSent";
+ public static final String TCP_SYNCOOKIES_RECV_NAME = "SyncookiesRecv";
+ public static final String TCP_LISTEN_OVERFLOWS_NAME = "ListenOverflows";
+ public static final String TCP_LISTEN_DROPS_NAME = "ListenDrops";
+
// Do not create instances of this class
private LinuxProcFsStatistics() {}
@@ -351,34 +359,54 @@ public class LinuxProcFsStatistics {
}
}
- /*
- * TcpExt:=0 SyncookiesSent=1
- * ListenOverflows=20 ListenDrops=21
- */
private static void getNetStatStats(LocalStatisticsImpl stats) {
- try (InputStreamReader isr = new InputStreamReader(new
FileInputStream("/proc/net/netstat"))) {
- BufferedReader br = new BufferedReader(isr);
- String line;
+ SpaceTokenizer headerTokenizer = new SpaceTokenizer();
+ try (FileInputStream fileInputStream = new
FileInputStream("/proc/net/netstat");
+ InputStreamReader isr = new InputStreamReader(fileInputStream);
+ BufferedReader br = new BufferedReader(isr)) {
+
+ String line = br.readLine(); // header;
+ headerTokenizer.setString(line);
+
do {
- br.readLine(); // header
line = br.readLine();
} while (line != null && !line.startsWith("TcpExt:"));
tokenizer.setString(line);
- tokenizer.skipTokens(1);
- long tcpSyncookiesSent = tokenizer.nextTokenAsLong();
- long tcpSyncookiesRecv = tokenizer.nextTokenAsLong();
- tokenizer.skipTokens(17);
- long tcpListenOverflows = tokenizer.nextTokenAsLong();
- long tcpListenDrops = tokenizer.nextTokenAsLong();
-
- stats.setLong(LinuxSystemStats.tcpExtSynCookiesRecvLONG,
tcpSyncookiesRecv);
- stats.setLong(LinuxSystemStats.tcpExtSynCookiesSentLONG,
tcpSyncookiesSent);
- stats.setLong(LinuxSystemStats.tcpExtListenDropsLONG, tcpListenDrops);
- stats.setLong(LinuxSystemStats.tcpExtListenOverflowsLONG,
tcpListenOverflows);
-
- br.close();
- br = null;
+
+ Set<String> tokenNames = new HashSet<>();
+
+ tokenNames.add(TCP_SYNCOOKIES_SENT_NAME);
+ tokenNames.add(TCP_SYNCOOKIES_RECV_NAME);
+ tokenNames.add(TCP_LISTEN_OVERFLOWS_NAME);
+ tokenNames.add(TCP_LISTEN_DROPS_NAME);
+
+ // Find the token position for each stat we're interested in from the
header line and read the
+ // corresponding token from the stats line
+ while (headerTokenizer.hasMoreTokens() && !tokenNames.isEmpty()) {
+ String currentToken = headerTokenizer.peekToken();
+ if (tokenNames.contains(currentToken)) {
+ long statValue = SpaceTokenizer.parseAsLong(tokenizer.peekToken());
+ switch (currentToken) {
+ case TCP_SYNCOOKIES_SENT_NAME:
+ stats.setLong(LinuxSystemStats.tcpExtSynCookiesSentLONG,
statValue);
+ break;
+ case TCP_SYNCOOKIES_RECV_NAME:
+ stats.setLong(LinuxSystemStats.tcpExtSynCookiesRecvLONG,
statValue);
+ break;
+ case TCP_LISTEN_OVERFLOWS_NAME:
+ stats.setLong(LinuxSystemStats.tcpExtListenOverflowsLONG,
statValue);
+ break;
+ case TCP_LISTEN_DROPS_NAME:
+ stats.setLong(LinuxSystemStats.tcpExtListenDropsLONG, statValue);
+ break;
+ }
+ tokenNames.remove(currentToken);
+ }
+ headerTokenizer.skipToken();
+ tokenizer.skipToken();
+ }
+
if (!soMaxConnProcessed) {
try (InputStreamReader soMaxConnIsr =
new InputStreamReader(new
FileInputStream("/proc/sys/net/core/somaxconn"))) {
@@ -392,10 +420,10 @@ public class LinuxProcFsStatistics {
stats.setLong(LinuxSystemStats.tcpSOMaxConnLONG, soMaxConn);
- } catch (NoSuchElementException nsee) {
- } catch (IOException ioe) {
+ } catch (NoSuchElementException | IOException ignore) {
} finally {
tokenizer.releaseResources();
+ headerTokenizer.releaseResources();
}
}
diff --git
a/geode-core/src/main/java/org/apache/geode/internal/statistics/platform/LinuxSystemStats.java
b/geode-core/src/main/java/org/apache/geode/internal/statistics/platform/LinuxSystemStats.java
index de0ff83..b241c97 100644
---
a/geode-core/src/main/java/org/apache/geode/internal/statistics/platform/LinuxSystemStats.java
+++
b/geode-core/src/main/java/org/apache/geode/internal/statistics/platform/LinuxSystemStats.java
@@ -92,223 +92,281 @@ public class LinuxSystemStats {
@Immutable
private static final StatisticsType myType;
+ public static final String ALLOCATED_SWAP = "allocatedSwap";
+ public static final String BUFFER_MEMORY = "bufferMemory";
+ public static final String SHARED_MEMORY = "sharedMemory";
+ public static final String CPU_ACTIVE = "cpuActive";
+ public static final String CPU_IDLE = "cpuIdle";
+ public static final String CPU_NICE = "cpuNice";
+ public static final String CPU_SYSTEM = "cpuSystem";
+ public static final String CPU_USER = "cpuUser";
+ public static final String IOWAIT = "iowait";
+ public static final String IRQ = "irq";
+ public static final String SOFTIRQ = "softirq";
+ public static final String CPUS = "cpus";
+ public static final String FREE_MEMORY = "freeMemory";
+ public static final String PHYSICAL_MEMORY = "physicalMemory";
+ public static final String PROCESSES = "processes";
+ public static final String UNALLOCATED_SWAP = "unallocatedSwap";
+ public static final String CACHED_MEMORY = "cachedMemory";
+ public static final String DIRTY_MEMORY = "dirtyMemory";
+ public static final String CPU_NON_USER = "cpuNonUser";
+ public static final String CPU_STEAL = "cpuSteal";
+ public static final String SO_MAX_CONN = "soMaxConn";
+ public static final String LOOPBACK_PACKETS = "loopbackPackets";
+ public static final String LOOPBACK_BYTES = "loopbackBytes";
+ public static final String RECV_PACKETS = "recvPackets";
+ public static final String RECV_BYTES = "recvBytes";
+ public static final String RECV_ERRORS = "recvErrors";
+ public static final String RECV_DROPS = "recvDrops";
+ public static final String XMIT_PACKETS = "xmitPackets";
+ public static final String XMIT_BYTES = "xmitBytes";
+ public static final String XMIT_ERRORS = "xmitErrors";
+ public static final String XMIT_DROPS = "xmitDrops";
+ public static final String XMIT_COLLISIONS = "xmitCollisions";
+ public static final String CONTEXT_SWITCHES = "contextSwitches";
+ public static final String PROCESS_CREATES = "processCreates";
+ public static final String PAGES_PAGED_IN = "pagesPagedIn";
+ public static final String PAGES_PAGED_OUT = "pagesPagedOut";
+ public static final String PAGES_SWAPPED_IN = "pagesSwappedIn";
+ public static final String PAGES_SWAPPED_OUT = "pagesSwappedOut";
+ public static final String DISK_READS_COMPLETED = "diskReadsCompleted";
+ public static final String DISK_READS_MERGED = "diskReadsMerged";
+ public static final String DISK_BYTES_READ = "diskBytesRead";
+ public static final String DISK_TIME_READING = "diskTimeReading";
+ public static final String DISK_WRITES_COMPLETED = "diskWritesCompleted";
+ public static final String DISK_WRITES_MERGED = "diskWritesMerged";
+ public static final String DISK_BYTES_WRITTEN = "diskBytesWritten";
+ public static final String DISK_TIME_WRITING = "diskTimeWriting";
+ public static final String DISK_OPS_IN_PROGRESS = "diskOpsInProgress";
+ public static final String DISK_TIME_IN_PROGRESS = "diskTimeInProgress";
+ public static final String DISK_TIME = "diskTime";
+ public static final String TCP_EXT_SYN_COOKIES_RECV = "tcpExtSynCookiesRecv";
+ public static final String TCP_EXT_SYN_COOKIES_SENT = "tcpExtSynCookiesSent";
+ public static final String TCP_EXT_LISTEN_DROPS = "tcpExtListenDrops";
+ public static final String TCP_EXT_LISTEN_OVERFLOWS =
"tcpExtListenOverflows";
+
+ public static final String LOAD_AVERAGE_1 = "loadAverage1";
+ public static final String LOAD_AVERAGE_15 = "loadAverage15";
+ public static final String LOAD_AVERAGE_5 = "loadAverage5";
+
static {
StatisticsTypeFactory f = StatisticsTypeFactoryImpl.singleton();
myType = f.createType("LinuxSystemStats", "Statistics on a Linux machine.",
new StatisticDescriptor[] {
- f.createLongGauge("allocatedSwap",
+ f.createLongGauge(ALLOCATED_SWAP,
"The number of megabytes of swap space have actually been
written to. Swap space must be reserved before it can be allocated.",
"megabytes"),
- f.createLongGauge("bufferMemory",
+ f.createLongGauge(BUFFER_MEMORY,
"The number of megabytes of memory allocated to buffers.",
"megabytes"),
- f.createLongGauge("sharedMemory",
+ f.createLongGauge(SHARED_MEMORY,
"The number of megabytes of shared memory on the machine.",
"megabytes", true),
- f.createLongGauge("cpuActive",
+ f.createLongGauge(CPU_ACTIVE,
"The percentage of the total available time that has been used
in a non-idle state.",
"%"),
- f.createLongGauge("cpuIdle",
+ f.createLongGauge(CPU_IDLE,
"The percentage of the total available time that has been
spent sleeping.", "%",
true),
- f.createLongGauge("cpuNice",
+ f.createLongGauge(CPU_NICE,
"The percentage of the total available time that has been used
to execute user code in processes with low priority.",
"%"),
- f.createLongGauge("cpuSystem",
+ f.createLongGauge(CPU_SYSTEM,
"The percentage of the total available time that has been used
to execute system (i.e. kernel) code.",
"%"),
- f.createLongGauge("cpuUser",
+ f.createLongGauge(CPU_USER,
"The percentage of the total available time that has been used
to execute user code.",
"%"),
- f.createLongGauge("iowait",
+ f.createLongGauge(IOWAIT,
"The percentage of the total available time that has been used
to wait for I/O to complete.",
"%"),
- f.createLongGauge("irq",
+ f.createLongGauge(IRQ,
"The percentage of the total available time that has been used
servicing interrupts.",
"%"),
- f.createLongGauge("softirq",
+ f.createLongGauge(SOFTIRQ,
"The percentage of the total available time that has been used
servicing softirqs.",
"%"),
- f.createLongGauge("cpus", "The number of online cpus on the local
machine.", "items"),
- f.createLongGauge("freeMemory",
+ f.createLongGauge(CPUS, "The number of online cpus on the local
machine.", "items"),
+ f.createLongGauge(FREE_MEMORY,
"The number of megabytes of unused memory on the machine.",
"megabytes", true),
- f.createLongGauge("physicalMemory",
+ f.createLongGauge(PHYSICAL_MEMORY,
"The actual amount of total physical memory on the machine.",
"megabytes", true),
- f.createLongGauge("processes",
+ f.createLongGauge(PROCESSES,
"The number of processes in the computer at the time of data
collection. Notice that this is an instantaneous count, not an average over
the time interval. Each process represents the running of a program.",
"processes"),
- f.createLongGauge("unallocatedSwap",
+ f.createLongGauge(UNALLOCATED_SWAP,
"The number of megabytes of swap space that have not been
allocated.", "megabytes",
true),
- f.createLongGauge("cachedMemory",
+ f.createLongGauge(CACHED_MEMORY,
"The number of megabytes of memory used for the file system
cache.", "megabytes",
true),
- f.createLongGauge("dirtyMemory",
+ f.createLongGauge(DIRTY_MEMORY,
"The number of megabytes of memory in the file system cache
that need to be written.",
"megabytes", true),
- f.createLongGauge("cpuNonUser",
+ f.createLongGauge(CPU_NON_USER,
"The percentage of total available time that has been used to
execute non-user code.(includes system, iowait, irq, softirq etc.)",
"%"),
- f.createLongGauge("cpuSteal",
+ f.createLongGauge(CPU_STEAL,
"Steal time is the amount of time the operating system wanted
to execute, but was not allowed to by the hypervisor.",
"%"),
- f.createLongGauge("soMaxConn",
+ f.createLongGauge(SO_MAX_CONN,
"Maximum TCP/IP server socket connection request backlog",
"connection requests"),
- f.createLongCounter("loopbackPackets",
+ f.createLongCounter(LOOPBACK_PACKETS,
"The number of network packets sent (or received) on the
loopback interface",
"packets", false),
- f.createLongCounter("loopbackBytes",
+ f.createLongCounter(LOOPBACK_BYTES,
"The number of network bytes sent (or received) on the
loopback interface", "bytes",
false),
- f.createLongCounter("recvPackets",
+ f.createLongCounter(RECV_PACKETS,
"The total number of network packets received (excluding
loopback)", "packets",
false),
- f.createLongCounter("recvBytes",
+ f.createLongCounter(RECV_BYTES,
"The total number of network bytes received (excluding
loopback)", "bytes", false),
f.createLongCounter("recvErrors", "The total number of network
receive errors",
"errors", false),
- f.createLongCounter("recvDrops", "The total number network
receives dropped", "packets",
+ f.createLongCounter(RECV_DROPS, "The total number network receives
dropped", "packets",
false),
- f.createLongCounter("xmitPackets",
+ f.createLongCounter(XMIT_PACKETS,
"The total number of network packets transmitted (excluding
loopback)", "packets",
false),
- f.createLongCounter("xmitBytes",
+ f.createLongCounter(XMIT_BYTES,
"The total number of network bytes transmitted (excluding
loopback)", "bytes",
false),
- f.createLongCounter("xmitErrors", "The total number of network
transmit errors",
+ f.createLongCounter(XMIT_ERRORS, "The total number of network
transmit errors",
"errors", false),
- f.createLongCounter("xmitDrops", "The total number of network
transmits dropped",
+ f.createLongCounter(XMIT_DROPS, "The total number of network
transmits dropped",
"packets", false),
- f.createLongCounter("xmitCollisions", "The total number of network
transmit collisions",
+ f.createLongCounter(XMIT_COLLISIONS, "The total number of network
transmit collisions",
"collisions", false),
- f.createLongCounter("contextSwitches",
+ f.createLongCounter(CONTEXT_SWITCHES,
"The total number of context switches from one thread to
another on the computer. Thread switches can occur either inside of a single
process or across processes. A thread switch may be caused either by one
thread asking another for information, or by a thread being preempted by
another, higher priority thread becoming ready to run.",
"operations", false),
- f.createLongCounter("processCreates",
+ f.createLongCounter(PROCESS_CREATES,
"The total number of times a process has been created.",
"operations", false),
- f.createLongCounter("pagesPagedIn",
+ f.createLongCounter(PAGES_PAGED_IN,
"The total number of pages that have been brought into memory
from disk by the operating system's memory manager.",
"pages", false),
- f.createLongCounter("pagesPagedOut",
+ f.createLongCounter(PAGES_PAGED_OUT,
"The total number of pages that have been flushed from memory
to disk by the operating system's memory manager.",
"pages", false),
- f.createLongCounter("pagesSwappedIn",
+ f.createLongCounter(PAGES_SWAPPED_IN,
"The total number of swap pages that have been read in from
disk by the operating system's memory manager.",
"pages", false),
- f.createLongCounter("pagesSwappedOut",
+ f.createLongCounter(PAGES_SWAPPED_OUT,
"The total number of swap pages that have been written out to
disk by the operating system's memory manager.",
"pages", false),
- f.createLongCounter("diskReadsCompleted",
+ f.createLongCounter(DISK_READS_COMPLETED,
"The total number disk read operations completed
successfully", "ops"),
- f.createLongCounter("diskReadsMerged",
+ f.createLongCounter(DISK_READS_MERGED,
"The total number disk read operations that were able to be
merge with adjacent reads for efficiency",
"ops"),
- f.createLongCounter("diskBytesRead",
+ f.createLongCounter(DISK_BYTES_READ,
"The total number bytes read from disk successfully", "bytes"),
- f.createLongCounter("diskTimeReading",
+ f.createLongCounter(DISK_TIME_READING,
"The total number of milliseconds spent reading from disk",
"milliseconds"),
- f.createLongCounter("diskWritesCompleted",
+ f.createLongCounter(DISK_WRITES_COMPLETED,
"The total number disk write operations completed
successfully", "ops"),
- f.createLongCounter("diskWritesMerged",
+ f.createLongCounter(DISK_WRITES_MERGED,
"The total number disk write operations that were able to be
merge with adjacent reads for efficiency",
"ops"),
- f.createLongCounter("diskBytesWritten",
+ f.createLongCounter(DISK_BYTES_WRITTEN,
"The total number bytes written to disk successfully",
"bytes"),
- f.createLongCounter("diskTimeWriting",
+ f.createLongCounter(DISK_TIME_WRITING,
"The total number of milliseconds spent writing to disk",
"milliseconds"),
- f.createLongGauge("diskOpsInProgress",
+ f.createLongGauge(DISK_OPS_IN_PROGRESS,
"The current number of disk operations in progress", "ops"),
- f.createLongCounter("diskTimeInProgress",
+ f.createLongCounter(DISK_TIME_IN_PROGRESS,
"The total number of milliseconds spent with disk ops in
progress", "milliseconds"),
- f.createLongCounter("diskTime",
+ f.createLongCounter(DISK_TIME,
"The total number of milliseconds that measures both completed
disk operations and any accumulating backlog of in progress ops.",
"milliseconds"),
- f.createLongCounter("tcpExtSynCookiesRecv",
+ f.createLongCounter(TCP_EXT_SYN_COOKIES_RECV,
"The number of TCP/IP SYN cookies received due to a full
server socket backlog. "
+ "If this is non-zero consider disabling SYN cookies
because they form sub-optimal connections.",
"cookies received"),
- f.createLongCounter("tcpExtSynCookiesSent",
+ f.createLongCounter(TCP_EXT_SYN_COOKIES_SENT,
"The number of TCP/IP SYN cookies sent due to a full server
socket backlog. "
+ "If this is non-zero consider disabling SYN cookies
because they form sub-optimal connections.",
"cookies sent"),
- f.createLongCounter("tcpExtListenDrops",
+ f.createLongCounter(TCP_EXT_LISTEN_DROPS,
"The number of TCP/IP connection requests that have been
dropped due to a full backlog. "
+ "If this is large increase the OS SOMAXCONN setting and
increase socket backlog settings",
"requests"),
- f.createLongCounter("tcpExtListenOverflows",
+ f.createLongCounter(TCP_EXT_LISTEN_OVERFLOWS,
"The number of TCP/IP connection requests that could not be
queued due to a small backlog. "
+ "These are either dropped (tcpExtListenDrops) or handled
via cookies (tcpSynCookiesSent). "
+ "In either case you should consider increasing SOMAXCONN
and increasing backlog settings.",
"requests"),
- f.createDoubleGauge("loadAverage1",
+ f.createDoubleGauge(LOAD_AVERAGE_1,
"The average number of threads in the run queue or waiting for
disk I/O over the last minute.",
"threads"),
- f.createDoubleGauge("loadAverage15",
+ f.createDoubleGauge(LOAD_AVERAGE_15,
"The average number of threads in the run queue or waiting for
disk I/O over the last fifteen minutes.",
"threads"),
- f.createDoubleGauge("loadAverage5",
+ f.createDoubleGauge(LOAD_AVERAGE_5,
"The average number of threads in the run queue or waiting for
disk I/O over the last five minutes.",
"threads"),});
- allocatedSwapLONG = myType.nameToId("allocatedSwap");
- bufferMemoryLONG = myType.nameToId("bufferMemory");
- sharedMemoryLONG = myType.nameToId("sharedMemory");
- cpuActiveLONG = myType.nameToId("cpuActive");
- cpuIdleLONG = myType.nameToId("cpuIdle");
- cpuNiceLONG = myType.nameToId("cpuNice");
- cpuSystemLONG = myType.nameToId("cpuSystem");
- cpuUserLONG = myType.nameToId("cpuUser");
- iowaitLONG = myType.nameToId("iowait");
- irqLONG = myType.nameToId("irq");
- softirqLONG = myType.nameToId("softirq");
- cpusLONG = myType.nameToId("cpus");
- freeMemoryLONG = myType.nameToId("freeMemory");
- physicalMemoryLONG = myType.nameToId("physicalMemory");
- processesLONG = myType.nameToId("processes");
- unallocatedSwapLONG = myType.nameToId("unallocatedSwap");
- cachedMemoryLONG = myType.nameToId("cachedMemory");
- dirtyMemoryLONG = myType.nameToId("dirtyMemory");
- cpuNonUserLONG = myType.nameToId("cpuNonUser");
- cpuStealLONG = myType.nameToId("cpuSteal");
- tcpSOMaxConnLONG = myType.nameToId("soMaxConn");
- loopbackPacketsLONG = myType.nameToId("loopbackPackets");
- loopbackBytesLONG = myType.nameToId("loopbackBytes");
- recvPacketsLONG = myType.nameToId("recvPackets");
- recvBytesLONG = myType.nameToId("recvBytes");
- recvErrorsLONG = myType.nameToId("recvErrors");
- recvDropsLONG = myType.nameToId("recvDrops");
- xmitPacketsLONG = myType.nameToId("xmitPackets");
- xmitBytesLONG = myType.nameToId("xmitBytes");
- xmitErrorsLONG = myType.nameToId("xmitErrors");
- xmitDropsLONG = myType.nameToId("xmitDrops");
- xmitCollisionsLONG = myType.nameToId("xmitCollisions");
- contextSwitchesLONG = myType.nameToId("contextSwitches");
- processCreatesLONG = myType.nameToId("processCreates");
- pagesPagedInLONG = myType.nameToId("pagesPagedIn");
- pagesPagedOutLONG = myType.nameToId("pagesPagedOut");
- pagesSwappedInLONG = myType.nameToId("pagesSwappedIn");
- pagesSwappedOutLONG = myType.nameToId("pagesSwappedOut");
- readsCompletedLONG = myType.nameToId("diskReadsCompleted");
- readsMergedLONG = myType.nameToId("diskReadsMerged");
- bytesReadLONG = myType.nameToId("diskBytesRead");
- timeReadingLONG = myType.nameToId("diskTimeReading");
- writesCompletedLONG = myType.nameToId("diskWritesCompleted");
- writesMergedLONG = myType.nameToId("diskWritesMerged");
- bytesWrittenLONG = myType.nameToId("diskBytesWritten");
- timeWritingLONG = myType.nameToId("diskTimeWriting");
- iosInProgressLONG = myType.nameToId("diskOpsInProgress");
- timeIosInProgressLONG = myType.nameToId("diskTimeInProgress");
- ioTimeLONG = myType.nameToId("diskTime");
- tcpExtSynCookiesRecvLONG = myType.nameToId("tcpExtSynCookiesRecv");
- tcpExtSynCookiesSentLONG = myType.nameToId("tcpExtSynCookiesSent");
- tcpExtListenDropsLONG = myType.nameToId("tcpExtListenDrops");
- tcpExtListenOverflowsLONG = myType.nameToId("tcpExtListenOverflows");
+ allocatedSwapLONG = myType.nameToId(ALLOCATED_SWAP);
+ bufferMemoryLONG = myType.nameToId(BUFFER_MEMORY);
+ sharedMemoryLONG = myType.nameToId(SHARED_MEMORY);
+ cpuActiveLONG = myType.nameToId(CPU_ACTIVE);
+ cpuIdleLONG = myType.nameToId(CPU_IDLE);
+ cpuNiceLONG = myType.nameToId(CPU_NICE);
+ cpuSystemLONG = myType.nameToId(CPU_SYSTEM);
+ cpuUserLONG = myType.nameToId(CPU_USER);
+ iowaitLONG = myType.nameToId(IOWAIT);
+ irqLONG = myType.nameToId(IRQ);
+ softirqLONG = myType.nameToId(SOFTIRQ);
+ cpusLONG = myType.nameToId(CPUS);
+ freeMemoryLONG = myType.nameToId(FREE_MEMORY);
+ physicalMemoryLONG = myType.nameToId(PHYSICAL_MEMORY);
+ processesLONG = myType.nameToId(PROCESSES);
+ unallocatedSwapLONG = myType.nameToId(UNALLOCATED_SWAP);
+ cachedMemoryLONG = myType.nameToId(CACHED_MEMORY);
+ dirtyMemoryLONG = myType.nameToId(DIRTY_MEMORY);
+ cpuNonUserLONG = myType.nameToId(CPU_NON_USER);
+ cpuStealLONG = myType.nameToId(CPU_STEAL);
+ tcpSOMaxConnLONG = myType.nameToId(SO_MAX_CONN);
+ loopbackPacketsLONG = myType.nameToId(LOOPBACK_PACKETS);
+ loopbackBytesLONG = myType.nameToId(LOOPBACK_BYTES);
+ recvPacketsLONG = myType.nameToId(RECV_PACKETS);
+ recvBytesLONG = myType.nameToId(RECV_BYTES);
+ recvErrorsLONG = myType.nameToId(RECV_ERRORS);
+ recvDropsLONG = myType.nameToId(RECV_DROPS);
+ xmitPacketsLONG = myType.nameToId(XMIT_PACKETS);
+ xmitBytesLONG = myType.nameToId(XMIT_BYTES);
+ xmitErrorsLONG = myType.nameToId(XMIT_ERRORS);
+ xmitDropsLONG = myType.nameToId(XMIT_DROPS);
+ xmitCollisionsLONG = myType.nameToId(XMIT_COLLISIONS);
+ contextSwitchesLONG = myType.nameToId(CONTEXT_SWITCHES);
+ processCreatesLONG = myType.nameToId(PROCESS_CREATES);
+ pagesPagedInLONG = myType.nameToId(PAGES_PAGED_IN);
+ pagesPagedOutLONG = myType.nameToId(PAGES_PAGED_OUT);
+ pagesSwappedInLONG = myType.nameToId(PAGES_SWAPPED_IN);
+ pagesSwappedOutLONG = myType.nameToId(PAGES_SWAPPED_OUT);
+ readsCompletedLONG = myType.nameToId(DISK_READS_COMPLETED);
+ readsMergedLONG = myType.nameToId(DISK_READS_MERGED);
+ bytesReadLONG = myType.nameToId(DISK_BYTES_READ);
+ timeReadingLONG = myType.nameToId(DISK_TIME_READING);
+ writesCompletedLONG = myType.nameToId(DISK_WRITES_COMPLETED);
+ writesMergedLONG = myType.nameToId(DISK_WRITES_MERGED);
+ bytesWrittenLONG = myType.nameToId(DISK_BYTES_WRITTEN);
+ timeWritingLONG = myType.nameToId(DISK_TIME_WRITING);
+ iosInProgressLONG = myType.nameToId(DISK_OPS_IN_PROGRESS);
+ timeIosInProgressLONG = myType.nameToId(DISK_TIME_IN_PROGRESS);
+ ioTimeLONG = myType.nameToId(DISK_TIME);
+ tcpExtSynCookiesRecvLONG = myType.nameToId(TCP_EXT_SYN_COOKIES_RECV);
+ tcpExtSynCookiesSentLONG = myType.nameToId(TCP_EXT_SYN_COOKIES_SENT);
+ tcpExtListenDropsLONG = myType.nameToId(TCP_EXT_LISTEN_DROPS);
+ tcpExtListenOverflowsLONG = myType.nameToId(TCP_EXT_LISTEN_OVERFLOWS);
- loadAverage1DOUBLE = myType.nameToId("loadAverage1");
- loadAverage15DOUBLE = myType.nameToId("loadAverage15");
- loadAverage5DOUBLE = myType.nameToId("loadAverage5");
+ loadAverage1DOUBLE = myType.nameToId(LOAD_AVERAGE_1);
+ loadAverage15DOUBLE = myType.nameToId(LOAD_AVERAGE_15);
+ loadAverage5DOUBLE = myType.nameToId(LOAD_AVERAGE_5);
}
private LinuxSystemStats() {