How to Collect DigitalOcean Resource Data
The DigitalOcean collector is configured within the Resoto Worker configuration via the config
command in Resoto Shell.
Prerequisites​
This guide assumes that you have already installed Resoto.
Directions​
1. Enable the DigitalOcean Collector​
Open the Resoto Worker configuration via the
config
command in Resoto Shell:> config edit resoto.worker
Add
digitalocean
to the list of collectors by modifying the configuration as follows:resotoworker:
...
# List of collectors to run
collector:
- 'digitalocean'
...
...
2. Authenticate with DigitalOcean​
DigitalOcean uses access tokens to authenticate API requests. You can provide access tokens to Resoto via the Resoto Worker configuration or environment variables.
- Resoto Worker Configuration
- Environment Variables
Open the Resoto Worker configuration via the
config
command in Resoto Shell:> config edit resoto.worker
Modify the
digitalocean
section of the configuration as follows, adding your API tokens and/or access keys:digitalocean:
# DigitalOcean API tokens for the teams to be collected
api_tokens:
- 'dop_v1_e5c759260e6a43f003f3b53e2cfec79cxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
# DigitalOcean Spaces access keys for the teams to be collected, separated by colons
spaces_access_keys: []
...
Instead of specifying API tokens or secret access keys in the Resoto Worker configuration directly, it is possible to define them using the --override
flag or RESOTOWORKER_OVERRIDE
environment variable.
Set the
RESOTOWORKER_OVERRIDE
environment variable:- Docker
- Kubernetes
- pip
Add a environment variable definition to the
resotoworker
service indocker-compose.yaml
:docker-compose.yamlservices:
...
resotoworker:
environment:
- RESOTOWORKER_OVERRIDE="digitalocean.api_tokens=dop_v1_e5c759260e6a43f003f3b53e2cfec79cxxxxxxxxxxxxxxxxxxxxxxxx"
...
...Recreate the
resotoworker
container with the updated service definition:$ docker-compose up -d
noteDocker Compose V2 integrated compose functions in to the Docker platform.
In Docker Compose V2, the command is
docker compose
(no hyphen) instead ofdocker-compose
.
Create a secret:
$ kubectl -n resoto create secret generic resoto-auth \
--from-literal=RESOTOWORKER_OVERRIDE="digitalocean.api_tokens=dop_v1_e5c759260e6a43f003f3b53e2cfec79cxxxxxxxxxxxxxxxxxxxxxxxx"Update
resoto-values.yaml
as follows:resoto-values.yaml...
resotoworker:
...
extraEnv:
- name: RESOTOWORKER_OVERRIDE
valueFrom:
secretKeyRef:
name: resoto-auth
key: RESOTOWORKER_OVERRIDE
...Deploy these changes with Helm:
$ helm upgrade resoto resoto/resoto --set image.tag=3.6.5 -f resoto-values.yaml
Export the
RESOTOWORKER_OVERRIDE
environment variable:$ export RESOTOWORKER_OVERRIDE="digitalocean.api_tokens=dop_v1_e5c759260e6a43f003f3b53e2cfec79cxxxxxxxxxxxxxxxxxxxxxxxx"
Restart the
resotoworker
process.
3. Trigger Resource Collection​
By default, Resoto performs resource collection each hour. To immediately trigger a collect run, use the
workflow run
command in Resoto Shell:> workflow run collect
Once the collect run completes, you can view a summary of collected DigitalOcean resources using the following search:
> search is(digitalocean_resource) | count kind