atoparser


Nameatoparser JSON
Version 3.1.1 PyPI version JSON
download
home_pageNone
SummaryUtilities for reading Atop files natively in Python
upload_time2024-03-31 17:07:46
maintainerNone
docs_urlNone
authorDavid Fritz
requires_python>=3.10
licenseMIT
keywords monitoring analysis diagnostics utilization atop
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
[![os: linux](https://img.shields.io/badge/os-linux-blue)](https://docs.python.org/3.10/)
[![python: 3.10+](https://img.shields.io/badge/python-3.10_|_3.11-blue)](https://devguide.python.org/versions)
[![python style: google](https://img.shields.io/badge/python%20style-google-blue)](https://google.github.io/styleguide/pyguide.html)
[![imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://github.com/PyCQA/isort)
[![code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![code style: pycodestyle](https://img.shields.io/badge/code%20style-pycodestyle-green)](https://github.com/PyCQA/pycodestyle)
[![doc style: pydocstyle](https://img.shields.io/badge/doc%20style-pydocstyle-green)](https://github.com/PyCQA/pydocstyle)
[![static typing: mypy](https://img.shields.io/badge/static_typing-mypy-green)](https://github.com/python/mypy)
[![linting: pylint](https://img.shields.io/badge/linting-pylint-yellowgreen)](https://github.com/PyCQA/pylint)
[![testing: pytest](https://img.shields.io/badge/testing-pytest-yellowgreen)](https://github.com/pytest-dev/pytest)
[![security: bandit](https://img.shields.io/badge/security-bandit-black)](https://github.com/PyCQA/bandit)
[![license: MIT](https://img.shields.io/badge/license-MIT-lightgrey)](LICENSE)


# 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](https://www.atoptool.nl/)


## Table Of Contents

  * [Compatibility](#compatibility)
  * [Getting Started](#getting-started)
    * [Installation](#installation)
  * [How Tos](#how-tos)
    * [Read an Atop log with the example JSON command](#read-an-atop-log-with-the-example-json-command)
    * [Iterate over the C structs as Python objects](#iterate-over-the-c-structs-as-python-objects)
    * [Convert the C structs into JSON compatible objects](#convert-the-c-structs-into-json-compatible-objects)
    * [Contribute](#contribute)
    * [Advanced Guides](#advanced-guides)


## Compatibility

- Supports Python 3.10+
- Supports Atop 1.26 and 2.3 through 2.10.


## Getting Started

### Installation

Install Atoparser via pip:
```shell
pip install atoparser
```

Or via git clone:
```shell
git clone <path to fork>
cd atoparser
pip install .
```

Or build and install from wheel:
```shell
# 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:
```shell
atoparser ~/atop.log -P CPU --pretty
```

### Iterate over the C structs as Python objects:  
```python
import atoparser

with open(file, 'rb') as raw_file:
    header = atoparser.get_header(raw_file)
    for record, sstat, tstat 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:  
```python
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](CONTRIBUTING.md) for information on how to contribute to this project.

### Advanced Guides

Refer to [Advanced How Tos](docs/HOW_TO.md) for more advanced topics, such as adding a new Atop version.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "atoparser",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "monitoring, analysis, diagnostics, utilization, atop",
    "author": "David Fritz",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/79/35/0e0bc97634f18d7a15b88fa16171e406c7779715f4a7e0571bf2f10493f3/atoparser-3.1.1.tar.gz",
    "platform": "Linux",
    "description": "\n[![os: linux](https://img.shields.io/badge/os-linux-blue)](https://docs.python.org/3.10/)\n[![python: 3.10+](https://img.shields.io/badge/python-3.10_|_3.11-blue)](https://devguide.python.org/versions)\n[![python style: google](https://img.shields.io/badge/python%20style-google-blue)](https://google.github.io/styleguide/pyguide.html)\n[![imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://github.com/PyCQA/isort)\n[![code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![code style: pycodestyle](https://img.shields.io/badge/code%20style-pycodestyle-green)](https://github.com/PyCQA/pycodestyle)\n[![doc style: pydocstyle](https://img.shields.io/badge/doc%20style-pydocstyle-green)](https://github.com/PyCQA/pydocstyle)\n[![static typing: mypy](https://img.shields.io/badge/static_typing-mypy-green)](https://github.com/python/mypy)\n[![linting: pylint](https://img.shields.io/badge/linting-pylint-yellowgreen)](https://github.com/PyCQA/pylint)\n[![testing: pytest](https://img.shields.io/badge/testing-pytest-yellowgreen)](https://github.com/pytest-dev/pytest)\n[![security: bandit](https://img.shields.io/badge/security-bandit-black)](https://github.com/PyCQA/bandit)\n[![license: MIT](https://img.shields.io/badge/license-MIT-lightgrey)](LICENSE)\n\n\n# Atoparser\n\nAtoparser is a zero dependency Atop log processing library written in Python. The library supports reading binary C data\ndirectly from compressed or uncompressed Atop log files, without the need to install Atop or call a subprocess.\nThe converted data contains structured Python objects, that can then be used for JSON, CSV, or other types of output,\nstorage, and analysis.\n\nFor full information on the amazing performance monitoring software that creates these files, known as \"Atop\", refer to:  \n[Atop - The one stop shop for all your tops](https://www.atoptool.nl/)\n\n\n## Table Of Contents\n\n  * [Compatibility](#compatibility)\n  * [Getting Started](#getting-started)\n    * [Installation](#installation)\n  * [How Tos](#how-tos)\n    * [Read an Atop log with the example JSON command](#read-an-atop-log-with-the-example-json-command)\n    * [Iterate over the C structs as Python objects](#iterate-over-the-c-structs-as-python-objects)\n    * [Convert the C structs into JSON compatible objects](#convert-the-c-structs-into-json-compatible-objects)\n    * [Contribute](#contribute)\n    * [Advanced Guides](#advanced-guides)\n\n\n## Compatibility\n\n- Supports Python 3.10+\n- Supports Atop 1.26 and 2.3 through 2.10.\n\n\n## Getting Started\n\n### Installation\n\nInstall Atoparser via pip:\n```shell\npip install atoparser\n```\n\nOr via git clone:\n```shell\ngit clone <path to fork>\ncd atoparser\npip install .\n```\n\nOr build and install from wheel:\n```shell\n# Build locally.\ngit clone <path to fork>\ncd atoparser\nmake wheel\n\n# Push dist/atoparser*.tar.gz to environment where it will be installed.\npip install dist/atoparser*.tar.gz\n```\n\n\n## How Tos\n\n### Read an Atop log with the example JSON command:\n```shell\natoparser ~/atop.log -P CPU --pretty\n```\n\n### Iterate over the C structs as Python objects:  \n```python\nimport atoparser\n\nwith open(file, 'rb') as raw_file:\n    header = atoparser.get_header(raw_file)\n    for record, sstat, tstat in atoparser.generate_statistics(raw_file, header):\n        total_cycles = record.interval * sstat.cpu.nrcpu * header.hertz\n        usage = 1 - sstat.cpu.all.itime / total_cycles\n        print(f'CPU usage was {usage:.02%}')\n```\n\n### Convert the C structs into JSON compatible objects:  \n```python\nimport json\nimport atoparser\n\nwith open(file, 'rb') as raw_file:\n    header = atoparser.get_header(raw_file)\n    print(json.dumps(atoparser.struct_to_dict(header), indent=2))\n```\n\n### Contribute\n\nRefer to the [Contributing Guide](CONTRIBUTING.md) for information on how to contribute to this project.\n\n### Advanced Guides\n\nRefer to [Advanced How Tos](docs/HOW_TO.md) for more advanced topics, such as adding a new Atop version.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Utilities for reading Atop files natively in Python",
    "version": "3.1.1",
    "project_urls": {
        "Changelog": "https://github.com/pyranha-labs/atoparser/releases",
        "Home": "https://github.com/pyranha-labs/atoparser",
        "Issues": "https://github.com/pyranha-labs/atoparser/issues"
    },
    "split_keywords": [
        "monitoring",
        " analysis",
        " diagnostics",
        " utilization",
        " atop"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "baa9e0bfb358c1e8843811f81aa3bc255462079ff697ec9a50be38555c6671f1",
                "md5": "4921af5b7f1d6fed09a0e9895a2b5700",
                "sha256": "1045ed1d2c0c957b693cd825a67c590616cd47e114a3c592cb0208307e5f50c3"
            },
            "downloads": -1,
            "filename": "atoparser-3.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4921af5b7f1d6fed09a0e9895a2b5700",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 37497,
            "upload_time": "2024-03-31T17:07:45",
            "upload_time_iso_8601": "2024-03-31T17:07:45.103831Z",
            "url": "https://files.pythonhosted.org/packages/ba/a9/e0bfb358c1e8843811f81aa3bc255462079ff697ec9a50be38555c6671f1/atoparser-3.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "79350e0bc97634f18d7a15b88fa16171e406c7779715f4a7e0571bf2f10493f3",
                "md5": "db1a591da62ca4042401f9101d56c131",
                "sha256": "f24bd340fcd331b9aa9d7111754ea9543a829ba5fcd5b4b16700c57980ae6f76"
            },
            "downloads": -1,
            "filename": "atoparser-3.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "db1a591da62ca4042401f9101d56c131",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 22898,
            "upload_time": "2024-03-31T17:07:46",
            "upload_time_iso_8601": "2024-03-31T17:07:46.758403Z",
            "url": "https://files.pythonhosted.org/packages/79/35/0e0bc97634f18d7a15b88fa16171e406c7779715f4a7e0571bf2f10493f3/atoparser-3.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-31 17:07:46",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pyranha-labs",
    "github_project": "atoparser",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "atoparser"
}
        
Elapsed time: 0.23037s