SET_MSG_RESULT(result, zbx_dsprintf(NULL, "Cannot obtain system information: %s", zbx_strerror(errno)));
static u_int pagesize = 0;
#define ZBX_SYSCTLBYNAME(name, value) \
if (0 != sysctlbyname(name, &value, &len, NULL, 0)) \
SET_MSG_RESULT(result, zbx_dsprintf(NULL, "Cannot obtain \"%s\" system parameter: %s", \
name, zbx_strerror(errno))); \
return SYSINFO_RET_FAIL; \
static int VM_MEMORY_TOTAL(AGENT_RESULT *result)
unsigned long totalbytes;
ZBX_SYSCTLBYNAME("hw.physmem", totalbytes);
SET_UI64_RESULT(result, (zbx_uint64_t)totalbytes);
static int VM_MEMORY_ACTIVE(AGENT_RESULT *result)
ZBX_SYSCTLBYNAME("vm.stats.vm.v_active_count", activepages);
SET_UI64_RESULT(result, (zbx_uint64_t)activepages * pagesize);
static int VM_MEMORY_INACTIVE(AGENT_RESULT *result)
ZBX_SYSCTLBYNAME("vm.stats.vm.v_inactive_count", inactivepages);
SET_UI64_RESULT(result, (zbx_uint64_t)inactivepages * pagesize);
static int VM_MEMORY_WIRED(AGENT_RESULT *result)
ZBX_SYSCTLBYNAME("vm.stats.vm.v_wire_count", wiredpages);
SET_UI64_RESULT(result, (zbx_uint64_t)wiredpages * pagesize);
static int VM_MEMORY_CACHED(AGENT_RESULT *result)
ZBX_SYSCTLBYNAME("vm.stats.vm.v_cache_count", cachedpages);
SET_UI64_RESULT(result, (zbx_uint64_t)cachedpages * pagesize);