pmReceiveText(3) return text describing a performance metric

Other Alias

pmLookupText, pmRequestText

C SYNOPSIS

#include <pcp/pmapi.h>

int pmLookupText(pmID pmid, int level, char **buffer)
int pmRequestText(int ctx, pmID pmid, int level)
int pmReceiveText(int ctx, char **buffer)

cc ... -lpcp

DESCRIPTION

Provided the source of metrics from the current Performance Metrics Application Programming Interface (PMAPI) context is a host, retrieve descriptive text about the performance metric identified by pmid.

The argument level should be PM_TEXT_ONELINE for a one-line summary, else PM_TEXT_HELP for a more verbose description, suited to a help dialog.

The space pointed to by buffer will have been allocated in pmLookupText with malloc(3C), and it is the responsibility of the caller to free(3C) the space when it is no longer required.

pmLookupText returns zero on success.

pmRequestText and pmReceiveText are used by applications which must communicate with the PMCD asynchronously. These functions take explict context handle ctx which must refer to a host context (i.e. created by passing PM_CONTEXT_HOST to pmNewContext). pmRequestText sends request to PMCD to provide descriptive text about a metric identified by a PMID and returns without waiting for the response, pmReceiveText reads reply from PMCD. It is the responsibility of the application to make sure the data are ready before calling pmReceiveText to avoid blocking.

pmReceiveText can be used to receive replies from either pmRequestText or pmRequestInDomText.

DIAGNOSTICS

PM_ERR_NOTHOST
if the current PMAPI context is an archive log (help and one-line text is not maintained in the archive logs)
PM_ERR_CTXBUSY
Context is currently in use by another asynchronous call