cockpit-project / cockpit

Cockpit is a web-based graphical interface for servers.
http://www.cockpit-project.org/
GNU Lesser General Public License v2.1
11k stars 1.1k forks source link

Add pcp metrics using `python3-pcp` #19036

Open allisonkarlitskaya opened 1 year ago

allisonkarlitskaya commented 1 year ago

So this is a thing:

https://github.com/performancecopilot/pcp/blob/main/src/python/pcp/pmapi.py

And it's available as the python3-pcp package, at least on Fedora and Debian.

And even if it wasn't available, the fact that it's based on ctypes means that we could theoretically just dist it as part of the beipack.

We knew that we'd need to get the user to install PCP anyway in order to enable the metrics history. If they're using the python bridge then we should just make sure to install python3-pcp.

Because this is Python we can do the import conditionally, meaning we don't even need a separate process for this anymore.

(We might consider a separate process still, though, if the rumours about the client library crashing are true...)

jelly commented 1 year ago

On Arch Linux it's available as part of the pcp package (not a split package):

>>> import pcp
>>> pcp.__file__
'/usr/lib/python3.11/site-packages/pcp/__init__.py'