Attempt to fix value not found: discovery.ip when using docker discovery
Getting error : level=error msg="can't start integration" component=integrations.runner.Runner env=dev environment=dev error="value not found: discovery.ip" Assume it's caused by not setting default discovery.ip when no ports are exposed.
Hi @das-peter, can you please include an example of an integration config to reproduce the error?
@josemore thanks for the feedback and sorry for the noise. Unfortunately I can't spent any more time on it and just went with hard coded values. So please feel free to disregard - won't close it just now since I'll add some info I got.
However, I can provide a quick example of how it was run: Infrastructure contain in the compose setup:
newrelic-infra:
container_name: ${COMPOSE_PROJECT_NAME}-newrelic-infra
image: ************/newrelic-infrastructure
cap_add:
- SYS_PTRACE
environment:
NEWRELIC_KEY: ${NEWRELIC_KEY}
NRIA_LICENSE_KEY: ${NEWRELIC_KEY}
COMPOSE_PROJECT_NAME: ${COMPOSE_PROJECT_NAME}
ENVIRONMENT: ${ENVIRONMENT}
NRI_MYSQL_USER: "newrelic"
NRI_MYSQL_USER_PASSWORD: "*******************"
# Disabled by default but can be handy for debugging.
NRIA_ENABLE_PROCESS_METRICS: "true"
# We don't expose all container ports - hence we stay in the container
# networks. It's more important to collect container info than host network
# metrics for the moment.
#network_mode: host
pid: host
privileged: true
volumes:
- "/:/host:ro"
- "/var/run/docker.sock:/var/run/docker.sock"
restart: unless-stopped
Custom image build
FROM newrelic/infrastructure:latest
# Repo: https://download.newrelic.com/infrastructure_agent/binaries/linux/amd64/
# Get all the clients we need.
# DON'T add varnish because it needs version specific varnish binaries and
# volume mappings in order to run. Dedicated image is used.
RUN cd /tmp/ \
&& wget https://download.newrelic.com/infrastructure_agent/binaries/linux/amd64/nri-docker_linux_1.8.27_amd64.tar.gz \
&& tar -xf nri-docker_linux_* -C / \
&& wget https://download.newrelic.com/infrastructure_agent/binaries/linux/amd64/nri-redis_linux_1.11.2_amd64.tar.gz \
&& tar -xf nri-redis_linux_* -C / \
....
Integration config example:
integration_name: com.newrelic.elasticsearch
# Use autodiscovery within our docker stack.
# Autodiscovery is fucked - always leads to:
# level=error msg="can't start integration" component=integrations.runner.Runner env=dev environment=dev error="value not found: discovery.ip" integration_name=nri-flex project=dobi role=php-fpm runner_uid=358170999e
# Even without using discovery.ip anywhere.
discovery:
docker:
match:
image: /elasticsearch/
integrations:
- name: nri-elasticsearch
command: all
arguments:
cluster_environment: {{ENVIRONMENT}}
HOSTNAME: ${discovery.ip}
LOCAL_HOSTNAME: ${discovery.ip}
env:
METRICS: true
CLUSTER_ENVIRONMENT: {{ENVIRONMENT}}
HOSTNAME: ${discovery.ip}
LOCAL_HOSTNAME: ${discovery.ip}
labels:
role: elasticsearch
project: {{COMPOSE_PROJECT_NAME}}
environment: {{ENVIRONMENT}}
env: {{ENVIRONMENT}}