Python Elastic Agent client
Looking for the main Elastic Agent client (GoLang)?
This is a python implementation, and is a technical preview.
Using an example
Agent needs a binary to run. A simple executable shell script will do.
#!/bin/bash
PYTHON_PATH=/path/to/bin/python
PY_AGENT_CLIENT_PATH=/path/to/python-elastic-agent-client
$PYTHON_PATH $PY_AGENT_CLIENT_PATH/elastic_agent_client/examples/fake/component.py
Put those contents in a elastic-agent*/data/elastic-agent*/components/python-elastic-agent-client file, and
chmod 755 elastic-agent*/data/elastic-agent*/components/python-elastic-agent-client
You'll also need to create a specfile at elastic-agent*/data/elastic-agent*/components/python-elastic-agent-client.spec.yml
with the contents:
version: 2
inputs:
- name: fake-py
description: "Fake Py component input"
platforms: &platforms
- linux/amd64
- linux/arm64
- darwin/amd64
- darwin/arm64
- windows/amd64
- container/amd64
- container/arm64
outputs: &outputs
- elasticsearch
shippers: &shippers
- shipper
command: &command
restart_monitoring_period: 5s
maximum_restarts_per_period: 1
timeouts:
restart: 1s
args: []
Then use this input in your elastic-agent.yml with:
inputs:
- type: fake-py
id: fake-py
use_output: default
You can easily tail the logs by running:
sudo ./elastic-agent 2>&1 >/dev/null | jq '.message'
Developing
To get started, run:
make clean install
What's happening?
Protobuf
The proto definitions for Elastic Agent live in the GoLang implementation repo.
To avoid duplicate code, they are not checked in here.
Instead, when make generate runs, it will:
- download the raw
*.protofiles from the GoLang repo - use
grpc_tools.protocto generate python code from those specs - store that generated code in
elastic_agent_client/generated - post-process them a bit (grpc_tools generates python2 imports, instead of python3 🤷)
TODO List
- remove all inline TODOs
- write a blog
- one day...
- support "custom actions" to trigger a sync, test connection, etc
- capture diagnostic metrics. See suggested metrics
- add automation to re-generate+PR if source protos are changed. GH action on elastic-agent-client repo?
Metadata
Release files for elastic-agent-client 0.0.2
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 |
|---|---|---|---|---|
| elastic_agent_client-0.0.2.tar.gz | 36.8 kB | Without provenance | Details for elastic_agent_client-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| elastic_agent_client-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for elastic_agent_client-0.0.2-py3-none-any.whl |
Total release size: 87.0 kB
Release files / elastic_agent_client-0.0.2.tar.gz
| Download URL | elastic_agent_client-0.0.2.tar.gz |
|---|---|
| Size | 36.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c538b07246531f00fd9455d43d78a30aeec5bc3489fa974a1305a013f55abe62
|
|
BLAKE2b-256 checksum How to use checksums |
8d846729889d63d293ae1476c16a9e2a847e919c79ccdab066b2c62e421d4d64
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.16
|
Release files / elastic_agent_client-0.0.2-py3-none-any.whl
| Download URL | elastic_agent_client-0.0.2-py3-none-any.whl |
|---|---|
| Size | 50.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
362a7ad563d47779fe86baa2869801dae0c719e3cd28f284fabae96eb4419c07
|
|
BLAKE2b-256 checksum How to use checksums |
7d18e3144ddcc988c3f239d975d39ed8bc46a452077dba62eefa1f7e284d104b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.16
|
Security for elastic-agent-client 0.0.2
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.