Skip to content

Quick start

1. Install

pip install atonix

2. Get credentials

You need two things from your Prometheus APM tenant:

  • an API key
  • the matching RSA private key in PEM format

3. Set environment variables

export ATONIX_API_KEY="your-api-key"
export ATONIX_PRIVATE_KEY_PATH="/path/to/private_key.pem"
export ATONIX_PRIVATE_KEY_PASSWORD="your-password"  # only if the key is encrypted
$env:ATONIX_API_KEY = "your-api-key"
$env:ATONIX_PRIVATE_KEY_PATH = "C:\path\to\private_key.pem"
$env:ATONIX_PRIVATE_KEY_PASSWORD = "your-password"  # only if the key is encrypted

You can also pass credentials straight to the client. Authentication covers every option.

4. Make a request

from atonix import AtonixClient

with AtonixClient() as client:
    for asset in client.assets.get_top():
        print(asset.abbrev, asset.id)
import asyncio

from atonix import AsyncAtonixClient


async def main():
    async with AsyncAtonixClient() as client:
        async for asset in client.assets.get_top():
            print(asset.abbrev, asset.id)


asyncio.run(main())

Using the client as a context manager closes its HTTP connections when you're done. Outside a with block, call client.close() (or await client.aclose() for async).

What the client gives you

The client has one attribute per API area:

Attribute Sync class Async class Covers
client.assets Assets AsyncAssets Asset hierarchy and details
client.issues Issues AsyncIssues Issues, keywords, discussion entries
client.models Models AsyncModels Model configuration, alert state, actions
client.process_data ProcessData AsyncProcessData Servers, tags, time-series reads/writes

Next, read Sync or async? to pick a client, or jump to the user guide for examples.