Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add option to enable network check and document it #81

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ RUN mv /etc/dd-agent/datadog.conf.example /etc/dd-agent/datadog.conf \
&& sed -i "/user=dd-agent/d" /etc/dd-agent/supervisor.conf \
&& sed -i 's/AGENTUSER="dd-agent"/AGENTUSER="root"/g' /etc/init.d/datadog-agent \
&& chmod +x /etc/init.d/datadog-agent \
&& rm /etc/dd-agent/conf.d/network.yaml.default \
&& ln -s /opt/datadog-agent/agent/dogstatsd.py /usr/bin/dogstatsd

# Add Docker check
Expand Down
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ A few parameters can be changed with environment variables.
* `PROXY_HOST`, `PROXY_PORT`, `PROXY_USER` and `PROXY_PASSWORD` set the proxy configuration.
* `DD_URL` set the Datadog intake server to send Agent data to (used when [using an agent as a proxy](https://github.com/DataDog/dd-agent/wiki/Proxy-Configuration#using-the-agent-as-a-proxy) )
* `DOGSTATSD_ONLY` tell the image to only start a standalone dogstatsd instance.
* `NETWORK_CHECK` enable the network check. **Warning**: read the [network check instructions](#network-check) if you want to enable it.

### Enabling integrations

Expand All @@ -63,6 +64,18 @@ To enable integrations you can write your YAML configuration files in the `/conf

Now when the container starts, all files in `/opt/dd-agent-conf.d` with a `.yaml` extension will be copied to `/etc/dd-agent/conf.d/`. Please note that to add new files you will need to restart the container.


#### Network check

By default the network check is not included in this Docker image. That is because the container's network is separated from the host's, so the metrics this check would collect would be irrelevant.

If you wish to collect host-level network metrics, you will need to run the agent container with the `NETWORK_CHECK` environment variable (`-e NETWORK_CHECK=true`) to explicitly enable the network check, and the `--net=host` option.
This option tells Docker to not containerize the container's networking. It allows the agent to collect network metrics at the host level.

Using this option requires a few adjustments:
* The `--net=host` option must replace the `-h` one, as recent versions of Docker make these flags mutually exclusive.
* You need to make sure all ports used by the Datadog agent are free on the host. Since the container's networking is not containerized, it will use the ports directly from the host. Refer to the [agent architecture page](https://github.com/DataDog/dd-agent/wiki/Agent-Architecture#supervision-privileges-and-network-ports) for a list of said ports.

### Build an image

To configure specific settings of the agent straight in the image, you may need to build a Docker image on top of this image.
Expand Down
4 changes: 4 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ if [[ $STATSD_METRIC_NAMESPACE ]]; then
sed -i -e "s/^# statsd_metric_namespace:.*$/statsd_metric_namespace: ${STATSD_METRIC_NAMESPACE}/" /etc/dd-agent/datadog.conf
fi

if ! [[ $NETWORK_CHECK ]]; then
rm /etc/dd-agent/conf.d/network.yaml.default
fi

find /conf.d -name '*.yaml' -exec cp {} /etc/dd-agent/conf.d \;

find /checks.d -name '*.py' -exec cp {} /etc/dd-agent/checks.d \;
Expand Down