Refine search
@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 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]); } } }
cpuinfo = sigar.getCpuInfoList(); cpuPerc = sigar.getCpuPercList(); List cpuList = new ArrayList(); for (int i = 0; i < cpuinfo.length; i++) { cpuList.add(cpuMap); sigar.getCpuPerc(); map.put("cpu", cpuList); list.add(loadavg[2]); } catch(SigarException se) { se.printStackTrace(); swapMap.putAll(swap.toMap()); } catch(SigarException se){ se.printStackTrace(); se.printStackTrace(); se.printStackTrace();
private SigarLibrary() { logger.info("Initializing SIGAR library"); try { sigar = new Sigar(); mounts = sigar.getFileSystemMap(); initialized = true; } catch (SigarException e) { logger.info("Could not initialize SIGAR library {} ", e.getMessage()); } catch (UnsatisfiedLinkError linkError) { logger.info("Could not initialize SIGAR library {} ", linkError.getMessage()); } }
try { long free = new Sigar().getMem().getActualFree() - reservedMemory; long perProcessTotalMemory = Math.max(free / processCount, MIN_PER_PROCESS_MEM_SIZE); desirableXmx = (long) (perProcessTotalMemory * 0.5); desirableXmx = DEFAULT_XMX_SIZE; } catch (SigarException e) { LOGGER.error("Error occurred while calculating memory size : {}", e.getMessage()); desirableXmx = DEFAULT_XMX_SIZE;
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) {} }
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()); } } }
public long getVal() throws StatUnreachableException { try { long curr = sigar.getSwap().getPageIn(); 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); } } });
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.getLoadAverage()[0]; } catch (SigarException e) { throw new StatUnreachableException(e.getMessage(), e); } } });
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 { 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 long getVal() throws StatUnreachableException { try { return (long) sigar.getProcMem(getProcPid()).getResident(); } catch (SigarException e) { throw new StatUnreachableException(e.getMessage(), e); } } });
Sigar.load(); } catch (SigarException e) { e.printStackTrace(); //should never happen
public void onException(FileInfo info, SigarException e) { System.out.println("Error checking " + info.getName() + ":"); e.printStackTrace(); } };
@Override public void poll() { long lastTimestamp = System.nanoTime(); NetInterfaceStat lastInfo; try { lastInfo = sigar.getNetInterfaceStat(intf); } catch (SigarException e) { if (showError) { LOGGER.warn("Probe exception: " + e.toString()); showError = false; } return; } sampler.report(intf, prevTimestamp, prevInfo, lastTimestamp, lastInfo); prevTimestamp = lastTimestamp; prevInfo = lastInfo; showError = true; }
private SigarLibrary() { logger.info("Initializing SIGAR library"); try { sigar = new Sigar(); mounts = sigar.getFileSystemMap(); initialized = true; } catch (SigarException e) { logger.info("Could not initialize SIGAR library {} ", e.getMessage()); } catch (UnsatisfiedLinkError linkError) { logger.info("Could not initialize SIGAR library {} ", linkError.getMessage()); } }
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 long getVal() throws StatUnreachableException { try { long curr = sigar.getSwap().getPageOut(); 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); } } });