java.lang.Object
org.elasticsearch.monitor.os.OsProbe
The 
OsProbe class retrieves information about the physical and swap size of the machine
 memory, as well as the system load average and cpu load.
 In some exceptional cases, it's possible the underlying native methods used by
 getFreePhysicalMemorySize(), getTotalPhysicalMemorySize(),
 getFreeSwapSpaceSize(), and getTotalSwapSpaceSize() can return a
 negative value. Because of this, we prevent those methods from returning negative values,
 returning 0 instead.
 
The OS can report a negative number in a number of cases:
- Non-supported OSes (HP-UX, or AIX)
- A failure of macOS to initialize host statistics
- An OS that does not support the _SC_PHYS_PAGESor_SC_PAGE_SIZEflags for thesysconf()linux kernel call
- An overflow of the product of _SC_PHYS_PAGESand_SC_PAGE_SIZE
- An error case retrieving these values from a linux kernel
- A non-standard libc implementation not implementing the required values
For a more exhaustive explanation, see https://github.com/elastic/elasticsearch/pull/42725
- 
Method SummaryModifier and TypeMethodDescriptionlongReturns the adjusted total amount of physical memory in bytes.longReturns the amount of free physical memory in bytes.longReturns the amount of free swap space in bytes.static OsProbestatic shortlongReturns the total amount of physical memory in bytes.longReturns the total amount of swap space in bytes.osStats()
- 
Method Details- 
getFreePhysicalMemorySizepublic long getFreePhysicalMemorySize()Returns the amount of free physical memory in bytes.
- 
getTotalPhysicalMemorySizepublic long getTotalPhysicalMemorySize()Returns the total amount of physical memory in bytes.
- 
getAdjustedTotalMemorySizepublic long getAdjustedTotalMemorySize()Returns the adjusted total amount of physical memory in bytes. Total memory may be overridden when some other process is running that is known to consume a non-negligible amount of memory. This is read from the "es.total_memory_bytes" system property. When there is no override this method returns the same value asgetTotalPhysicalMemorySize.
- 
getFreeSwapSpaceSizepublic long getFreeSwapSpaceSize()Returns the amount of free swap space in bytes.
- 
getTotalSwapSpaceSizepublic long getTotalSwapSpaceSize()Returns the total amount of swap space in bytes.
- 
getSystemCpuPercentpublic static short getSystemCpuPercent()
- 
getInstance
- 
osStats
 
-