Skip to main content

NetBox Labs, Worker backend for Orb Agent

Project description

worker

Orb worker backend - allow running custom Backend implementations

Usage

usage: orb-worker [-h] [-V] [-s HOST] [-p PORT] -t DIODE_TARGET -k DIODE_API_KEY

Orb Worker Backend

options:
  -h, --help            show this help message and exit
  -V, --version         Display Orb Worker and Diode SDK versions
  -s HOST, --host HOST  Server host
  -p PORT, --port PORT  Server port
  -t DIODE_TARGET, --diode-target DIODE_TARGET
                        Diode target
  -k DIODE_API_KEY, --diode-api-key DIODE_API_KEY
                        Diode API key. Environment variables can be used by wrapping them in ${} (e.g.
                        ${MY_API_KEY})
  -a DIODE_APP_NAME_PREFIX, --diode-app-name-prefix DIODE_APP_NAME_PREFIX
                        Diode producer_app_name prefix

Policy RFC

policies:
  worker_policy:
    config:
      package: my_custom_package
      schedule: "* * * * *" #Cron expression
      custom_config: custom value
    scope:
      any_key: any_value

Run worker

worker can be run by installing it with pip

git clone https://github.com/netboxlabs/orb-discovery.git
cd orb-discovery/
pip install --no-cache-dir ./worker/
orb-worker -t 'grpc://192.168.0.10:8080/diode' -k '${DIODE_API_KEY}'

Docker Image

worker can be build and run using docker:

cd worker
docker build --no-cache -t worker:develop -f docker/Dockerfile .
docker run  -e DIODE_API_KEY={YOUR_API_KEY} -p 8071:8071 worker:develop \
 orb-worker -t 'grpc://192.168.0.10:8080/diode' -k '${DIODE_API_KEY}'

Routes (v1)

Get runtime and capabilities information

GET /api/v1/status (gets worker runtime data)
Parameters

None

Responses
http code content-type response
200 application/json; charset=utf-8 {"version": "0.1.0","up_time_seconds": 3678 }
Example cURL
 curl -X GET -H "Content-Type: application/json" http://localhost:8071/api/v1/status
GET /api/v1/capabilities (gets worker capabilities)
Parameters

None

Responses
http code content-type response
200 application/json; charset=utf-8 {"loaded_modules":["custom_nbl","generic_worker"]}
Example cURL
 curl -X GET -H "Content-Type: application/json" http://localhost:8071/api/v1/capabilities

Policies Management

POST /api/v1/policies (Creates a new policy)
Parameters
name type data type description
None required YAML object yaml format specified in Policy RFC
Responses
http code content-type response
201 application/json; charset=UTF-8 {"detail":"policy 'policy_name' was started"}
400 application/json; charset=UTF-8 { "detail": "invalid Content-Type. Only 'application/x-yaml' is supported" }
400 application/json; charset=UTF-8 Any other policy error
403 application/json; charset=UTF-8 { "detail": "config field is required" }
409 application/json; charset=UTF-8 { "detail": "policy 'policy_name' already exists" }
Example cURL
 curl -X POST -H "Content-Type: application/x-yaml" --data-binary @policy.yaml http://localhost:8071/api/v1/policies
DELETE /api/v1/policies/{policy_name} (delete a existing policy)
Parameters
name type data type description
policy_name required string The unique policy name
Responses
http code content-type response
200 application/json; charset=UTF-8 { "detail": "policy 'policy_name' was deleted" }
400 application/json; charset=UTF-8 Any other policy deletion error
404 application/json; charset=UTF-8 { "detail": "policy 'policy_name' not found" }
Example cURL
 curl -X DELETE http://localhost:8071/api/v1/policies/policy_name

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

netboxlabs_orb_worker-0.1.1.tar.gz (11.7 kB view details)

Uploaded Source

File details

Details for the file netboxlabs_orb_worker-0.1.1.tar.gz.

File metadata

  • Download URL: netboxlabs_orb_worker-0.1.1.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for netboxlabs_orb_worker-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9ab958e6b5a4ee100f3542a34e26c54a8b09fb9db942d13de19e3b875b19676f
MD5 804a33edbcfee67547606bdbf71d8ce9
BLAKE2b-256 1c3b110fab1b92c1dbf878a27c450f5b0a661db15febc1f15ce4a2cc084d4c50

See more details on using hashes here.

Provenance

The following attestation bundles were made for netboxlabs_orb_worker-0.1.1.tar.gz:

Publisher: worker-release.yaml on netboxlabs/orb-discovery

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page