OperatingSystemMXBean Platform MBean: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(7 intermediate revisions by the same user not shown)
Line 7: Line 7:
* [[JMX#O.2FS_Information|JMX]]
* [[JMX#O.2FS_Information|JMX]]


=java.lang.management.OperatingSystemMXBean=


!!!Java Operating System Monitoring MBeans
The MBean exposes runtime statistics gathered from the underlying O/S. To get an instance, use <tt>ManagementFactory.getOperatingSystemMXBean()</tt> or lookup the ObjectName:


!!!External
<pre>
java.lang:type=OperatingSystem
</pre>


* [http://docs.oracle.com/javase/7/docs/api/java/lang/management/OperatingSystemMXBean.html]
==Metrics==


!!!java.lang.management.OperatingSystemMXBean
====SystemLoadAverage====


Operating system on which the Java virtual machine is running. The ObjectName registered under is "java.lang:type=OperatingSystem".
<pre>
double getSystemLoadAverage();
</pre>


!!!Interesting Parameters
Returns the system load average for the last minute. The system load average is the sum of the number of runnable entities queued to the available processors and the number of runnable entities running on the available processors averaged over a period of time. The way in which the load average is calculated is operating system specific but is typically a damped time-dependent average. If the load average is not available, a negative value is returned. This method is designed to provide a hint about the system load and may be queried frequently. The load average may be unavailable on some platform where it is expensive to implement this method.


!!SystemLoadAverage
====ProcessCpuLoad====
====SystemCpuLoad====
====ProcessCpuTime====
====OpenFileDescriptorCount====
====MaxFileDescriptorCount====
====AvailableProcessors====
====TotalPhysicalMemorySize====
====FreePhysicalMemorySize====
====CommittedVirtualMemorySize====
====TotalSwapSpaceSize====
====FreeSwapSpaceSize====


{{{
=java 7 com.sun.management.OperatingSystemMXBean=


    double getSystemLoadAverage();
To get an instance:


}}}
<pre>
 
ManagementFactory.getPlatformMXBean(com.sun.management.OperatingSystemMXBean.class);
Returns the system load average for the last minute. The system load average is the sum of the number of runnable entities queued to the available processors and the number of runnable entities running on the available processors averaged over a period of time. The way in which the load average is calculated is operating system specific but is typically a damped time-dependent average.
</pre>
 
If the load average is not available, a negative value is returned.
 
This method is designed to provide a hint about the system load and may be queried frequently. The load average may be unavailable on some platform where it is expensive to implement this method.
 
!!!Example
 
{{{
ManagementFactory.getOperatingSystemMXBean();
}}}
 
 
!!!Java 7 com.sun.management.OperatingSystemMXBean
 
To get it:
 
{{{
 
    ManagementFactory.getPlatformMXBean(com.sun.management.OperatingSystemMXBean.class);
 
}}}


Provides access to:
Provides access to:


{{{
<pre>
 
double getSystemCpuLoad();
    double getSystemCpuLoad();
</pre>
 
}}}
 
Returns the load as a double value in the [[0.0,1.0] interval, with 0.0 representing no load to 1.0 representing 100% CPU load for the whole system.
 


Returns the load as a double value in the [0.0,1.0] interval, with 0.0 representing no load to 1.0 representing 100% CPU load for the whole system.


{{{
<pre>
double getProcessCpuLoad();
</pre>


    double getProcessCpuLoad();
Returns the load as a double value in the [0.0,1.0] interval, with 0.0 representing no load to 1.0 representing 100% CPU load for the current JVM process.


}}}
<pre>
long getProcessCpuTime();
long getCommittedVirtualMemorySize();
long getTotalSwapSpaceSize();
long getFreeSwapSpaceSize();
long getFreePhysicalMemorySize();
long getTotalPhysicalMemorySize();
</pre>


Returns the load as a double value in the [[0.0,1.0] interval, with 0.0 representing no load to 1.0 representing 100% CPU load for the current JVM process.
==To Investigate==


{{{
<pre>
 
public interface UnixOperatingSystemMXBean extends com.sun.management.OperatingSystemMXBean {
    long getProcessCpuTime();
 
}}}
 
 
{{{
 
    long getCommittedVirtualMemorySize();
 
    long getTotalSwapSpaceSize();
 
    long getFreeSwapSpaceSize();
 
    long getFreePhysicalMemorySize();
 
    long getTotalPhysicalMemorySize();
 
}}}
 
 
<font color=red>
 
!!!To Investigate
 
{{{
public interface UnixOperatingSystemMXBean extends com.sun.management.OperatingSystemMXBean  
{
     long getOpenFileDescriptorCount();
     long getOpenFileDescriptorCount();
     long getMaxFileDescriptorCount();
     long getMaxFileDescriptorCount();
}
}
}}}
</pre>
 
</font>

Latest revision as of 14:56, 11 May 2017

External

Internal

java.lang.management.OperatingSystemMXBean

The MBean exposes runtime statistics gathered from the underlying O/S. To get an instance, use ManagementFactory.getOperatingSystemMXBean() or lookup the ObjectName:

java.lang:type=OperatingSystem

Metrics

SystemLoadAverage

double getSystemLoadAverage();

Returns the system load average for the last minute. The system load average is the sum of the number of runnable entities queued to the available processors and the number of runnable entities running on the available processors averaged over a period of time. The way in which the load average is calculated is operating system specific but is typically a damped time-dependent average. If the load average is not available, a negative value is returned. This method is designed to provide a hint about the system load and may be queried frequently. The load average may be unavailable on some platform where it is expensive to implement this method.

ProcessCpuLoad

SystemCpuLoad

ProcessCpuTime

OpenFileDescriptorCount

MaxFileDescriptorCount

AvailableProcessors

TotalPhysicalMemorySize

FreePhysicalMemorySize

CommittedVirtualMemorySize

TotalSwapSpaceSize

FreeSwapSpaceSize

java 7 com.sun.management.OperatingSystemMXBean

To get an instance:

ManagementFactory.getPlatformMXBean(com.sun.management.OperatingSystemMXBean.class);

Provides access to:

double getSystemCpuLoad();

Returns the load as a double value in the [0.0,1.0] interval, with 0.0 representing no load to 1.0 representing 100% CPU load for the whole system.

double getProcessCpuLoad();

Returns the load as a double value in the [0.0,1.0] interval, with 0.0 representing no load to 1.0 representing 100% CPU load for the current JVM process.

long getProcessCpuTime();
long getCommittedVirtualMemorySize();
long getTotalSwapSpaceSize();
long getFreeSwapSpaceSize();
long getFreePhysicalMemorySize();
long getTotalPhysicalMemorySize();

To Investigate

public interface UnixOperatingSystemMXBean extends com.sun.management.OperatingSystemMXBean {
    long getOpenFileDescriptorCount();
    long getMaxFileDescriptorCount();
}