Atoparser
Atoparser is a zero dependency Atop log processing library written in Python. The library supports reading binary C data directly from compressed or uncompressed Atop log files, without the need to install Atop or call a subprocess. The converted data contains structured Python objects, that can then be used for JSON, CSV, or other types of output, storage, and analysis.
For full information on the amazing performance monitoring software that creates these files, known as "Atop", refer to:
Atop - The one stop shop for all your tops
Table Of Contents
Compatibility
- Supports Python 3.10+
- Supports Atop 1.26 and 2.3 through 2.12.
Getting Started
Installation
Install Atoparser via pip:
pip install atoparser
Or via git clone:
git clone <path to fork>
cd atoparser
pip install .
Or build and install from wheel:
# Build locally.
git clone <path to fork>
cd atoparser
make wheel
# Push dist/atoparser*.tar.gz to environment where it will be installed.
pip install dist/atoparser*.tar.gz
How Tos
Read an Atop log with the example JSON command:
atoparser ~/atop.log -P CPU --pretty
Iterate over the C structs as Python objects:
import atoparser
with open(file, 'rb') as raw_file:
header = atoparser.get_header(raw_file)
for record, sstat, tstats, cgroups in atoparser.generate_statistics(raw_file, header):
total_cycles = record.interval * sstat.cpu.nrcpu * header.hertz
usage = 1 - sstat.cpu.all.itime / total_cycles
print(f'CPU usage was {usage:.02%}')
Convert the C structs into JSON compatible objects:
import json
import atoparser
with open(file, 'rb') as raw_file:
header = atoparser.get_header(raw_file)
print(json.dumps(atoparser.struct_to_dict(header), indent=2))
Contribute
Refer to the Contributing Guide for information on how to contribute to this project.
Advanced Guides
Refer to Advanced How Tos for more advanced topics, such as adding a new Atop version.
Metadata
Release files for atoparser 3.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| atoparser-3.3.1.tar.gz | 25.5 kB | Without provenance | Details for atoparser-3.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| atoparser-3.3.1-py3-none-any.whl | Python 3 | none | any | Details for atoparser-3.3.1-py3-none-any.whl |
Total release size: 68.1 kB
Release files / atoparser-3.3.1.tar.gz
| Download URL | atoparser-3.3.1.tar.gz |
|---|---|
| Size | 25.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4e79312cc034e96f76924e5abc74f448bb0b43d2a37dce191534175cc730f8af
|
|
BLAKE2b-256 checksum How to use checksums |
e5e3a9df7da0d329f6e76a04678043f9efdfa99048a37a2ffa45e097d68c211a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.11
|
Release files / atoparser-3.3.1-py3-none-any.whl
| Download URL | atoparser-3.3.1-py3-none-any.whl |
|---|---|
| Size | 42.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0bdd42d23158fb1a995013ae6a625d5268c77be22acdb22d9f8de7761a7a4fd1
|
|
BLAKE2b-256 checksum How to use checksums |
216c2d21b9aed79b20840febddfbf1b2d2016c5b981ea079316a5699b95921e4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.11
|
Security for atoparser 3.3.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.