|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.hyperic.sigar.Sigar
public class Sigar
The Sigar class provides access to the sigar objects containing system information. The Sigar object itself maintains internal state specific to each platform. It also implements the SigarProxy interface which provides caching at the Java level.
Field Summary | |
---|---|
static java.lang.String |
BUILD_DATE
The date on which sigar.jar was built. |
static long |
FIELD_NOTIMPL
|
static java.lang.String |
NATIVE_BUILD_DATE
The date on which the sigar native binary was built. |
static java.lang.String |
NATIVE_SCM_REVISION
The scm (svn) revision from which the sigar native binary was built. |
static java.lang.String |
NATIVE_VERSION_STRING
The Sigar native version. |
static java.lang.String |
SCM_REVISION
The scm (svn) revision from which sigar.jar was built. |
static java.lang.String |
VERSION_STRING
The Sigar java version. |
Constructor Summary | |
---|---|
Sigar()
Allocate and initialize the native Sigar object. |
Method Summary | |
---|---|
void |
close()
Release any native resources associated with this sigar instance. |
void |
enableLogging(boolean value)
Enabling logging in the native Sigar code. |
protected void |
finalize()
|
static java.lang.String |
formatSize(long size)
Format size in bytes to a human readable string. |
Cpu |
getCpu()
Get system cpu info. |
CpuInfo[] |
getCpuInfoList()
Get list of cpu infomation. |
Cpu[] |
getCpuList()
Get list of per-cpu metrics. |
CpuPerc |
getCpuPerc()
Get system CPU info in percentage format. |
CpuPerc[] |
getCpuPercList()
Get system per-CPU info in percentage format. |
DirStat |
getDirStat(java.lang.String name)
|
DirUsage |
getDirUsage(java.lang.String name)
|
DiskUsage |
getDiskUsage(java.lang.String name)
Get disk usage. |
FileInfo |
getFileInfo(java.lang.String name)
|
FileSystem[] |
getFileSystemList()
Get list of file systems. |
FileSystemMap |
getFileSystemMap()
|
FileSystemUsage |
getFileSystemUsage(java.lang.String name)
Get file system usage. |
java.lang.String |
getFQDN()
Reliably retrieve the FQDN for a machine |
FileInfo |
getLinkInfo(java.lang.String name)
|
double[] |
getLoadAverage()
Get system load average. |
Mem |
getMem()
Get system memory info. |
FileSystemUsage |
getMountedFileSystemUsage(java.lang.String name)
Get file system usage of a mounted directory. |
MultiProcCpu |
getMultiProcCpu(java.lang.String query)
|
ProcMem |
getMultiProcMem(java.lang.String query)
|
java.io.File |
getNativeLibrary()
|
NetConnection[] |
getNetConnectionList(int flags)
Get list of network connections. |
NetInfo |
getNetInfo()
Get general network info. |
NetInterfaceConfig |
getNetInterfaceConfig()
Get default network interface configuration info. |
NetInterfaceConfig |
getNetInterfaceConfig(java.lang.String name)
Get network interface configuration info. |
java.lang.String[] |
getNetInterfaceList()
Get the list of configured network interface names. |
NetInterfaceStat |
getNetInterfaceStat(java.lang.String name)
Get network interface stats. |
java.lang.String |
getNetListenAddress(long port)
Get the TCP listen address for the given port. |
java.lang.String |
getNetListenAddress(java.lang.String port)
|
NetRoute[] |
getNetRouteList()
Get list of network routes. |
java.lang.String |
getNetServicesName(int protocol,
long port)
|
NetStat |
getNetStat()
|
NetStat |
getNetStat(byte[] address,
long port)
|
NfsClientV2 |
getNfsClientV2()
|
NfsClientV3 |
getNfsClientV3()
|
NfsServerV2 |
getNfsServerV2()
|
NfsServerV3 |
getNfsServerV3()
|
static java.lang.String |
getPassword(java.lang.String prompt)
Prompt for a password, disabling terminal echo during user input if possible. |
long |
getPid()
Get pid of the current process. |
java.lang.String[] |
getProcArgs(long pid)
Get process arguments. |
java.lang.String[] |
getProcArgs(java.lang.String pid)
|
ProcCpu |
getProcCpu(long pid)
Get process cpu info. |
ProcCpu |
getProcCpu(java.lang.String pid)
|
ProcCred |
getProcCred(long pid)
Get process credential info. |
ProcCred |
getProcCred(java.lang.String pid)
|
ProcCredName |
getProcCredName(long pid)
Get process credential names. |
ProcCredName |
getProcCredName(java.lang.String pid)
|
java.util.Map |
getProcEnv(long pid)
Get process environment. |
java.lang.String |
getProcEnv(long pid,
java.lang.String key)
Get process environment variable value. |
java.util.Map |
getProcEnv(java.lang.String pid)
|
java.lang.String |
getProcEnv(java.lang.String pid,
java.lang.String key)
|
ProcExe |
getProcExe(long pid)
Get process current working directory. |
ProcExe |
getProcExe(java.lang.String pid)
|
ProcFd |
getProcFd(long pid)
Get process file descriptor info. |
ProcFd |
getProcFd(java.lang.String pid)
|
long[] |
getProcList()
Get system process list. |
ProcMem |
getProcMem(long pid)
Get process memory info. |
ProcMem |
getProcMem(java.lang.String pid)
|
java.util.List |
getProcModules(long pid)
|
java.util.List |
getProcModules(java.lang.String pid)
|
long |
getProcPort(int protocol,
long port)
Find the pid of the process which is listening on the given port. |
long |
getProcPort(java.lang.String protocol,
java.lang.String port)
|
ProcStat |
getProcStat()
Get system process stats. |
ProcState |
getProcState(long pid)
Get process state info. |
ProcState |
getProcState(java.lang.String pid)
|
ProcTime |
getProcTime(long pid)
Get process time info. |
ProcTime |
getProcTime(java.lang.String pid)
|
ResourceLimit |
getResourceLimit()
Get system resource limits. |
long |
getServicePid(java.lang.String name)
Get pid for the Windows service with the given name. |
static int |
getSigNum(java.lang.String name)
|
Swap |
getSwap()
Get system swap info. |
Tcp |
getTcp()
TCP-MIB stats |
ThreadCpu |
getThreadCpu()
Get the cumulative cpu time for the calling thread. |
Uptime |
getUptime()
Get system uptime info. |
Who[] |
getWhoList()
|
void |
kill(long pid,
int signum)
Send a signal to a process. |
void |
kill(long pid,
java.lang.String signame)
Send a signal to a process. |
void |
kill(java.lang.String pid,
int signum)
Send a signal to a process. |
static void |
load()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final long FIELD_NOTIMPL
public static final java.lang.String VERSION_STRING
public static final java.lang.String NATIVE_VERSION_STRING
public static final java.lang.String SCM_REVISION
public static final java.lang.String NATIVE_SCM_REVISION
public static final java.lang.String BUILD_DATE
public static final java.lang.String NATIVE_BUILD_DATE
Constructor Detail |
---|
public Sigar()
Method Detail |
---|
public static void load() throws SigarException
SigarException
public java.io.File getNativeLibrary()
public static java.lang.String formatSize(long size)
size
- The size to format.
protected void finalize()
finalize
in class java.lang.Object
public void close()
public long getPid()
getPid
in interface SigarProxy
SigarException
- on failure.public long getServicePid(java.lang.String name) throws SigarException
getServicePid
in interface SigarProxy
SigarException
public void kill(long pid, int signum) throws SigarException
pid
- The process id.signum
- The signal number.
SigarException
- on failure.public void kill(long pid, java.lang.String signame) throws SigarException
pid
- The process id.signame
- The signal name.
SigarException
- on failure.public static int getSigNum(java.lang.String name)
public void kill(java.lang.String pid, int signum) throws SigarException
pid
- The process id or query.signum
- The signal number.
SigarException
- on failure.public Mem getMem() throws SigarException
getMem
in interface SigarProxy
SigarException
- on failure.public Swap getSwap() throws SigarException
getSwap
in interface SigarProxy
SigarException
- on failure.public Cpu getCpu() throws SigarException
getCpu
in interface SigarProxy
SigarException
- on failure.public CpuPerc getCpuPerc() throws SigarException
getCpuPerc
in interface SigarProxy
SigarException
- on failure.public CpuPerc[] getCpuPercList() throws SigarException
getCpuPercList
in interface SigarProxy
SigarException
- on failure.public ResourceLimit getResourceLimit() throws SigarException
getResourceLimit
in interface SigarProxy
SigarException
- on failure.public Uptime getUptime() throws SigarException
getUptime
in interface SigarProxy
SigarException
- on failure.public double[] getLoadAverage() throws SigarException
getLoadAverage
in interface SigarProxy
SigarException
- on failure.public long[] getProcList() throws SigarException
getProcList
in interface SigarProxy
SigarException
- on failure.public ProcStat getProcStat() throws SigarException
getProcStat
in interface SigarProxy
SigarException
- on failure.public ProcMem getProcMem(long pid) throws SigarException
getProcMem
in interface SigarProxy
pid
- The process id.
SigarException
- on failure.public ProcMem getProcMem(java.lang.String pid) throws SigarException
getProcMem
in interface SigarProxy
SigarException
public ProcMem getMultiProcMem(java.lang.String query) throws SigarException
getMultiProcMem
in interface SigarProxy
SigarException
public ProcState getProcState(long pid) throws SigarException
getProcState
in interface SigarProxy
pid
- The process id.
SigarException
- on failure.public ProcState getProcState(java.lang.String pid) throws SigarException
getProcState
in interface SigarProxy
SigarException
public ProcTime getProcTime(long pid) throws SigarException
getProcTime
in interface SigarProxy
pid
- The process id.
SigarException
- on failure.public ProcTime getProcTime(java.lang.String pid) throws SigarException
getProcTime
in interface SigarProxy
SigarException
public ProcCpu getProcCpu(long pid) throws SigarException
getProcCpu
in interface SigarProxy
pid
- The process id.
SigarException
- on failure.public ProcCpu getProcCpu(java.lang.String pid) throws SigarException
getProcCpu
in interface SigarProxy
SigarException
public MultiProcCpu getMultiProcCpu(java.lang.String query) throws SigarException
getMultiProcCpu
in interface SigarProxy
SigarException
public ProcCred getProcCred(long pid) throws SigarException
getProcCred
in interface SigarProxy
pid
- The process id.
SigarException
- on failure.public ProcCred getProcCred(java.lang.String pid) throws SigarException
getProcCred
in interface SigarProxy
SigarException
public ProcCredName getProcCredName(long pid) throws SigarException
getProcCredName
in interface SigarProxy
pid
- The process id.
SigarException
- on failure.public ProcCredName getProcCredName(java.lang.String pid) throws SigarException
getProcCredName
in interface SigarProxy
SigarException
public ProcFd getProcFd(long pid) throws SigarException
getProcFd
in interface SigarProxy
pid
- The process id.
SigarException
- on failure.public ProcFd getProcFd(java.lang.String pid) throws SigarException
getProcFd
in interface SigarProxy
SigarException
public ProcExe getProcExe(long pid) throws SigarException
getProcExe
in interface SigarProxy
pid
- The process id.
SigarException
- on failure.public ProcExe getProcExe(java.lang.String pid) throws SigarException
getProcExe
in interface SigarProxy
SigarException
public java.lang.String[] getProcArgs(long pid) throws SigarException
getProcArgs
in interface SigarProxy
pid
- The process id.
SigarException
- on failure.public java.lang.String[] getProcArgs(java.lang.String pid) throws SigarException
getProcArgs
in interface SigarProxy
SigarException
public java.util.Map getProcEnv(long pid) throws SigarException
getProcEnv
in interface SigarProxy
pid
- The process id.
SigarException
- on failure.public java.util.Map getProcEnv(java.lang.String pid) throws SigarException
getProcEnv
in interface SigarProxy
SigarException
public java.lang.String getProcEnv(long pid, java.lang.String key) throws SigarException
getProcEnv
in interface SigarProxy
pid
- The process id.key
- Environment variable name.
SigarException
- on failure.public java.lang.String getProcEnv(java.lang.String pid, java.lang.String key) throws SigarException
getProcEnv
in interface SigarProxy
SigarException
public java.util.List getProcModules(long pid) throws SigarException
getProcModules
in interface SigarProxy
SigarException
public java.util.List getProcModules(java.lang.String pid) throws SigarException
getProcModules
in interface SigarProxy
SigarException
public long getProcPort(int protocol, long port) throws SigarException
Supported Platforms: Linux, Windows 2003, Windows XP, AIX.
getProcPort
in interface SigarProxy
protocol
- NetFlags.CONN_TCP or NetFlags.CONN_UDP.port
- The port number.
SigarException
- on failure.public long getProcPort(java.lang.String protocol, java.lang.String port) throws SigarException
getProcPort
in interface SigarProxy
protocol
- "tcp" or "udp".port
- The port number.
SigarException
- on failure.public ThreadCpu getThreadCpu() throws SigarException
SigarException
public FileSystem[] getFileSystemList() throws SigarException
getFileSystemList
in interface SigarProxy
SigarException
- on failure.public FileSystemUsage getFileSystemUsage(java.lang.String name) throws SigarException
getFileSystemUsage
in interface SigarProxy
name
- Name of the directory on which filesystem is mounted.
SigarException
- on failure.public DiskUsage getDiskUsage(java.lang.String name) throws SigarException
getDiskUsage
in interface SigarProxy
name
- Name of disk
SigarException
- on failure.public FileSystemUsage getMountedFileSystemUsage(java.lang.String name) throws SigarException, NfsUnreachableException
getMountedFileSystemUsage
in interface SigarProxy
name
- Name of the directory on which filesystem is mounted.
SigarException
- If given directory is not mounted.
NfsUnreachableException
- If NFS server is unreachable.getFileSystemUsage(java.lang.String)
public FileSystemMap getFileSystemMap() throws SigarException
getFileSystemMap
in interface SigarProxy
SigarException
public FileInfo getFileInfo(java.lang.String name) throws SigarException
getFileInfo
in interface SigarProxy
SigarException
public FileInfo getLinkInfo(java.lang.String name) throws SigarException
getLinkInfo
in interface SigarProxy
SigarException
public DirStat getDirStat(java.lang.String name) throws SigarException
getDirStat
in interface SigarProxy
SigarException
public DirUsage getDirUsage(java.lang.String name) throws SigarException
getDirUsage
in interface SigarProxy
SigarException
public CpuInfo[] getCpuInfoList() throws SigarException
getCpuInfoList
in interface SigarProxy
SigarException
- on failure.public Cpu[] getCpuList() throws SigarException
getCpuList
in interface SigarProxy
SigarException
- on failure.public NetRoute[] getNetRouteList() throws SigarException
getNetRouteList
in interface SigarProxy
SigarException
- on failure.public NetConnection[] getNetConnectionList(int flags) throws SigarException
getNetConnectionList
in interface SigarProxy
SigarException
- on failure.public java.lang.String getNetListenAddress(long port) throws SigarException
getNetListenAddress
in interface SigarProxy
SigarException
public java.lang.String getNetListenAddress(java.lang.String port) throws SigarException
getNetListenAddress
in interface SigarProxy
SigarException
public java.lang.String getNetServicesName(int protocol, long port)
getNetServicesName
in interface SigarProxy
public NetStat getNetStat() throws SigarException
getNetStat
in interface SigarProxy
SigarException
public NetStat getNetStat(byte[] address, long port) throws SigarException
SigarException
public Who[] getWhoList() throws SigarException
getWhoList
in interface SigarProxy
SigarException
public Tcp getTcp() throws SigarException
getTcp
in interface SigarProxy
SigarException
- on failure.public NfsClientV2 getNfsClientV2() throws SigarException
getNfsClientV2
in interface SigarProxy
SigarException
public NfsServerV2 getNfsServerV2() throws SigarException
getNfsServerV2
in interface SigarProxy
SigarException
public NfsClientV3 getNfsClientV3() throws SigarException
getNfsClientV3
in interface SigarProxy
SigarException
public NfsServerV3 getNfsServerV3() throws SigarException
getNfsServerV3
in interface SigarProxy
SigarException
public NetInfo getNetInfo() throws SigarException
getNetInfo
in interface SigarProxy
SigarException
- on failure.public NetInterfaceConfig getNetInterfaceConfig(java.lang.String name) throws SigarException
getNetInterfaceConfig
in interface SigarProxy
SigarException
- on failure.public NetInterfaceConfig getNetInterfaceConfig() throws SigarException
getNetInterfaceConfig
in interface SigarProxy
SigarException
- on failure.public NetInterfaceStat getNetInterfaceStat(java.lang.String name) throws SigarException
getNetInterfaceStat
in interface SigarProxy
SigarException
- on failure.public java.lang.String[] getNetInterfaceList() throws SigarException
getNetInterfaceList
in interface SigarProxy
SigarException
- on failure.public static java.lang.String getPassword(java.lang.String prompt) throws java.io.IOException
prompt
- Text printed before disabling echo
java.io.IOException
- If input could not be read.public java.lang.String getFQDN() throws SigarException
getFQDN
in interface SigarProxy
SigarException
- on failure.public void enableLogging(boolean value)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |