User Tools

Site Tools


Sidebar

software:performance_co-pilot:openmetrics

Openmetrics example

How to get simple own textfiles into metrics?

dnf -y install pcp-pmda-openmetrics
cd /var/lib/pcp/pmdas/openmetrics && ./Install

### example 1, via URL
echo 'file:///tmp/vars' >config.d/myvars.url
cat >/tmp/vars<<EOT
# HELP my simple test value
# Type testval gauge
var 12.3
EOT

### example 2, via executable
cat >config.d/system.sh<<EOT
#! /bin/sh
          awk '{
              print("# HELP loadavg local load average")
              print("# Type loadavg gauge")
              printf("loadavg {interval=\"1-minute\"} %.2f\n", $1)
              printf("loadavg {interval=\"5-minute\"} %.2f\n", $2)
              printf("loadavg {interval=\"15-minute\"} %.2f\n", $3)
          }' /proc/loadavg
EOT
chmod +x config.d/system.sh

### example 3, via executable
cat >config.d/system2.sh<<EOT
#!/bin/sh
cat /proc/meminfo |sed -e 's,:,,' -e 's, kB,,' -e 's, ,"},' -e 's,^,var {interval=",'
EOT

# as last part in /var/lib/pcp/config/pmlogger/config.default
log advisory on every 1 second {
	openmetrics
}
systemctl restart pmlogger
pminfo openmetrics
pmrep openmetrics
software/performance_co-pilot/openmetrics.txt ยท Last modified: 2021/06/16 14:04 by chris