---
name: "pmiPutLabel"
section: "3"
platform: "linux"
package: "pcp"
version: "7.2.2-2"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/pmiPutLabel"
---

# pmiPutLabel(3)

add labels to the output archive

## NAME

**pmiPutLabel** - add labels to the output archive

## C SYNOPSIS

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

**int pmiPutLabel(unsigned int** *type***,** **unsigned int** *id***,** **unsigned int** *instance***,** **const char \****name***,** **const char \****value***);**

**cc ... -lpcp\_import -lpcp**

## Perl SYNOPSIS

**use PCP::LogImport;**

**pmiPutLabel($***type***,** **$***id***,** **$***instance***,** **$***name***,** **$***value***);**

## Python SYNOPSIS

**from pcp import pmi**

**log.pmiPutLabel(***type***,** *id***,** *instance***,** *name***,** *value***)**

## DESCRIPTION

As part of the Performance Co-Pilot Log Import API (see [**LOGIMPORT**(3)](/LOGIMPORT/3.md)), **pmiPutLabel** adds a label for the global context or for a given domain, cluster, item, instance domain or instance.

The *type* must be one of **PM\_LABEL\_CONTEXT,** **PM\_LABEL\_DOMAIN,** **PM\_LABEL\_CLUSTER,** **PM\_LABEL\_ITEM,** **PM\_LABEL\_INDOM,** or **PM\_LABEL\_INSTANCES**.

If *type* is **PM\_LABEL\_CONTEXT**, then *id* and *instance* are ignored. Otherwise, *id* should match a domain, cluster, metric or instance domain defined earlier in a call to [**pmiAddMetric**(3)](/pmiAddMetric/3.md).

If *type* is **PM\_LABEL\_INSTANCES**, then *instance* should match an instance number of the selected domain. Otherwise *instance* is ignored.

*name* is a string containing the name of the label to be added.

*value* is a string containing the value of the label to be added.

No data will be written until [**pmiWrite**(3)](/pmiWrite/3.md) is called, so multiple calls to **pmiPutLabel** are typically used to accumulate several labels before calling [**pmiWrite**(3)](/pmiWrite/3.md).

## DIAGNOSTICS

**pmiPutLabel** returns zero on success else a negative value that can be turned into an error message by calling [**pmiErrStr**(3)](/pmiErrStr/3.md).

## SEE ALSO

[**LOGIMPORT**(3)](/LOGIMPORT/3.md), [**pmiAddInstance**(3)](/pmiAddInstance/3.md), [**pmiAddMetric**(3)](/pmiAddMetric/3.md), [**pmiErrStr**(3)](/pmiErrStr/3.md), [**pmiPutResult**(3)](/pmiPutResult/3.md), [**pmiPutValue**(3)](/pmiPutValue/3.md), [**pmiPutValueHandle**(3)](/pmiPutValueHandle/3.md), [**pmiPutText**(3)](/pmiPutText/3.md) and [**pmiWrite**(3)](/pmiWrite/3.md).
