Product SiteDocumentation Site

3.8.11. PMAPI Ancillary Support Services

The functions described in this section provide services that are complementary to, but not necessarily a part of, the distributed manipulation of performance metrics delivered by the PCP components.

3.8.11.1.  pmGetConfig Function

char *pmGetConfig(const char *variable)
Python:
"env variable value = pmGetConfig("env variable")
The pmGetConfig function searches for a variable first in the environment and then, if one is not found, in the PCP configuration file and returns the string result. If a variable is not already in the environment, it is added with a call to the setenv function before returning.
The default location of the PCP configuration file is /etc/pcp.conf, but this location may be changed by setting PCP_CONF in the environment to a new location, as described in the pcp.conf(5) man page.
If the variable is not found in either the environment or the PCP configuration file (or the PCP configuration file is not found and PCP_CONF is not set in the environment), then a fatal error message is printed and the process will exit. Although this sounds drastic, it is the only course of action available because the PCP configuration or installation is fatally flawed.
If this function returns, the returned value points to a string in the environment; and so although the function returns the same type as the getenv function (which should probably be a const char *), changing the content of the string is not recommended.
The python bindings return a value for environment variable "env variable" from environment or pcp config file.