Given a PCP service name, as identified by service, and using the
type of discovery optionally specified in mechanism,
pmDiscoverServices returns, via urls, a list of URLs representing the
services discovered on the network.
The internal function __pmDiscoverServicesWithOptions performs the
same function and adds arguments for global options and a mechanism
for interrupting the discovery process.
The pmfind(1) utility provides command line access to both of these
pmDiscoverServices(service, mechanism, urls)
is equivalent to calling
__pmDiscoverServicesWithOptions(service, mechanism, NULL, NULL,
service specifies the PCP service to be discovered. Currently
supported services are PM_SERVER_SERVICE_SPEC, PM_PROXY_SERVICE_SPEC
and PM_WEBD_SERVICE_SPEC, which search for pmcd(1), pmproxy(1), and
pmwebd(1), servers respectively.
mechanism specifies the style of discovery to be used.
The currently supported mechanisms are:
avahi This searches for services which are broadcasting using mDNS
via avahi-daemon(8). An optional suffix ",timeout=N" may be
added to specify the discovery timeout in floating-point
multiples of one second. The default timeout is 0.5 seconds,
which may be overridden by the AVAHI_DISCOVERY_TIMEOUT
environment variable, also specified in floating-point
multiples of one second. If both are specified, then the value
specified in the environment variable takes precedence.
Actively probes the given subnet for the requested PCP
service(s). <net-address> is an inet or ipv6 network address
and <mask-bits> is the number of bits used to define the
subnet. For example, 192.168.1.0/24 defines an 8 bit subnet
consisting of the addresses 192.168.1.0 through 192.168.1.255.
An optional suffix ",maxThreads=N" may be added to limit the
number of threads used while probing. The default is no fixed
limit, which is to say that the process' rlimits for the
number of threads and open file descriptors will be respected.
An optional suffix ",timeout=N" may be added to specify the
timeout for each connection attempt in floating-point
multiples of one second. The default timeout is 20
mechanism may also be NULL, which means to use all available
For __pmDiscoverServicesWithOptions, optionsString specifies global
options to be applied to the discovery process. Options are comma-
separated and may be one or more of the following:
This requests that DNS name resolution be attempted for the
addresses of any discovered services.
This specifies a timeout period after which the discovery
process will be interrupted. N is a floating point number
representing the number of seconds before timing out.
optionsString may also be NULL, which means that no global options
For __pmDiscoverServicesWithOptions, flags specifies a pointer to an
object of type unsigned which is a bit mask of options/status flags
for the discovery process. The supported flags are:
Specifying this flag is equivalent to specifying resolve in
This flag must be unset when calling
__pmDiscoverServicesWithOptions but may be set asynchronously
(by an interrupt handler, for example) in order to interrupt
the service discovery process.
flags may also be NULL, which indicates that no flags are set.
pmDiscoverServices and __pmDiscoverServicesWithOptions will return
the number of services discovered, else a value less than zero for an
error. The value zero indicates that no services were discovered.
The resulting list of pointers, urls, and the values (the URLs) that
the pointers reference will have been allocated by pmDiscoverServices
or __pmDiscoverServicesWithOptions with a single call to malloc(3),
and it is the responsibility of the pmDiscoverServices or
__pmDiscoverServicesWithOptions caller to free(urls) to release the
space when it is no longer required.
When an error occurs, or no services are discovered, urls is
undefined (no space will have been allocated, and so calling free(3)
is a singularly bad idea).
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(5). Values for these
variables may be obtained programmatically using the pmGetConfig(3)
This page is part of the PCP (Performance Co-Pilot) project.
Information about the project can be found at ⟨http://www.pcp.io/⟩.
If you have a bug report for this manual page, send it to
email@example.com. This page was obtained from the project's upstream
Git repository ⟨git://git.pcp.io/pcp⟩ on 2017-03-13. If you discover
any rendering problems in this HTML version of the page, or you
believe there is a better or more up-to-date source for the page, or
you have corrections or improvements to the information in this
COLOPHON (which is not part of the original manual page), send a mail
Performance Co-Pilot PCP PMDISCOVERSERVICES(3)