cockpit
cockpit copied to clipboard
Cockpit pcp python
Rewrite cockpit-pcp as a Python bridge channel using the python3-pcp bindings:
ToDo's when picking this up:
- [ ] multi-instance support for meta message
- [ ] Test different metric types
- [ ] Test / support omit-instances
- [ ] Test receiving multiple metrics
- [ ] Test non-default interval
- [ ] Drop cockpit-pcp from
pkg/pcp/manifest.jsonand test the metrics page
The first version should support:
Source:
- pcp-archive or
/- this is the simplest case (used on metrics page) - direct - needs investigation
- pmcd - needs investigation*
For the metrics page we need to support multi-instanced instances and a limit, timestamp and setting interval options. Including omit-instances support for network.interface.total.bytes.
Comparing to the C implementation:
cpf open metrics1 source="/tmp/pytest-of-jelle/pytest-current/instances-archives0/" metrics='[{ "name": "kernel.all.load" }]' limit=1 : wait | G_MESSAGES_DEBUG=none /usr/lib/cockpit/cockpit-pcp | /usr/bin/cat
We also have some valid test archives in test/verify/files/metric-archives, untar them and you can then for example load them with:
[jelle@t14s][~/projects/cockpit/cockpit-pcp-python]%cpf open metrics1 source="/home/jelle/projects/cockpit/cockpit-pcp-python/var/log/pcp/pmlogger/localhost.localdomain/" metrics='[{ "name": "kernel.all.load" }]' limit=100 : wait | G_MESSAGES_DEBUG=none /usr/lib/cockpit/cockpit-pcp | /usr/bin/cat
36
{ "command": "init", "version": 1 }36
{"command":"ready","channel":"ch1"}154
ch1
{"timestamp":1597663539413,"now":1713453024135,"interval":1000,"metrics":[{"name":"kernel.all.load","instances":[],"units":"","semantics":"instant"}]}10
ch1
[[[]]]187
ch1
{"timestamp":1597663540413,"now":1713453024135,"interval":1000,"metrics":[{"name":"kernel.all.load","instances":["15 minute","1 minute","5 minute"],"units":"","semantics":"instant"}]}360
ch1
[[[0.019999999552965164,0.23999999463558197,0.05000000074505806]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]]]264
ch1
[[[]],[[0.05000000074505806,0.52999997138977051,0.15000000596046448]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]]]36
Tox is meh :( There is no pcp wheel so need to build it and the PyPi version is outdated 5.0 :disappointed: