From 3e4fc2659d4226a36a4c82e1336a3eddf9fe7bf3 Mon Sep 17 00:00:00 2001 From: gmarz Date: Fri, 23 Jan 2015 10:34:40 -0500 Subject: [PATCH] Nodes Stats: Fix open file descriptors count on Windows Closes #1563 --- .../org/elasticsearch/monitor/process/SigarProcessProbe.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/elasticsearch/monitor/process/SigarProcessProbe.java b/src/main/java/org/elasticsearch/monitor/process/SigarProcessProbe.java index 8b25917a8d6..d24d6aa27bc 100644 --- a/src/main/java/org/elasticsearch/monitor/process/SigarProcessProbe.java +++ b/src/main/java/org/elasticsearch/monitor/process/SigarProcessProbe.java @@ -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);