static int VM_MEMORY_WIRED(AGENT_RESULT *result) { ZBX_SYSCTL(uvm); SET_UI64_RESULT(result, uvm.wired << uvm.pageshift); return SYSINFO_RET_OK; }
static int VM_MEMORY_FILE(AGENT_RESULT *result) { ZBX_SYSCTL(uvm); SET_UI64_RESULT(result, uvm.filepages << uvm.pageshift); return SYSINFO_RET_OK; }
static int VM_MEMORY_USED(AGENT_RESULT *result) { ZBX_SYSCTL(uvm); SET_UI64_RESULT(result, (uvm.npages - uvm.free) << uvm.pageshift); return SYSINFO_RET_OK; }
static int VM_MEMORY_INACTIVE(AGENT_RESULT *result) { ZBX_SYSCTL(uvm); SET_UI64_RESULT(result, uvm.inactive << uvm.pageshift); return SYSINFO_RET_OK; }
static int VM_MEMORY_CACHED(AGENT_RESULT *result) { ZBX_SYSCTL(uvm); SET_UI64_RESULT(result, (uvm.execpages + uvm.filepages) << uvm.pageshift); return SYSINFO_RET_OK; }
static int VM_MEMORY_TOTAL(AGENT_RESULT *result) { ZBX_SYSCTL(memsize); SET_UI64_RESULT(result, memsize); return SYSINFO_RET_OK; }
static int VM_MEMORY_BUFFERS(AGENT_RESULT *result) { int mib[] = {CTL_VM, VM_NKMEMPAGES}, pages; ZBX_SYSCTL(pages); SET_UI64_RESULT(result, (zbx_uint64_t)pages * sysconf(_SC_PAGESIZE)); return SYSINFO_RET_OK; }
static int VM_MEMORY_SHARED(AGENT_RESULT *result) { int mib[] = {CTL_VM, VM_METER}; struct vmtotal vm; ZBX_SYSCTL(vm); SET_UI64_RESULT(result, (zbx_uint64_t)(vm.t_vmshr + vm.t_rmshr) * sysconf(_SC_PAGESIZE)); return SYSINFO_RET_OK; }
static int VM_MEMORY_PUSED(AGENT_RESULT *result) { ZBX_SYSCTL(uvm); if (0 == uvm.npages) return SYSINFO_RET_FAIL; SET_DBL_RESULT(result, (uvm.npages - uvm.free) / (double)uvm.npages * 100); return SYSINFO_RET_OK; }
static int VM_MEMORY_AVAILABLE(AGENT_RESULT *result) { zbx_uint64_t available; ZBX_SYSCTL(uvm); available = uvm.inactive + uvm.execpages + uvm.filepages + uvm.free; SET_UI64_RESULT(result, available << uvm.pageshift); return SYSINFO_RET_OK; }
static int VM_MEMORY_PUSED(AGENT_RESULT *result) { ZBX_SYSCTL(uvm); if (0 == uvm.npages) { SET_MSG_RESULT(result, zbx_strdup(NULL, "Cannot calculate percentage because total is zero.")); return SYSINFO_RET_FAIL; } SET_DBL_RESULT(result, (uvm.npages - uvm.free) / (double)uvm.npages * 100); return SYSINFO_RET_OK; }
static int VM_MEMORY_PAVAILABLE(AGENT_RESULT *result) { zbx_uint64_t available; ZBX_SYSCTL(uvm); if (0 == uvm.npages) return SYSINFO_RET_FAIL; available = uvm.inactive + uvm.execpages + uvm.filepages + uvm.free; SET_DBL_RESULT(result, available / (double)uvm.npages * 100); return SYSINFO_RET_OK; }
static int VM_MEMORY_PAVAILABLE(AGENT_RESULT *result) { zbx_uint64_t available; ZBX_SYSCTL(uvm); if (0 == uvm.npages) { SET_MSG_RESULT(result, zbx_strdup(NULL, "Cannot calculate percentage because total is zero.")); return SYSINFO_RET_FAIL; } available = uvm.inactive + uvm.execpages + uvm.filepages + uvm.free; SET_DBL_RESULT(result, available / (double)uvm.npages * 100); return SYSINFO_RET_OK; }
static int VM_MEMORY_PAVAILABLE(AGENT_RESULT *result) { zbx_uint64_t available; ZBX_SYSCTL(memsize); if (0 == memsize) { SET_MSG_RESULT(result, zbx_strdup(NULL, "Cannot calculate percentage because total is zero.")); return SYSINFO_RET_FAIL; } ZBX_HOST_STATISTICS(vm); available = (zbx_uint64_t)(vm.inactive_count + vm.free_count) * pagesize; SET_DBL_RESULT(result, available / (double)memsize * 100); return SYSINFO_RET_OK; }
static int VM_MEMORY_PUSED(AGENT_RESULT *result) { zbx_uint64_t used; ZBX_SYSCTL(memsize); if (0 == memsize) { SET_MSG_RESULT(result, zbx_strdup(NULL, "Cannot calculate percentage because total is zero.")); return SYSINFO_RET_FAIL; } ZBX_HOST_STATISTICS(vm); used = (zbx_uint64_t)(vm.active_count + vm.wire_count) * pagesize; SET_DBL_RESULT(result, used / (double)memsize * 100); return SYSINFO_RET_OK; }