MCPcopy Index your code
hub / github.com/digitalocean/do-agent

github.com/digitalocean/do-agent @3.18.14

Chat with this repo
repository ↗ · DeepWiki ↗ · release 3.18.14 ↗ · + Follow
253 symbols 677 edges 48 files 154 documented · 61%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

DigitalOcean Agent

Go Report Card Coverage Status

Overview

do-agent enables droplet metrics to be gathered and sent to DigitalOcean to provide resource usage graphs and alerting.

DO Agent currently supports: - Ubuntu (oldest End Of Standard Support LTS release and later) - Debian (oldest supported LTS release and later) - Fedora 27+ - CentOS 6+ - Docker (see below)

Not officially supported

  • CloudLinux 6+

Note:

Although, we only officially support these distros and versions, do-agent works on most Linux distributions. Feel free to run it wherever you are successful, but any issues you encounter will not have official support from DigitalOcean

Special Note For SELinux Users

The do-agent install script sets the nis_enabled flag to 1. Without this setting the do-agent cannot reach the network to perform authentication or send metrics to DigitalOcean backend servers. If you reverse this action, or install the do-agent on a machine manually you will need to run setsebool -P nis_enabled 1 && systemctl daemon-reexec otherwise the do-agent will not operate.

Installation

To install the do-agent on new Droplets simply select the Monitoring checkbox on the Droplet create screen to get the latest stable version of do-agent. Use your OS package manager (yum/dnf/apt-get) to update and manage do-agent.

Installing via package managers

curl -sSL https://repos.insights.digitalocean.com/install.sh | sudo bash
# or wget
wget -qO- https://repos.insights.digitalocean.com/install.sh | sudo bash

If you prefer to inspect the script first:

curl -L -o ./install.sh https://repos.insights.digitalocean.com/install.sh
# inspect the file
less ./install.sh
# execute the file
sudo ./install.sh

Development

Requirements

git clone git@github.com:digitalocean/do-agent.git
cd do-agent

### build the project
make

### add dependencies
# first make sure you have the appropriate flags set to use go modules
# We recommend using https://github.com/direnv/direnv to automatically set
# these from the .envrc file in this project or you can manually set them
export GO111MODULE=on GOFLAGS=-mod=vendor

# then add your imports to any go file and run
go mod vendor

Uninstall

do-agent can be uninstalled with your distribution's package manager

apt-get remove do-agent for Debian based distros

yum remove do-agent for RHEL based distros

Run as a Docker container

You can optionally run do-agent as a docker container. In order to do so you need to mount the host directory /proc to /host/proc.

For example:

docker run \
        -v /proc:/host/proc:ro \
        -v /sys:/host/sys:ro \
        digitalocean/do-agent:stable

Report an Issue

Feel free to open an issue if one does not already exist

Extension points exported contracts — how you extend this code

Decorator (Interface)
Decorator decorates a list of metric families [5 implementers]
pkg/decorate/chain.go
HTTPClient (Interface)
HTTPClient is can make HTTP requests [2 implementers]
pkg/clients/http.go
Option (FuncType)
Option is used to configure optional scraper options.
pkg/collector/scraper.go
Client (Interface)
Client is an interface for sending batches of metrics [1 implementers]
pkg/clients/tsclient/client.go
DefinitionOpt (FuncType)
DefinitionOpt is an option initializer for metric registration.
pkg/clients/tsclient/metric_definition.go
ClientOptFn (FuncType)
ClientOptFn allows for overriding options
pkg/clients/tsclient/client.go

Core symbols most depended-on inside this repo

sptr
called by 23
pkg/decorate/compat/names.go
Debug
called by 19
internal/log/log.go
Error
called by 19
internal/log/log.go
Read
called by 10
pkg/clients/tsclient/structuredstream/structured_stream_reader.go
WithTimeout
called by 9
pkg/collector/scraper.go
NewScraper
called by 9
pkg/collector/scraper.go
Decorate
called by 9
pkg/decorate/chain.go
Write
called by 8
cmd/do-agent/run.go

Shape

Function 111
Method 100
Struct 28
Interface 6
TypeAlias 5
FuncType 3

Languages

Go100%

Modules by API surface

pkg/clients/tsclient/client.go42 symbols
pkg/collector/scraper.go18 symbols
pkg/clients/tsclient/structuredstream/structured_stream_reader.go17 symbols
cmd/do-agent/config.go15 symbols
pkg/clients/tsclient/metric_definition.go12 symbols
pkg/decorate/topk.go10 symbols
cmd/do-agent/run.go10 symbols
internal/log/log.go9 symbols
pkg/clients/http.go8 symbols
pkg/decorate/compat/cpu_test.go7 symbols
pkg/collector/node.go7 symbols
pkg/clients/tsclient/structuredstream/structured_stream_writer.go7 symbols

For agents

$ claude mcp add do-agent \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact