Skip to main content

CI Release Version

Python library for building InfraSonar Agents

This library is created for building InfraSonar agents.

Installation

pip install pylibagent

Environment variables

Variable Default Description
TOKEN required Token to connect to.
ASSET_ID required Asset Id or file location where the Agent asset Id is stored (e.g 123 or /var/infrasonar/asset_id.json).
API_URI https://api.infrasonar.com InfraSonar API.
VERIFY_SSL 1 Verify SSL certificate, 0 (=disabled) or 1 (=enabled).
LOG_LEVEL warning Log level (error, warning, info, debug).
LOG_COLORIZED 0 Log colorized, 0 (=disabled) or 1 (=enabled).
LOG_FMT %y%m... Default format is %y%m%d %H:%M:%S.
DISABLED_CHECKS_CACHE_AGE 900 Time in seconds before we poll again for reading the disabled checks.

Usage (Demonized agent)

Building an InfraSonar demonized agent.

from pylibagent.agent import Agent
from pylibagent.check import CheckBase

__version__ = "0.1.0"


class SampleCheck(CheckBase):

    key = "sample"
    interval = 300

    @classmethod
    async def run(cls):
        return {
            "type": [
                {
                    "name": "item",
                    "metric": 123
                }
            ]
        }


if __name__ == "__main__":
    collector_key = "sample"
    version = "0.1.0"
    checks = [SampleCheck]

    Agent(collector_key, version).start(checks)

Usage (Non-demonized agent)

Building an InfraSonar agent.

import asyncio
from pylibagent.agent import Agent

__version__ = "0.1.0"


async def main():
    version = "0.1.0"
    collector_key = "sample"
    check_key = "sample"

    agent = Agent(collector_key, version)
    await agent.announce()  # optionally, we can provide an initial asset name
    await agent.send_data(check_key, {
        "type": [
            {
                "name": "item",
                "metric": 123
            }
        ]
    })


if __name__ == "__main__":
    asyncio.run(main())

Metadata

Release files for pylibagent 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pylibagent 1.0.2
File Size Uploaded
pylibagent-1.0.2.tar.gz 23.2 kB Details

Release files / pylibagent-1.0.2.tar.gz

Download URL pylibagent-1.0.2.tar.gz
Size 23.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d96d651e92ce5db85744d5363206bfb665908caffee5f13b12650a9fec6d715c
BLAKE2b-256 checksum
How to use checksums
6560f0f575e9610d6d10e44f1bb3f7d328891c4c9b7b348a3444a9ffb3eb0f77
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Release history Release notifications | RSS feed

This release

1.0.2 This release

1 release file

1.0.1

1 release file

1.0.0

1 release file

0.3.1

1 release file

0.3.0

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.9

1 release file

0.1.8

1 release file

0.1.7

1 release file

0.1.6

1 release file

0.1.5

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page