pmisetimportprogram(3) — Linux manual page

NAME | C SYNOPSIS | DESCRIPTION | DIAGNOSTICS | FILES | SEE ALSO | COLOPHON

PMISETIMPORTPROGRAM(3)   Library Functions Manual  PMISETIMPORTPROGRAM(3)

NAME         top

       pmiSetImportProgram - register an import tool with pmdapmimport

C SYNOPSIS         top

       #include <pcp/pmapi.h>
       #include <pcp/import.h>

       int pmiSetImportProgram(const char *tool, const char *version,
       const char *args, const char *archive);

       cc ... -lpcp_import -lpcp

DESCRIPTION         top

       As   part   of  the  Performance  Co-Pilot  Log  Import  API  (see
       LOGIMPORT(3)), pmiSetImportProgram registers  the  running  import
       tool  with  pmdapmimport(1)  so that its status is visible through
       the pmimport.*  metric family.

       The function writes a sidecar  status  file  to  PCP_IMPORTRUN_DIR
       (typically  /run/pmimport) named after tool.  The file is a simple
       key=value text format containing a subset of the following fields:

       pid=   The process ID of the import tool, written only when the
              PMI_PROCESS flag was passed to pmiStart(3).  Long-running
              daemons should use this flag so that pmdapmimport(1) can
              detect and suppress stale entries left by an unclean exit.
              One-shot tools (e.g. those invoked periodically from a cron
              job) should omit the flag; their sidecar files persist be‐
              tween invocations and are always considered live.

       version=
              The version string supplied by the caller (skipped if NULL
              or empty).

       args=  The args string supplied by the caller (skipped if NULL or
              empty).  Typically a summary of the subsystems or data
              sources being imported, for display by pcp(1).

       archive=
              The archive base path supplied by the caller (skipped if
              NULL or empty).

       The sidecar file is removed automatically when pmiEnd(3) is
       called, so no explicit cleanup is required on a clean exit.

       pmiSetImportProgram should be called once after pmiStart(3) and
       before the first call to pmiWrite(3).  Calling it again with up‐
       dated arguments (e.g. after an archive rotation) is permitted and
       overwrites the existing sidecar file.

DIAGNOSTICS         top

       Returns zero on success.  PM_ERR_NOCONTEXT is returned if there is
       no current import context.  PM_ERR_CONV is returned if tool is
       NULL or empty.  Any error opening or writing the sidecar file
       causes the corresponding negated errno(3) value to be returned.

FILES         top

       $PCP_IMPORTRUN_DIR/<tool>
              Sidecar status file for the named import tool.

SEE ALSO         top

       LOGIMPORT(3), pcp(1), pmdapmimport(1), pmiEnd(3), pmiErrStr(3),
       pmiStart(3), pmiWrite(3) and pmiWriteNow(3).

COLOPHON         top

       This page is part of the PCP (Performance Co-Pilot) project.  In‐
       formation about the project can be found at ⟨http://www.pcp.io/⟩.
       If you have a bug report for this manual page, send it to
       pcp@groups.io.  This page was obtained from the project's upstream
       Git repository ⟨https://github.com/performancecopilot/pcp.git⟩ on
       2026-08-04.  (At that time, the date of the most recent commit
       that was found in the repository was 2026-08-04.)  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 to man-pages@man7.org

Performance Co-Pilot                               PMISETIMPORTPROGRAM(3)