Chapter 5. Configuring pmda-openmetrics
Performance Co-Pilot (PCP) is a flexible and extensible system for monitoring and managing system performance. It includes several built-in agents called Performance Metric Domain Agents (PMDAs) that collect metrics from commonly used applications and services, such as PostgreSQL, Apache HTTPD, and KVM virtual machines.
5.1. Overview of pmda-openmetrics
You can run custom or less common applications for which no out-of-the-box PMDA exists in the Red Hat repositories. In such scenarios, the pmda-openmetrics
agent helps to bridge the gap. The pmda-openmetrics
PMDA exposes performance metrics from arbitrary applications by converting OpenMetrics-style formatted text files into PCP-compatible metrics. OpenMetrics is a widely adopted format used by Prometheus and other monitoring tools, which makes integration easier.
You can run pmda-openmetrics
to do the following tasks:
- Monitor custom applications that are not covered by existing PMDAs.
-
Integrate existing OpenMetrics or
Prometheus-exported
metrics into the PCP framework. - Create quick models or test metrics for diagnostic or demonstration purposes.
5.2. Installing and configuring pmda-openmetrics
You must install and configure pmda-openmetrics
before you start using it. The following example demonstrates how to expose a single numeric value from a text file as a PCP metric by using pmda-openmetrics
.
Prerequisites
-
PCP is installed and
pmcd
is running. For more information, see installing pcp-zeroconf.
Procedure
Install the
pmda-openmetrics
PMDA.dnf -y install pcp-pmda-openmetrics cd /var/lib/pcp/pmdas/openmetrics/ ./Install
# dnf -y install pcp-pmda-openmetrics # cd /var/lib/pcp/pmdas/openmetrics/ # ./Install
Copy to Clipboard Copied! Create a sample OpenMetrics file.
echo 'var1 {var2="var3"} 42' > /tmp/example.txt
# echo 'var1 {var2="var3"} 42' > /tmp/example.txt
Copy to Clipboard Copied! Replace example.txt with the desired file name.
Verify that the file is created correctly.
cat /tmp/example.txt
# cat /tmp/example.txt
Copy to Clipboard Copied! Register the metric file path with the OpenMetrics agent.
echo "file:///tmp/example.txt" > /etc/pcp/openmetrics/example.url
# echo "file:///tmp/example.txt" > /etc/pcp/openmetrics/example.url
Copy to Clipboard Copied! Verify that the configuration is created correctly.
cat /etc/pcp/openmetrics/example.url
# cat /etc/pcp/openmetrics/example.url
Copy to Clipboard Copied! Configure
systemd-tmpfiles
to create the necessary symlinks.echo 'L+ /var/lib/pcp/pmdas/openmetrics/config.d/example.url - - - - ../../../../../../etc/pcp/openmetrics/example.url' \ > /usr/lib/tmpfiles.d/pcp-pmda-openmetrics-cust.conf
# echo 'L+ /var/lib/pcp/pmdas/openmetrics/config.d/example.url - - - - ../../../../../../etc/pcp/openmetrics/example.url' \ > /usr/lib/tmpfiles.d/pcp-pmda-openmetrics-cust.conf
Copy to Clipboard Copied! Verify that the symlinks are configured correctly.
cat /usr/lib/tmpfiles.d/pcp-pmda-openmetrics-cust.conf
# cat /usr/lib/tmpfiles.d/pcp-pmda-openmetrics-cust.conf
Copy to Clipboard Copied! Create the symlinks by applying the tmpfiles configuration.
systemd-tmpfiles --create --remove /usr/lib/tmpfiles.d/pcp-pmda-openmetrics-cust.conf
# systemd-tmpfiles --create --remove /usr/lib/tmpfiles.d/pcp-pmda-openmetrics-cust.conf
Copy to Clipboard Copied! Verify that the symlinks are created correctly.
ls -al /var/lib/pcp/pmdas/openmetrics/config.d/
# ls -al /var/lib/pcp/pmdas/openmetrics/config.d/
Copy to Clipboard Copied! Verify that the metric is correctly reported.
pminfo -f openmetrics.example.var1
# pminfo -f openmetrics.example.var1 inst [0 or "0 var2:var3"] value 42
Copy to Clipboard Copied!
Verification
-
Run
pcp
and confirm thatopenmetrics
is listed. -
Run
systemd-analyze cat-config tmpfiles.d
and confirm thatexample.url
appears in the output. -
Use
pminfo
to confirm the presence and value of the metric.