This commit is contained in:
Doug MacEachern 2004-07-24 00:29:56 +00:00
parent e0fc284147
commit a54d202fe1
18 changed files with 62 additions and 3 deletions

View File

@ -23,3 +23,6 @@ alias myag ptql CredName.User.eq=$user.name,State.Name.eq=java,Args.-1.ew=Spider
#find all java procs except the shell itself #find all java procs except the shell itself
#($$ is the current process id) #($$ is the current process id)
alias java ptql State.Name.eq=java,Pid.Pid.ne=$$ alias java ptql State.Name.eq=java,Pid.Pid.ne=$$
#find all processes owned by the current user
alias myproc ptql CredName.User.eq=$user.name

View File

@ -3,6 +3,9 @@ package net.hyperic.sigar.cmd;
import net.hyperic.sigar.CpuPerc; import net.hyperic.sigar.CpuPerc;
import net.hyperic.sigar.SigarException; import net.hyperic.sigar.SigarException;
/**
* Display cpu information for each cpu found on the system.
*/
public class CpuInfo extends SigarCommandBase { public class CpuInfo extends SigarCommandBase {
public CpuInfo(Shell shell) { public CpuInfo(Shell shell) {

View File

@ -11,6 +11,9 @@ import net.hyperic.sigar.FileSystemUsage;
import net.hyperic.sigar.shell.FileCompleter; import net.hyperic.sigar.shell.FileCompleter;
import net.hyperic.sigar.util.GetlineCompleter; import net.hyperic.sigar.util.GetlineCompleter;
/**
* Report filesytem disk space usage.
*/
public class Df extends SigarCommandBase { public class Df extends SigarCommandBase {
private static final String OUTPUT_FORMAT = private static final String OUTPUT_FORMAT =

View File

@ -4,6 +4,9 @@ import net.hyperic.sigar.Mem;
import net.hyperic.sigar.Swap; import net.hyperic.sigar.Swap;
import net.hyperic.sigar.SigarException; import net.hyperic.sigar.SigarException;
/**
* Display amount of free and used memory in the system.
*/
public class Free extends SigarCommandBase { public class Free extends SigarCommandBase {
public Free(Shell shell) { public Free(Shell shell) {

View File

@ -9,6 +9,9 @@ import net.hyperic.sigar.NetInterfaceConfig;
import net.hyperic.sigar.NetInterfaceStat; import net.hyperic.sigar.NetInterfaceStat;
import net.hyperic.sigar.NetFlags; import net.hyperic.sigar.NetFlags;
/**
* Display network interface configuration and metrics.
*/
public class Ifconfig extends SigarCommandBase { public class Ifconfig extends SigarCommandBase {
public Ifconfig(Shell shell) { public Ifconfig(Shell shell) {

View File

@ -2,6 +2,9 @@ package net.hyperic.sigar.cmd;
import net.hyperic.sigar.SigarException; import net.hyperic.sigar.SigarException;
/**
* Send a signal to a process.
*/
public class Kill extends SigarCommandBase { public class Kill extends SigarCommandBase {
public Kill(Shell shell) { public Kill(Shell shell) {

View File

@ -5,6 +5,9 @@ import net.hyperic.sigar.SigarException;
import net.hyperic.sigar.NetConnection; import net.hyperic.sigar.NetConnection;
import net.hyperic.sigar.NetFlags; import net.hyperic.sigar.NetFlags;
/**
* Display network connections.
*/
public class Netstat extends SigarCommandBase { public class Netstat extends SigarCommandBase {
public Netstat(Shell shell) { public Netstat(Shell shell) {
@ -20,7 +23,7 @@ public class Netstat extends SigarCommandBase {
} }
public String getUsageShort() { public String getUsageShort() {
return "Show network connections"; return "Display network connections";
} }
//poor mans getopt. //poor mans getopt.

View File

@ -22,6 +22,10 @@ import net.hyperic.sigar.shell.ShellCommandInitException;
import net.hyperic.sigar.shell.ShellCommandHandler; import net.hyperic.sigar.shell.ShellCommandHandler;
import net.hyperic.sigar.shell.ShellCommandUsageException; import net.hyperic.sigar.shell.ShellCommandUsageException;
/**
* Run process table queries.
* @see net.hyperic.sigar.ptql.ProcessQueryBuilder
*/
public class PTQL public class PTQL
extends MultiwordShellCommand extends MultiwordShellCommand
implements GetlineCompleter { implements GetlineCompleter {

View File

@ -5,6 +5,9 @@ import net.hyperic.sigar.SigarException;
import net.hyperic.sigar.ProcFd; import net.hyperic.sigar.ProcFd;
import net.hyperic.sigar.ProcExe; import net.hyperic.sigar.ProcExe;
/**
* Display process file information.
*/
public class ProcFileInfo extends SigarCommandBase { public class ProcFileInfo extends SigarCommandBase {
public ProcFileInfo(Shell shell) { public ProcFileInfo(Shell shell) {

View File

@ -6,6 +6,9 @@ import net.hyperic.sigar.Sigar;
import net.hyperic.sigar.SigarException; import net.hyperic.sigar.SigarException;
import net.hyperic.sigar.SigarNotImplementedException; import net.hyperic.sigar.SigarNotImplementedException;
/**
* Display process module info.
*/
public class ProcModuleInfo extends SigarCommandBase { public class ProcModuleInfo extends SigarCommandBase {
public ProcModuleInfo(Shell shell) { public ProcModuleInfo(Shell shell) {

View File

@ -14,6 +14,9 @@ import java.util.List;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
/**
* Show process status.
*/
public class Ps extends SigarCommandBase { public class Ps extends SigarCommandBase {
public Ps(Shell shell) { public Ps(Shell shell) {

View File

@ -3,6 +3,9 @@ package net.hyperic.sigar.cmd;
import net.hyperic.sigar.SigarException; import net.hyperic.sigar.SigarException;
import net.hyperic.sigar.SigarNotImplementedException; import net.hyperic.sigar.SigarNotImplementedException;
/**
* Show process command line arguments.
*/
public class ShowArgs extends SigarCommandBase { public class ShowArgs extends SigarCommandBase {
public ShowArgs(Shell shell) { public ShowArgs(Shell shell) {

View File

@ -5,6 +5,9 @@ import java.util.Iterator;
import net.hyperic.sigar.SigarException; import net.hyperic.sigar.SigarException;
/**
* Show process environment.
*/
public class ShowEnv extends SigarCommandBase { public class ShowEnv extends SigarCommandBase {
public ShowEnv(Shell shell) { public ShowEnv(Shell shell) {

View File

@ -10,6 +10,9 @@ import net.hyperic.sigar.FileInfo;
import net.hyperic.sigar.FileTail; import net.hyperic.sigar.FileTail;
import net.hyperic.sigar.FileWatcherThread; import net.hyperic.sigar.FileWatcherThread;
/**
* Display the last part of files to the standard output.
*/
public class Tail { public class Tail {
public static void main(String[] args) throws SigarException { public static void main(String[] args) throws SigarException {

View File

@ -10,8 +10,15 @@ import net.hyperic.sigar.ProcCpu;
import net.hyperic.sigar.CurrentProcessSummary; import net.hyperic.sigar.CurrentProcessSummary;
/** /**
* Example:<br> * Display system resource utilization summaries and process information.
* <p>
* This version of the top command requires a ptql query to select which
* processes to display.
*
* Example to display java processes only:<br>
* <code>% java -jar sigar-bin/lib/sigar.jar Top State.Name.eq=java</code> * <code>% java -jar sigar-bin/lib/sigar.jar Top State.Name.eq=java</code>
*
* @see net.hyperic.sigar.ptql.ProcessQueryBuilder
*/ */
public class Top { public class Top {
private static final int SLEEP_TIME = 1000 * 5; private static final int SLEEP_TIME = 1000 * 5;

View File

@ -8,6 +8,9 @@ import net.hyperic.sigar.util.PrintfFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
/**
* Display how long the system has been running and the current load averages.
*/
public class Uptime extends SigarCommandBase { public class Uptime extends SigarCommandBase {
private static Object[] loadAvg = new Object[3]; private static Object[] loadAvg = new Object[3];
@ -24,7 +27,7 @@ public class Uptime extends SigarCommandBase {
} }
public String getUsageShort() { public String getUsageShort() {
return "Show how long the system has been running"; return "Display how long the system has been running";
} }
public void output(String[] args) throws SigarException { public void output(String[] args) throws SigarException {

View File

@ -7,6 +7,9 @@ import java.net.UnknownHostException;
import net.hyperic.sigar.Sigar; import net.hyperic.sigar.Sigar;
import net.hyperic.sigar.SigarException; import net.hyperic.sigar.SigarException;
/**
* Display Sigar, java and system version information.
*/
public class Version extends SigarCommandBase { public class Version extends SigarCommandBase {
private static String[] SYS_PROPS = { private static String[] SYS_PROPS = {
"os.name", "os.name",

View File

@ -12,6 +12,9 @@ import net.hyperic.sigar.FileInfo;
import net.hyperic.sigar.FileWatcher; import net.hyperic.sigar.FileWatcher;
import net.hyperic.sigar.FileWatcherThread; import net.hyperic.sigar.FileWatcherThread;
/**
* Watch a file or directory displaying attribute changes.
*/
public class Watch { public class Watch {
private static void printHeader(Sigar sigar, FileInfo info) private static void printHeader(Sigar sigar, FileInfo info)