pmGetContextHostName(3) return the hostname associated with a Performance Co-Pilot context identifier


#include <pcp/pmapi.h>

const char *pmGetContextHostName(int id)

cc ... -lpcp


Given a valid PCP context identifier previously created with pmNewContext(3) or pmDupContext(3), the pmGetContextHostName function returns the hostname associated with id. The context id may be associated with either a live (host) or archive source of data. In the latter case, the hostname returned is extracted from the archive label using pmGetArchiveLabel(3).


If id is not a valid PCP context identifier, this function returns a zero length string and hence never fails.


Environment variables with the prefix PCP_ are used to parameterize the file and directory names used by PCP. On each installation, the file /etc/pcp.conf contains the local values for these variables. The $PCP_CONF variable may be used to specify an alternative configuration file, as described in pcp.conf(4). Values for these variables may be obtained programatically using the pmGetConfig(3) function.