if (PDH_CSTATUS_NO_OBJECT == (status = PdhEnumObjectItems(NULL, NULL, object_name, NULL, &cnt_len, NULL,
#include "perfstat/perfstat.h"
int user_perf_counter(AGENT_REQUEST *request, AGENT_RESULT *result)
int ret = SYSINFO_RET_FAIL;
char *counter, *error = NULL;
zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __func__);
if (1 != request->nparam)
SET_MSG_RESULT(result, zbx_strdup(NULL, "Invalid number of parameters."));
if (NULL == (counter = get_rparam(request, 0)) || '\0' == *counter)
SET_MSG_RESULT(result, zbx_strdup(NULL, "Invalid first parameter."));
if (SUCCEED != get_perf_counter_value_by_name(counter, &value, &error))
SET_MSG_RESULT(result, error != NULL ? error :
zbx_strdup(NULL, "Cannot obtain performance information from collector."));
SET_DBL_RESULT(result, value);
zabbix_log(LOG_LEVEL_DEBUG, "End of %s():%s", __func__, zbx_result_string(ret));
static int perf_counter_ex(const char *function, AGENT_REQUEST *request, AGENT_RESULT *result,
zbx_perf_counter_lang_t lang)
char counterpath[PDH_MAX_COUNTER_PATH], *tmp, *error = NULL;