com.palantir.opensource.sysmon.linux
Class LinuxNetStatJMXWrapper

java.lang.Object
  extended by java.lang.Thread
      extended by com.palantir.opensource.sysmon.linux.LinuxNetStatJMXWrapper
All Implemented Interfaces:
Monitor, Runnable

public class LinuxNetStatJMXWrapper
extends Thread
implements Monitor

Monitors network interface statistics.

This class reads information from/proc/net/dev to publish statistics via per-interface beans.

JMX Data Path

Each device will be at:
sysmon.linux.beanpath:type=net-device,devicename=<devicename>

Configuration parameters

Note that any value not set in the config file will use the default value.
Config KeyDescriptionDefault ValueConstant
sysmon.linux.netstat.periodMillis period, in milliseconds, between interface statistics checks 2000 CONFIG_KEY_NETSTAT_PERIOD

See Also:
Lifecycle documentation, proc(5) for information on /proc/net/dev

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
static String CONFIG_KEY_NETSTAT_PERIOD
          Configuration parameter that controls the time between checks for this monitor.
static long DEFAULT_NETSTAT_PERIOD
          Default value for how often to update values, in milliseconds.
static Pattern FIRST_LINE
          Compiled Pattern to match the first header line in the /proc/net/dev files
static String FIRST_LINE_RE
          Regex string to match the first header line in the /proc/net/dev files
static String OBJECT_NAME_PREFIX
           
static Pattern SECOND_LINE
          Compiled Pattern to match the second header line in the /proc/net/dev files
static String SECOND_LINE_RE
          Regex string to match the second header line in the /proc/net/dev files
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
LinuxNetStatJMXWrapper(Properties config)
          Constructs a new monitor.
 
Method Summary
 void cleanup()
           
 void run()
           
 void startMonitoring()
          Starts the background thread that does the work of this monitor.
 void stopMonitoring()
          Shuts down the background thread that does the work of this monitor.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CONFIG_KEY_NETSTAT_PERIOD

public static final String CONFIG_KEY_NETSTAT_PERIOD
Configuration parameter that controls the time between checks for this monitor. Config key: "sysmon.linux.netstat.periodMillis"

See Also:
default value, Constant Field Values

FIRST_LINE_RE

public static final String FIRST_LINE_RE
Regex string to match the first header line in the /proc/net/dev files

See Also:
Constant Field Values

FIRST_LINE

public static final Pattern FIRST_LINE
Compiled Pattern to match the first header line in the /proc/net/dev files


SECOND_LINE_RE

public static final String SECOND_LINE_RE
Regex string to match the second header line in the /proc/net/dev files

See Also:
Constant Field Values

SECOND_LINE

public static final Pattern SECOND_LINE
Compiled Pattern to match the second header line in the /proc/net/dev files


DEFAULT_NETSTAT_PERIOD

public static final long DEFAULT_NETSTAT_PERIOD
Default value for how often to update values, in milliseconds. Default: 2000L

See Also:
for config key to override default value., Constant Field Values

OBJECT_NAME_PREFIX

public static final String OBJECT_NAME_PREFIX
See Also:
Constant Field Values
Constructor Detail

LinuxNetStatJMXWrapper

public LinuxNetStatJMXWrapper(Properties config)
                       throws LinuxMonitoringException
Constructs a new monitor. Checks config and throws errors if there are problems. Does not start the background thread.

Parameters:
config -
Throws:
LinuxMonitoringException
Method Detail

startMonitoring

public void startMonitoring()
Starts the background thread that does the work of this monitor.

Specified by:
startMonitoring in interface Monitor

stopMonitoring

public void stopMonitoring()
                    throws InterruptedException
Shuts down the background thread that does the work of this monitor.

Specified by:
stopMonitoring in interface Monitor
Throws:
InterruptedException - if interrupted while waiting for background thread to exit.

run

public void run()
Specified by:
run in interface Runnable
Overrides:
run in class Thread

cleanup

public void cleanup()


Copyright © 2012 Palantir Technologies. All Rights Reserved.