PMDISCOVERSERVICES(3)
π PMDISCOVERSERVICES(3) π
okay bestie, so this one lives in the Library Functions Manual section, and it's literally about finding PCP services all over the network π¦
β¨ NAME β¨
pmDiscoverServices, __pmDiscoverServicesWithOptions β the duo that discovers PCP services on the network π
πΈ C SYNOPSIS πΈ
#include <pcp/pmapi.h>
int pmDiscoverServices(const char *service, const char *mechanism,
char ***urls);
#include <pcp/libpcp.h>
int __pmDiscoverServicesWithOptions(const char *service,
const char *mechanism,
const char *optionsString,
const volatile unsigned *flags,
char ***urls);
cc ... -lpcp
π¨ CAVEAT π¨
ngl, this documentation is meant for internal Performance Co-Pilot (PCP) developer use. Like, devs only, iykyk.
These interfaces are not part of the PCP APIs that are guaranteed to stay fixed across releases π and they may not work, or may provide different semantics at some point in the future. soβ¦ don't build your whole personality on them fr fr π
π DESCRIPTION π
Given a PCP service name (that's 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 does the exact same thing, but it adds arguments for global options and a mechanism for interrupting the discovery process. main character energy honestly π
The pmfind(1) utility gives you command line access to both of these interfaces π«Ά
Calling
pmDiscoverServices(service, mechanism, urls)
is equivalent to calling
__pmDiscoverServicesWithOptions(service, mechanism, NULL, NULL, urls);
service specifies the PCP service to be discovered. Currently supported services are PM_SERVER_SERVICE_SPEC and PM_SERVER_PROXY_SPEC, which search for pmcd(1) and pmproxy(1) servers respectively π
mechanism specifies the style of discovery to be used.
The currently supported mechanisms are:
probe=<net-address>/<mask-bits>β 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/24defines an 8 bit subnet consisting of the addresses192.168.1.0through192.168.1.255. You can add an optional suffix",maxThreads=N"to limit the number of threads used while probing. The default is the value of__FD_SETSIZE(which is typically1024) or the number of addresses in the subnet, whichever is less. You can also add an optional suffix",timeout=N"to specify the timeout for each connection attempt, in floating-point multiples of one second. The default is0.02seconds (20 milliseconds) β±οΈshellβ Probes the list of addresses provided by scripts for the requested PCP service(s) π Several optional, comma-separated parameters can also be provided. First up, the"path=DIR"option specifies the directory where commands likepcp-kube-pods(1)are located (defaults to$PCP_BINADM_DIR/discover/). You can further restrict this to an individual command with thecommand=CMDoption, but the default is to use all available commands from the path. The"maxThreads=N"option limits the number of threads used while probing. The default is the value of__FD_SETSIZE(which is typically1024) or the number of addresses returned by the scripts, whichever is less. The"timeout=N"option may be added to limit how long you spend waiting for each connection attempt.Nis a floating point number specifying the number of seconds to wait. The default is0.02seconds (20 milliseconds) β±οΈ
mechanism may also be NULL, which means to use all available discovery mechanisms π
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:
resolveβ Requests that DNS name resolution be attempted for the addresses of any discovered services πtimeout=Nβ Specifies a timeout period after which the discovery process will be interrupted.Nis a floating point number representing the number of seconds before timing out β°
optionsString may also be NULL, which means no global options are specified.
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:
PM_SERVICE_DISCOVERY_RESOLVEβ Specifying this flag is equivalent to specifyingresolvein theoptionsStringβ¨PM_SERVICE_DISCOVERY_INTERRUPTEDβ 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, or 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,urlsis undefined (no space will have been allocated, and so callingfree(3)is a singularly bad idea) π do NOT do it bestie.
π± PCP ENVIRONMENT π±
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) function π§
π₯ DIAGNOSTICS π₯
-EINVALβ An invalid argument has been specified π-ENOMEMβ Unable to allocate memory required to process the request π-EOPNOTSUPPβ The specifiedmechanismis not supported π«
π¦ SEE ALSO π¦
pmcd(1), pmfind(1), pmproxy(1), pcp-kube-pods(1), PMAPI(3), pmGetConfig(3), pcp.conf(5), and pcp.env(5).
and that's the whole thing, periodt π
this page came to you from Performance Co-Pilot (that's the PCP crew π) and the date/version line at the bottom is PMDISCOVERSERVICES(3) β stan a manpage that eats every single time πβ¨π
π¦ where this page comes from
- arch rolling: pcp 7.2.2-2 Β· GPL-2.0-or-later AND LGPL-2.1-or-later AND CC-BY-3.0
- centos-stream 10: pcp-doc 7.1.5-6.el10 Β· GPL-2.0-or-later AND CC-BY-3.0
- fedora 43: pcp-doc 7.2.1-1.fc43
- fedora 43: pcp-doc 7.2.2-1.fc43
- fedora 43: pcp-doc 7.2.2-2.fc43 Β· GPL-2.0-or-later AND CC-BY-3.0
- fedora 44: pcp-doc 7.2.1-1.fc44
- fedora 44: pcp-doc 7.2.2-1.fc44
- fedora 44: pcp-doc 7.2.2-2.fc44 Β· GPL-2.0-or-later AND CC-BY-3.0
- ubuntu resolute: libpcp4-dev 7.1.1-1
- ubuntu stonking: libpcp4-dev 7.2.1-2build1
- Copyright (c) 2014 Red Hat
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms