Skip to content

macOS: enable openmetrics and opentelemetry PMDAs in PKG #2540

@tallpsmith

Description

@tallpsmith

Problem

The openmetrics and opentelemetry PMDAs are silently excluded from the macOS PKG build when python3 -c 'import requests' fails during ./configure. The configure check sets PMDA_OPENMETRICS=false and PMDA_OPENTELEMETRY=false, and their GNUmakefiles produce empty build targets — no warning, no error.

Even when they are built (as in the GitHub Actions CI which installs requests in a venv), the macOS postinstall script has no logic to activate them. On Linux, pcp-zeroconf's postinstall creates .NeedInstall marker files that tell pmcd to auto-install these PMDAs on first start. The macOS postinstall has no equivalent.

Depends on: #2539 (centralised Python deps ensure requests is available at build time)

Root Cause

  1. Build dependency: requests Python package not installed → PMDA_OPENMETRICS=false (silent)
  2. No post-install activation: build/mac/installer-resources/postinstall doesn't create .NeedInstall markers

How .NeedInstall works (existing platform-agnostic mechanism)

  1. Package postinstall touches /var/lib/pcp/pmdas/<name>/.NeedInstall
  2. When pmcd starts, rc_pmcd runs _pmda_setup() which scans for these markers
  3. Each PMDA's Install script runs, adding it to pmcd.conf
  4. pmcd reloads and starts collecting from the new PMDA

This mechanism is already platform-agnostic — rc_pmcd works on macOS. It just never gets triggered because nobody creates the markers.

Linux precedent

Debian (pcp-zeroconf.postinst):

for PMDA in dm nfsclient openmetrics opentelemetry ; do
    if ! grep -q "$PMDA/pmda$PMDA" /etc/pcp/pmcd/pmcd.conf; then
        if test -d "/var/lib/pcp/pmdas/$PMDA"; then
            touch "/var/lib/pcp/pmdas/$PMDA/.NeedInstall"
        fi
    fi
done

RPM (pcp-zeroconf %post):

needinstall='dm'
needinstall="$needinstall nfsclient openmetrics opentelemetry"
for PMDA in $needinstall ; do
    if ! grep -q "$PMDA/pmda$PMDA" "$PCP_PMCDCONF_PATH"; then
        touch "$PCP_PMDAS_DIR/$PMDA/.NeedInstall"
    fi
done

Both use a curated list of PMDAs, not a directory scan.

Proposed Solution

Add .NeedInstall logic to build/mac/installer-resources/postinstall, placed before the launchctl kickstart for pmcd so markers exist when pmcd starts:

# Auto-enable optional PMDAs (mirrors pcp-zeroconf on Linux)
if [ -f /etc/pcp.conf ]; then
    . /etc/pcp.conf
    for PMDA in openmetrics opentelemetry ; do
        if ! grep -q "$PMDA/pmda$PMDA" "$PCP_PMCDCONF_PATH" 2>/dev/null; then
            if test -d "$PCP_PMDAS_DIR/$PMDA"; then
                touch "$PCP_PMDAS_DIR/$PMDA/.NeedInstall"
                echo "$prog: Queued $PMDA PMDA for installation" >> /var/log/pcp_inst.log
            fi
        fi
    done
fi

CI verification

Add steps to both .github/workflows/macOS.yml and .cirrus.yml after installation:

# Verify openmetrics PMDA is active after install
pminfo openmetrics 2>/dev/null && echo "openmetrics PMDA active" || echo "openmetrics PMDA not active"

Notes

  • libuv is already a required macOS build dependency (pmproxy needs it), so pmproxy's openmetrics.c/opentelemetry.c handlers should already be compiling.
  • The Linux pcp-zeroconf also enables dm and nfsclient — those could be added to the macOS list in a follow-up.
  • The openmetrics PMDA ships with default URL configs for Grafana, Ceph, etcd, vLLM, etc. These probe gracefully — they only activate if endpoints are reachable.

Metadata

Metadata

Assignees

Labels

macOSFor issues specific or related to macOS

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions