PMDACONNECT(3)
β¨ NAME β¨
pmdaConnect β the lil function that gets your daemon PMDA and PMCD talking to each other π like setting up the group chat between your agent and the main character (pmcd).
π«Ά C SYNOPSIS π«Ά
#include <pcp/pmapi.h>
#include <pcp/pmda.h>
void pmdaConnect(pmdaInterface *dispatch);
cc ... -lpcp_pmda -lpcp
πΈ DESCRIPTION πΈ
okay so bestie, pmdaConnect sets up the whole IPC channel between a PMDA(3) and the pmcd(1) process on the local host. literally it's the moment they finally start texting. π
The type of connection you get depends entirely on the e_io field of the pmdaExt structure, and she has OPINIONS:
pmdaPipeβ usesstdin/stdoutto communicate; it just assumes this is a pipe thatpmcdcreated before thePMDA(3)was launched. no cap. π°pmdaInetβ assumespmcd(1)will establish a connection to an IPv4 internet domain socket set up by thePMDA(3). The name or number of the port has to be specified in thee_socknameore_portfields of thepmdaExtstructure, respectively. πpmdaIPv6β assumespmcd(1)will establish a connection to an IPv6 internet domain socket set up by thePMDA(3). And again: the name or number of the port must be specified in thee_socknameore_portfields of thepmdaExtstructure, respectively. slay, but v6 this time π¦pmdaUnixβ assumespmcd(1)will establish a connection to a unix domain socket set up by thePMDA(3). Here the port number must be specified in thee_portfield of thepmdaExtstructure. πpmdaUnknownβ this is the initial value ofe_io, and it defaults to usingstdin/stdout. the factory setting, the default fit, the vibe before you choose π
The relevant pmdaExt fields get initialized by pmdaDaemon(3) and set by pmdaGetOpt(3) or pmdaGetOptions(3), so honestly most PMDAs should not need to access or modify them at all. let the helpers do their thing π
Traditionally most PMDAs have called pmdaConnect after calls to pmdaDaemon(3), pmdaGetOptions(3) (or pmdaGetOpt(3)) and pmdaInit(3). cute, classic, works.
BUT β and this is the important part, don't scroll β if the PMDA requires significant processing at startup to identify the available metrics and/or instance domains before pmdaInit(3) can be called, then it risks timing out during the handshake protocol. And that handshake protocol starts as soon as pmcd(1) launches the PMDA and does not conclude until pmdaConnect is called. π so you're just standing there, not texting back, and pmcd is like ???
In this case, it is advisable to move the pmdaConnect call, so that it comes after the call to pmdaGetOptions(3) (or pmdaGetOpt(3)) and before the call to pmdaInit(3). reorder the timeline, main character move, periodt. π₯
β οΈ CAVEAT β οΈ
The PMDA must be using PMDA_INTERFACE_2 or later, as specified in the call to pmdaDaemon(3). no downgrades, no old interfaces, we don't do that here π
π DIAGNOSTICS π
pmdaConnect will log the type of connection made to pmcd(1) if the PMAPI(3) debugging option libpmda has been set in the global debugging specification, as described in pmSetDebug(3). so you can literally see the receipts π§Ύβ¨
If an error occurs that is unrecoverable, dispatch->status is set to a value less than 0, otherwise it is zero or positive. less than zero = bad vibes, go fix it π
π SEE ALSO π
pmcd(1), pipe(2), socket(2), PMAPI(3), PMDA(3), pmdaDaemon(3), pmdaGetOpt(3), pmdaGetOptions(3) and pmdaInit(3).
go read those too bestie, they're all in the same friend group π«Ά
that's the whole page, you ate it π
this was brought to you by Performance Co-Pilot / PCP, page PMDACONNECT(3) β k byeeee ππ
π¦ 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.0.1-1.fc43 Β· 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.1.0-6.fc44 Β· 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: libpcp-pmda3-dev 7.1.1-1
- ubuntu stonking: libpcp-pmda3-dev 7.2.1-2build1
- Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms