Closed arielsalvo closed 4 years ago
Hi @arielsalvo -- The generally recommended way of doing this is to use a ConfigMap. It should look something like the following:
apiVersion: v1
kind: ConfigMap
metadata:
name: haproxy-newrelic-integrations-config
namespace: default
data:
config.yaml: |
integration_name: com.newrelic.haproxy
instances:
- name: haproxy
# Command can be all_data, metrics, or inventory
command: all_data
arguments:
stats_url: http://127.0.0.1:7777/stats
username: cacheuser
password: password
cluster_name: mmacias
definition.yaml: |
name: com.newrelic.haproxy
description: Reports status and metrics for haproxy service
protocol_version: 2
os: linux
commands:
all_data:
command:
- ./bin/nr-haproxy
prefix: config/haproxy
interval: 15
metrics:
command:
- ./bin/nr-haproxy
- --metrics
interval: 15
inventory:
command:
- ./bin/nr-haproxy
- --inventory
prefix: config/haproxy
interval: 15
Hi, @camdencheek
You are correct but my tests were not yet in K8s, just docker. Still, shouldn't the definition be added to the image in the right place and with the correct path to the bin? Otherwise, why go through the effort of adding the file to the image?
Hi @arielsalvo -- sorry for the slow reply. This one dropped off my radar. I'm not terribly familiar with the design behind the docker images, but my understanding is that they were built specifically for monitoring in kubernetes as a sidecar. Running in a standalone docker container is not currently supported
Hi, @camdencheek
No problem.
What I'm trying to say is that the file haproxy-definition.yml
that is being added to the image is useless in both use cases (k8s and standalone).
If you changed the path and location as I stated in my first comment, you wouldn't need to add it as a config_map and it would work out of the box in both environments only adding a config_map for config.yaml
(that contains the config for what you are monitoring).
In any case, since this is for convenience and can easily be fixed by adding the config_map, you can close this issue but I honestly think this should and could be modified.
Thanks for the input -- I've passed it on to the team that maintains our Kubernetes offering
Hi
I kept getting the following error when trying out docker image newrelic/k8s-nri-haproxy:2.1.0:
Had to import the definition to another directory for newrelic-infrastructure to pick it up:
/var/db/newrelic-infra/custom-integrations/haproxy-definition.yml
This should be changed in: https://github.com/newrelic/nri-haproxy/blob/10f84727b7dd6ed6185f9b9c893461470b2f12c8/Dockerfile#L11Also, the path to the sidecar in the already included definition appears not to work unless changed from
./bin/nri-haproxy
to the absolute path/nri-sidecar/newrelic-infra/newrelic-integrations/bin/nri-haproxy
After these changed, it worked for me. Is there a better way to do this?
Thanks! --Ariel