public void output(long pid) throws SigarException { println("pid=" + pid); try { List modules = this.sigar.getProcModules(pid); for (int i=0; i<modules.size(); i++) { println(i + "=" + modules.get(i)); } } catch (SigarNotImplementedException e) { throw e; } catch (SigarException e) { println("[" + e.getMessage() + "]"); } }
public void output(String[] args) throws SigarException { long[] pids; if (args.length == 0) { pids = this.proxy.getProcList(); } else { pids = this.shell.findPids(args); } for (int i=0; i<pids.length; i++) { long pid = pids[i]; try { output(pid); } catch (SigarException e) { this.err.println("Exception getting process info for " + pid + ": " + e.getMessage()); } } }
@Override public void emit(ServiceEmitter emitter) { for (String dir : dirList) { DirUsage du = null; try { du = sigar.getDirUsage(dir); } catch (SigarException e) { log.error("Failed to get DiskUsage for [%s] due to [%s]", dir, e.getMessage()); } if (du != null) { final Map<String, Long> stats = ImmutableMap.of( "sys/storage/used", du.getDiskUsage() ); final ServiceMetricEvent.Builder builder = builder() .setDimension("fsDirName", dir); // fsDirName because FsStats uses fsDirName MonitorUtils.addDimensionsToBuilder(builder, dimensions); for (Map.Entry<String, Long> entry : stats.entrySet()) { emitter.emit(builder.build(entry.getKey(), entry.getValue())); } } } } }
public void output(String[] args) throws SigarException { String[] ifNames; if (args.length == 1) { ifNames = args; } else { ifNames = this.proxy.getNetInterfaceList(); } for (int i=0; i<ifNames.length; i++) { try { output(ifNames[i]); } catch (SigarException e) { println(ifNames[i] + "\t" + e.getMessage()); } } }
public void output(String[] args) throws SigarException { long[] pids = this.shell.findPids(args); for (int i=0; i<pids.length; i++) { try { output(pids[i]); } catch (SigarException e) { println("(" + e.getMessage() + ")"); } println("\n------------------------\n"); } }
public void output(String[] args) throws SigarException { for (int i=0; i<args.length; i++) { String exe = args[i]; if (new File(exe).exists()) { output(exe); } else { long[] pids = this.shell.findPids(exe); for (int j=0; j<pids.length; j++) { try { output(sigar.getProcExe(pids[j]).getName()); } catch (SigarException e) { println(exe + ": " + e.getMessage()); } } } } }
public void output(String[] args) throws SigarException { long[] pids = this.shell.findPids(args); for (int i=0; i<pids.length; i++) { try { println("pid=" + pids[i]); output(pids[i]); } catch (SigarException e) { println(e.getMessage()); } println("\n------------------------\n"); } }
public void processCommand(String[] args) throws ShellCommandUsageException, ShellCommandExecException { if (!validateArgs(args)) { throw new ShellCommandUsageException(getSyntax()); } try { output(args); } catch (SigarException e) { throw new ShellCommandExecException(e.getMessage()); } }
public void output(String[] args) throws SigarException { long[] pids = this.shell.findPids(args); for (int i=0; i<pids.length; i++) { try { println("pid=" + pids[i]); output(pids[i]); } catch (SigarException e) { println(e.getMessage()); } println("\n------------------------\n"); } }
public void output(String[] args) throws SigarException { this.isSingleProcess = false; if ((args.length != 0) && args[0].startsWith("-s")) { this.isSingleProcess = true; } if (this.isSingleProcess) { for (int i=1; i<args.length; i++) { try { output(args[i]); } catch (SigarException e) { println("(" + e.getMessage() + ")"); } println("\n------------------------\n"); } } else { long[] pids = this.shell.findPids(args); for (int i=0; i<pids.length; i++) { try { output(String.valueOf(pids[i])); } catch (SigarPermissionDeniedException e) { println(this.shell.getUserDeniedMessage(pids[i])); } catch (SigarException e) { println("(" + e.getMessage() + ")"); } println("\n------------------------\n"); } } }
public void output(String[] args) throws SigarException { long[] pids = this.shell.findPids(args); for (int i=0; i<pids.length; i++) { try { output(pids[i]); } catch (SigarPermissionDeniedException e) { println(this.shell.getUserDeniedMessage(pids[i])); } catch (SigarException e) { println("(" + e.getMessage() + ")"); } println("\n------------------------\n"); } }
public void output(String pid) throws SigarException { println("pid=" + pid); try { println("state=" + sigar.getProcState(pid)); } catch (SigarException e) { if (this.isSingleProcess) { println(e.getMessage()); } } try { println("mem=" + sigar.getProcMem(pid)); } catch (SigarException e) {} try { println("cpu=" + sigar.getProcCpu(pid)); } catch (SigarException e) {} try { println("cred=" + sigar.getProcCred(pid)); } catch (SigarException e) {} try { println("credname=" + sigar.getProcCredName(pid)); } catch (SigarException e) {} }
desirableXmx = DEFAULT_XMX_SIZE; } catch (SigarException e) { LOGGER.error("Error occurred while calculating memory size : {}", e.getMessage()); desirableXmx = DEFAULT_XMX_SIZE;
@Override public DirUsage getDirectoryUsage(String path) { DirUsage dirUsage = null; try { dirUsage = sigar.getDirUsage(path); } catch (SigarException e) { log.warn("Can not get directory usage for [" + path + "] cause: " + e.getMessage()); return null; } return dirUsage; }
@Override public DirUsage getDirectoryUsage(String path) { DirUsage dirUsage = null; try { dirUsage = sigar.getDirUsage(path); } catch (SigarException e) { log.warn("Can not get directory usage for [" + path + "] cause: " + e.getMessage()); return null; } return dirUsage; }
public long getVal() throws StatUnreachableException { try { return (long) sigar.getLoadAverage()[0]; } catch (SigarException e) { throw new StatUnreachableException(e.getMessage(), e); } } });
public long getVal() throws StatUnreachableException { try { long curr = sigar.getTcp().getInErrs(); long rtn = curr - last; last = curr; return rtn; } catch (SigarException e) { throw new StatUnreachableException(e.getMessage(), e); } } });
public long getVal() throws StatUnreachableException { try { return (long) (sigar.getProcCpu(getProcPid()).getPercent() * 100); } catch (SigarException e) { throw new StatUnreachableException(e.getMessage(), e); } } });
public long getVal() throws StatUnreachableException { try { return (long) sigar.getProcMem(getProcPid()).getResident(); } catch (SigarException e) { throw new StatUnreachableException(e.getMessage(), e); } } });
public long getVal() throws StatUnreachableException { try { long curr = sigar.getTcp().getRetransSegs(); long rtn = curr - last; last = curr; if (isFirst) { isFirst = false; throw new StatUnreachableException("don't return first value"); } return rtn; } catch (SigarException e) { throw new StatUnreachableException(e.getMessage(), e); } } });