mirror of https://github.com/apache/lucene.git
SOLR-3148: expose more system info
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1292938 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ebfdea6c82
commit
48bb56dea8
|
@ -124,20 +124,20 @@ public class SystemInfoHandler extends RequestHandlerBase
|
||||||
info.add( "name", os.getName() );
|
info.add( "name", os.getName() );
|
||||||
info.add( "version", os.getVersion() );
|
info.add( "version", os.getVersion() );
|
||||||
info.add( "arch", os.getArch() );
|
info.add( "arch", os.getArch() );
|
||||||
|
info.add( "systemLoadAverage", os.getSystemLoadAverage());
|
||||||
|
|
||||||
// Java 1.6
|
// com.sun.management.OperatingSystemMXBean
|
||||||
addGetterIfAvaliable( os, "systemLoadAverage", info );
|
addGetterIfAvaliable( os, "committedVirtualMemorySize", info);
|
||||||
|
addGetterIfAvaliable( os, "freePhysicalMemorySize", info);
|
||||||
|
addGetterIfAvaliable( os, "freeSwapSpaceSize", info);
|
||||||
|
addGetterIfAvaliable( os, "processCpuTime", info);
|
||||||
|
addGetterIfAvaliable( os, "totalPhysicalMemorySize", info);
|
||||||
|
addGetterIfAvaliable( os, "totalSwapSpaceSize", info);
|
||||||
|
|
||||||
// com.sun.management.UnixOperatingSystemMXBean
|
// com.sun.management.UnixOperatingSystemMXBean
|
||||||
addGetterIfAvaliable( os, "openFileDescriptorCount", info );
|
addGetterIfAvaliable( os, "openFileDescriptorCount", info );
|
||||||
addGetterIfAvaliable( os, "maxFileDescriptorCount", info );
|
addGetterIfAvaliable( os, "maxFileDescriptorCount", info );
|
||||||
|
|
||||||
// com.sun.management.OperatingSystemMXBean
|
|
||||||
addGetterIfAvaliable( os, "committedVirtualMemorySize", info );
|
|
||||||
addGetterIfAvaliable( os, "totalPhysicalMemorySize", info );
|
|
||||||
addGetterIfAvaliable( os, "totalSwapSpaceSize", info );
|
|
||||||
addGetterIfAvaliable( os, "processCpuTime", info );
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if( !os.getName().toLowerCase(Locale.ENGLISH).startsWith( "windows" ) ) {
|
if( !os.getName().toLowerCase(Locale.ENGLISH).startsWith( "windows" ) ) {
|
||||||
// Try some command line things
|
// Try some command line things
|
||||||
|
@ -165,6 +165,7 @@ public class SystemInfoHandler extends RequestHandlerBase
|
||||||
try {
|
try {
|
||||||
String n = Character.toUpperCase( getter.charAt(0) ) + getter.substring( 1 );
|
String n = Character.toUpperCase( getter.charAt(0) ) + getter.substring( 1 );
|
||||||
Method m = obj.getClass().getMethod( "get" + n );
|
Method m = obj.getClass().getMethod( "get" + n );
|
||||||
|
m.setAccessible(true);
|
||||||
Object v = m.invoke( obj, (Object[])null );
|
Object v = m.invoke( obj, (Object[])null );
|
||||||
if( v != null ) {
|
if( v != null ) {
|
||||||
info.add( getter, v );
|
info.add( getter, v );
|
||||||
|
|
Loading…
Reference in New Issue