diff options
Diffstat (limited to 'src/libs/zbxsysinfo/openbsd/memory.c')
-rw-r--r-- | src/libs/zbxsysinfo/openbsd/memory.c | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/src/libs/zbxsysinfo/openbsd/memory.c b/src/libs/zbxsysinfo/openbsd/memory.c index b28ab227ec3..db0412c6312 100644 --- a/src/libs/zbxsysinfo/openbsd/memory.c +++ b/src/libs/zbxsysinfo/openbsd/memory.c @@ -18,6 +18,7 @@ **/ #include "zbxsysinfo.h" +#include "../sysinfo.h" #include "log.h" @@ -35,7 +36,7 @@ static struct uvmexp uvm; return SYSINFO_RET_FAIL; \ } -static int VM_MEMORY_TOTAL(AGENT_RESULT *result) +static int vm_memory_total(AGENT_RESULT *result) { ZBX_SYSCTL(uvm); @@ -44,7 +45,7 @@ static int VM_MEMORY_TOTAL(AGENT_RESULT *result) return SYSINFO_RET_OK; } -static int VM_MEMORY_ACTIVE(AGENT_RESULT *result) +static int vm_memory_active(AGENT_RESULT *result) { ZBX_SYSCTL(uvm); @@ -53,7 +54,7 @@ static int VM_MEMORY_ACTIVE(AGENT_RESULT *result) return SYSINFO_RET_OK; } -static int VM_MEMORY_INACTIVE(AGENT_RESULT *result) +static int vm_memory_inactive(AGENT_RESULT *result) { ZBX_SYSCTL(uvm); @@ -62,7 +63,7 @@ static int VM_MEMORY_INACTIVE(AGENT_RESULT *result) return SYSINFO_RET_OK; } -static int VM_MEMORY_WIRED(AGENT_RESULT *result) +static int vm_memory_wired(AGENT_RESULT *result) { ZBX_SYSCTL(uvm); @@ -71,7 +72,7 @@ static int VM_MEMORY_WIRED(AGENT_RESULT *result) return SYSINFO_RET_OK; } -static int VM_MEMORY_FREE(AGENT_RESULT *result) +static int vm_memory_free(AGENT_RESULT *result) { ZBX_SYSCTL(uvm); @@ -80,7 +81,7 @@ static int VM_MEMORY_FREE(AGENT_RESULT *result) return SYSINFO_RET_OK; } -static int VM_MEMORY_USED(AGENT_RESULT *result) +static int vm_memory_used(AGENT_RESULT *result) { ZBX_SYSCTL(uvm); @@ -89,7 +90,7 @@ static int VM_MEMORY_USED(AGENT_RESULT *result) return SYSINFO_RET_OK; } -static int VM_MEMORY_PUSED(AGENT_RESULT *result) +static int vm_memory_pused(AGENT_RESULT *result) { ZBX_SYSCTL(uvm); @@ -104,7 +105,7 @@ static int VM_MEMORY_PUSED(AGENT_RESULT *result) return SYSINFO_RET_OK; } -static int VM_MEMORY_AVAILABLE(AGENT_RESULT *result) +static int vm_memory_available(AGENT_RESULT *result) { ZBX_SYSCTL(uvm); @@ -114,7 +115,7 @@ static int VM_MEMORY_AVAILABLE(AGENT_RESULT *result) return SYSINFO_RET_OK; } -static int VM_MEMORY_PAVAILABLE(AGENT_RESULT *result) +static int vm_memory_pavailable(AGENT_RESULT *result) { ZBX_SYSCTL(uvm); @@ -130,7 +131,7 @@ static int VM_MEMORY_PAVAILABLE(AGENT_RESULT *result) return SYSINFO_RET_OK; } -static int VM_MEMORY_BUFFERS(AGENT_RESULT *result) +static int vm_memory_buffers(AGENT_RESULT *result) { int mib[] = {CTL_VM, VM_NKMEMPAGES}, pages; @@ -141,7 +142,7 @@ static int VM_MEMORY_BUFFERS(AGENT_RESULT *result) return SYSINFO_RET_OK; } -static int VM_MEMORY_CACHED(AGENT_RESULT *result) +static int vm_memory_cached(AGENT_RESULT *result) { ZBX_SYSCTL(uvm); @@ -150,7 +151,7 @@ static int VM_MEMORY_CACHED(AGENT_RESULT *result) return SYSINFO_RET_OK; } -static int VM_MEMORY_SHARED(AGENT_RESULT *result) +static int vm_memory_shared(AGENT_RESULT *result) { int mib[] = {CTL_VM, VM_METER}; struct vmtotal vm; @@ -162,7 +163,7 @@ static int VM_MEMORY_SHARED(AGENT_RESULT *result) return SYSINFO_RET_OK; } -int VM_MEMORY_SIZE(AGENT_REQUEST *request, AGENT_RESULT *result) +int vm_memory_size(AGENT_REQUEST *request, AGENT_RESULT *result) { char *mode; int ret = SYSINFO_RET_FAIL; @@ -176,29 +177,29 @@ int VM_MEMORY_SIZE(AGENT_REQUEST *request, AGENT_RESULT *result) mode = get_rparam(request, 0); if (NULL == mode || '\0' == *mode || 0 == strcmp(mode, "total")) - ret = VM_MEMORY_TOTAL(result); + ret = vm_memory_total(result); else if (0 == strcmp(mode, "active")) - ret = VM_MEMORY_ACTIVE(result); + ret = vm_memory_active(result); else if (0 == strcmp(mode, "inactive")) - ret = VM_MEMORY_INACTIVE(result); + ret = vm_memory_inactive(result); else if (0 == strcmp(mode, "wired")) - ret = VM_MEMORY_WIRED(result); + ret = vm_memory_wired(result); else if (0 == strcmp(mode, "free")) - ret = VM_MEMORY_FREE(result); + ret = vm_memory_free(result); else if (0 == strcmp(mode, "used")) - ret = VM_MEMORY_USED(result); + ret = vm_memory_used(result); else if (0 == strcmp(mode, "pused")) - ret = VM_MEMORY_PUSED(result); + ret = vm_memory_pused(result); else if (0 == strcmp(mode, "available")) - ret = VM_MEMORY_AVAILABLE(result); + ret = vm_memory_available(result); else if (0 == strcmp(mode, "pavailable")) - ret = VM_MEMORY_PAVAILABLE(result); + ret = vm_memory_pavailable(result); else if (0 == strcmp(mode, "buffers")) - ret = VM_MEMORY_BUFFERS(result); + ret = vm_memory_buffers(result); else if (0 == strcmp(mode, "cached")) - ret = VM_MEMORY_CACHED(result); + ret = vm_memory_cached(result); else if (0 == strcmp(mode, "shared")) - ret = VM_MEMORY_SHARED(result); + ret = vm_memory_shared(result); else { SET_MSG_RESULT(result, zbx_strdup(NULL, "Invalid first parameter.")); |