How does the Infrastructure agent collects memory metrics on Unix?
Within the new Infrastructure agent there is the option to select a native versus command-line collector in the agent properties.
The native collector makes use of perfstat_memory_total_t structure (filled in by calling perfstat_memory_total(...)). The numbers reported by that interface are reported with units of pages - when the agent produces a value in bytes or MB, these numbers are multiplied by the page size (typically 4096).
- Memory.capacity is determined as follows:
sum of (real_free, numperm, real_process, real_system) * PAGE_SIZE
(value in bytes, converted to MB before sent to server)
- Memory.consumed is determined as follows:
sum of (real_system, real_process) * PAGE_SIZE
(value in bytes, converted to MB before sent to server)
- Memory utilization is determined as follows:
(Memory.consumed / Memory.capacity) * 100
Memory capacity is equivalent across the native/command-line collectors.
Consumed memory is different: this is because vmstat reports an actual number of free pages (from which the agent derives consumed memory). The native collector considers the sum of system and process memory to be the total consumed. The difference between the two will be the number of pages reserved by the OS but not in use by process or system.