public void parseArgs(String args[]) throws SigarException { for (int i=0; i<args.length; i++) { String arg = args[i]; if (arg.charAt(0) != '-') { this.files.add(arg); continue; } arg = arg.substring(1); if (arg.equals("f")) { this.follow = true; } else if (Character.isDigit(arg.charAt(0))) { this.number = Integer.parseInt(arg); } else { throw new SigarException("Unknown argument: " + args[i]); } } }
throw new SigarException(arg + " No such file or directory");
public void outputFileSystem(String arg) throws SigarException { FileSystemMap mounts = this.proxy.getFileSystemMap(); String name = FileCompleter.expand(arg); FileSystem fs = mounts.getMountPoint(name); if (fs != null) { printHeader(); output(fs); return; } throw new SigarException(arg + " No such file or directory"); }
public void output(String[] args) throws SigarException { this.mode = "Cur"; this.invoker = SigarInvokerJMX.getInstance(this.proxy, "Type=ResourceLimit"); for (int i=0; i<args.length; i++) { String arg = args[i]; if (arg.equals("-H")) { this.mode = "Max"; } else if (arg.equals("-S")) { this.mode = "Cur"; } else { throw new SigarException("Unknown argument: " + arg); } } println("core file size......." + getValue("Core")); println("data seg size........" + getValue("Data")); println("file size............" + getValue("FileSize")); println("pipe size............" + getValue("PipeSize")); println("max memory size......" + getValue("Memory")); println("open files..........." + getValue("OpenFiles")); println("stack size..........." + getValue("Stack")); println("cpu time............." + getValue("Cpu")); println("max user processes..." + getValue("Processes")); println("virtual memory......." + getValue("VirtualMemory")); }
break; default: throw new SigarException("Unknown proc cpu type " + type);
break; default: throw new SigarException("Unknown proc cpu type " + type);
break; default: throw new SigarException("Unknown swap type " + type);
break; default: throw new SigarException("Unknown swap type " + type);
private FileSystemUsage getMountedFileSystemUsage(SigarProxy sigar, String name) throws SigarException, NfsUnreachableException { FileSystem fs = sigar.getFileSystemMap().getFileSystem(name); if (fs == null) { throw new SigarException(name + " is not a mounted filesystem"); } if (fs instanceof NfsFileSystem) { NfsFileSystem nfs = (NfsFileSystem)fs; if (!nfsPing(nfs.getHostname())) { throw nfs.getUnreachableException(); } } return sigar.getFileSystemUsage(name); }
break; default: throw new SigarException("Unknown proc mem type " + type);
break; default: throw new SigarException("Unknown proc mem type " + type);
break; default: throw new SigarException("Unknown total mem type " + type);
break; default: throw new SigarException("Unknown total mem type " + type);
break; default: throw new SigarException("Unknown proc total type " + type);
break; default: throw new SigarException("Unknown proc total type " + type);
break; default: throw new SigarException("Unknown tcp type " + type);
break; default: throw new SigarException("Unknown tcp type " + type);
public void output(String[] args) throws SigarException { this.mode = "Cur"; this.invoker = SigarInvokerJMX.getInstance(this.proxy, "Type=ResourceLimit"); for (int i = 0; i < args.length; ++i) { String arg = args[i]; if (arg.equals("-H")) { this.mode = "Max"; } else { if (!arg.equals("-S")) { throw new SigarException("Unknown argument: " + arg); } this.mode = "Cur"; } } this.println("core file size......." + this.getValue("Core")); this.println("data seg size........" + this.getValue("Data")); this.println("file size............" + this.getValue("FileSize")); this.println("pipe size............" + this.getValue("PipeSize")); this.println("max memory size......" + this.getValue("Memory")); this.println("open files..........." + this.getValue("OpenFiles")); this.println("stack size..........." + this.getValue("Stack")); this.println("cpu time............." + this.getValue("Cpu")); this.println("max user processes..." + this.getValue("Processes")); this.println("virtual memory......." + this.getValue("VirtualMemory")); }
break; default: throw new SigarException("Unknown disk I/O type " + type);
break; default: throw new SigarException("Unknown net io type " + type);