#include "../common/stats.h"
int system_cpu_num(AGENT_REQUEST *request, AGENT_RESULT *result)
SET_MSG_RESULT(result, zbx_strdup(NULL, "Too many parameters."));
tmp = get_rparam(request, 0);
if (NULL != tmp && '\0' != *tmp && 0 != strcmp(tmp, "online"))
SET_MSG_RESULT(result, zbx_strdup(NULL, "Invalid first parameter."));
if (0 != lpar_get_info(LPAR_INFO_FORMAT2, &buf, sizeof(buf)))
SET_MSG_RESULT(result, zbx_dsprintf(NULL, "Cannot obtain system information: %s", zbx_strerror(errno)));
SET_UI64_RESULT(result, buf.online_lcpus);
SET_MSG_RESULT(result, zbx_strdup(NULL, "Agent was compiled without support for Perfstat API."));
int system_cpu_util(AGENT_REQUEST *request, AGENT_RESULT *result)
int cpu_num, state, mode, res;
SET_MSG_RESULT(result, zbx_strdup(NULL, "Too many parameters."));
tmp = get_rparam(request, 0);
if (NULL == tmp || '\0' == *tmp || 0 == strcmp(tmp, "all"))
cpu_num = ZBX_CPUNUM_ALL;
else if (SUCCEED != zbx_is_uint31_1(tmp, &cpu_num))
SET_MSG_RESULT(result, zbx_strdup(NULL, "Invalid first parameter."));
tmp = get_rparam(request, 1);
if (NULL == tmp || '\0' == *tmp || 0 == strcmp(tmp, "user"))
state = ZBX_CPU_STATE_USER;
else if (0 == strcmp(tmp, "system"))
state = ZBX_CPU_STATE_SYSTEM;
else if (0 == strcmp(tmp, "idle"))
state = ZBX_CPU_STATE_IDLE;
else if (0 == strcmp(tmp, "iowait"))
state = ZBX_CPU_STATE_IOWAIT;