worker
Orb worker backend - allow running custom Backend implementations
Usage
usage: orb-worker [-h] [-V] [-s HOST] [-p PORT] [-t DIODE_TARGET] [-c DIODE_CLIENT_ID] [-k DIODE_CLIENT_SECRET] [-a DIODE_APP_NAME_PREFIX] [-d]
[-o DRY_RUN_OUTPUT_DIR] [--otel-endpoint OTEL_ENDPOINT] [--otel-export-period OTEL_EXPORT_PERIOD]
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. Environment variable can be used by wrapping it in ${} (e.g. ${TARGET})
-c DIODE_CLIENT_ID, --diode-client-id DIODE_CLIENT_ID
Diode Client ID. Environment variable can be used by wrapping it in ${} (e.g. ${MY_CLIENT_ID})
-k DIODE_CLIENT_SECRET, --diode-client-secret DIODE_CLIENT_SECRET
Diode Client Secret. Environment variable can be used by wrapping it in ${} (e.g. ${MY_CLIENT_SECRET})
-a DIODE_APP_NAME_PREFIX, --diode-app-name-prefix DIODE_APP_NAME_PREFIX
Diode producer_app_name prefix
-d, --dry-run Run in dry-run mode, do not ingest data
-o DRY_RUN_OUTPUT_DIR, --dry-run-output-dir DRY_RUN_OUTPUT_DIR
Output dir for dry-run mode. Environment variable can be used by wrapping it in ${} (e.g. ${OUTPUT_DIR})
--otel-endpoint OTEL_ENDPOINT
OpenTelemetry exporter endpoint
--otel-export-period OTEL_EXPORT_PERIOD
Period in seconds between OpenTelemetry exports (default: 60)
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' -c '${DIODE_CLIENT_ID}' -k '${DIODE_CLIENT_SECRET}'
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_CLIENT_ID=${YOUR_CLIENT} -e DIODE_CLIENT_SECRET=${YOUR_SECRET} -p 8071:8071 worker:develop \
orb-worker -t 'grpc://192.168.0.10:8080/diode' -c '${DIODE_CLIENT_ID}' -k '${DIODE_CLIENT_SECRET}'
Routes (v1)
Get runtime and capabilities information
GET /api/v1/status (gets worker runtime data)
Parameters
None
Responses
http code content-type response 200application/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 200application/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 201application/json; charset=UTF-8{"detail":"policy 'policy_name' was started"}400application/json; charset=UTF-8{ "detail": "invalid Content-Type. Only 'application/x-yaml' is supported" }400application/json; charset=UTF-8Any other policy error 403application/json; charset=UTF-8{ "detail": "config field is required" }409application/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_namerequired string The unique policy name
Responses
http code content-type response 200application/json; charset=UTF-8{ "detail": "policy 'policy_name' was deleted" }400application/json; charset=UTF-8Any other policy deletion error 404application/json; charset=UTF-8{ "detail": "policy 'policy_name' not found" }
Example cURL
curl -X DELETE http://localhost:8071/api/v1/policies/policy_name
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file netboxlabs_orb_worker-1.16.0.tar.gz.
File metadata
- Download URL: netboxlabs_orb_worker-1.16.0.tar.gz
- Upload date:
- Size: 30.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ca231a97e2406d5ca41e896c0ba8eeaea106175dd5598690e48365c8aca0a1b
|
|
| MD5 |
eeedd4e505ff2ca456e9cf7cabbfc4b1
|
|
| BLAKE2b-256 |
7a734d6419830e326d8dc14fa2884a9409321afef44f3f71385ce0936234b68a
|
Provenance
The following attestation bundles were made for netboxlabs_orb_worker-1.16.0.tar.gz:
Publisher:
worker-release.yaml on netboxlabs/orb-discovery
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
netboxlabs_orb_worker-1.16.0.tar.gz -
Subject digest:
8ca231a97e2406d5ca41e896c0ba8eeaea106175dd5598690e48365c8aca0a1b - Sigstore transparency entry: 1850092403
- Sigstore integration time:
-
Permalink:
netboxlabs/orb-discovery@e3542e86c41afeab6f1c20ca9cef74d3b3a8cae0 -
Branch / Tag:
refs/heads/release - Owner: https://github.com/netboxlabs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
worker-release.yaml@e3542e86c41afeab6f1c20ca9cef74d3b3a8cae0 -
Trigger Event:
push
-
Statement type: