Nodes Stats: Fix open file descriptors count on Windows

Closes #1563
This commit is contained in:
gmarz 2015-01-23 10:34:40 -05:00
parent b359520849
commit 3e4fc2659d
1 changed files with 3 additions and 1 deletions

View File

@ -52,8 +52,10 @@ public class SigarProcessProbe extends AbstractComponent implements ProcessProbe
ProcessStats stats = new ProcessStats();
stats.timestamp = System.currentTimeMillis();
stats.openFileDescriptors = JmxProcessProbe.getOpenFileDescriptorCount();
try {
if (stats.openFileDescriptors == -1) {
stats.openFileDescriptors = sigar.getProcFd(sigar.getPid()).getTotal();
}
ProcCpu cpu = sigar.getProcCpu(sigar.getPid());
stats.cpu = new ProcessStats.Cpu();
stats.cpu.percent = (short) (cpu.getPercent() * 100);