atoparser


Nameatoparser JSON
Version 3.3.0 PyPI version JSON
download
home_pageNone
SummaryUtilities for reading Atop files natively in Python
upload_time2024-09-21 14:03:12
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.11.


## 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, 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:  
```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/1d/54/fb6d10d1b23be09c15f1d41394448f50f5d029d8df29d4b665d69c374073/atoparser-3.3.0.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.11.\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, tstats, cgroups 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.3.0",
    "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": "a481aa024cdb61cb87d70b574f5ed9549669150a1dc2a60c09811dffacc532f4",
                "md5": "cdf49f21eb2cbcb59166b4f09e99e174",
                "sha256": "ff8af43742f4cce824ae74f6d7df99fb50ce298557cdd1bdd5f203218e874ce3"
            },
            "downloads": -1,
            "filename": "atoparser-3.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "cdf49f21eb2cbcb59166b4f09e99e174",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 40931,
            "upload_time": "2024-09-21T14:03:11",
            "upload_time_iso_8601": "2024-09-21T14:03:11.063965Z",
            "url": "https://files.pythonhosted.org/packages/a4/81/aa024cdb61cb87d70b574f5ed9549669150a1dc2a60c09811dffacc532f4/atoparser-3.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1d54fb6d10d1b23be09c15f1d41394448f50f5d029d8df29d4b665d69c374073",
                "md5": "bc24f9eba951d9801369bcfe834035a9",
                "sha256": "80750c28ed2de4b86d8a97a7b870125fbabca0dd75c4db7967336e47aa404d4a"
            },
            "downloads": -1,
            "filename": "atoparser-3.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "bc24f9eba951d9801369bcfe834035a9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 25222,
            "upload_time": "2024-09-21T14:03:12",
            "upload_time_iso_8601": "2024-09-21T14:03:12.065601Z",
            "url": "https://files.pythonhosted.org/packages/1d/54/fb6d10d1b23be09c15f1d41394448f50f5d029d8df29d4b665d69c374073/atoparser-3.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-21 14:03:12",
    "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.33544s