Comments (6)
I believe this requires NRIA_PASSTHROUGH_ENVIRONMENT configured.
In your dockerfile, for which ever environment variables you wish to pass through the integration, can you passthrough as similar to the below example and then try again.
Example:
https://github.com/newrelic/nri-flex/blob/master/configs/Dockerfile-linux#L21
from nri-flex.
Attempting to add that in both the container build and in kubernetes template still results in the same problem: no matter how I setup the flex config, it does not inherit the envvar.
Dockerfile:
FROM newrelic/infrastructure:1.7.6
# debuging
#ENV NRIA_LOG_FILE=/etc/newrelic-infra/nr.log
#ENV NRIA_VERBOSE=0
ENV NRIA_IS_FORWARD_ONLY=true
# create some needed default directories for flex
RUN mkdir -p /var/db/newrelic-infra/custom-integrations/flexConfigs/
# RUN mkdir -p /var/db/newrelic-infra/custom-integrations/flexContainerDiscovery/
# if using container discovery configs uncomment this section
# ADD flexContainerDiscovery /var/db/newrelic-infra/custom-integrations/flexContainerDiscovery/
ENV NRIA_PASSTHROUGH_ENVIRONMENT="NEW_RELIC_METADATA_KUBERNETES_CLUSTER_NAME,NRIA_IS_FORWARD_ONLY"
# copy config/definition/binary over
COPY ./nri-flex-config.yml /etc/newrelic-infra/integrations.d/
COPY ./nri-flex-definition.yml /var/db/newrelic-infra/custom-integrations/nri-flex-definition.yml
COPY ./nri-flex /var/db/newrelic-infra/custom-integrations/nri-flex
RUN chmod 744 /var/db/newrelic-infra/custom-integrations/nri-flex
COPY ./flexConfigs* /var/db/newrelic-infra/custom-integrations/flexConfigs/
# # add netcat if needed
# RUN apk add --update netcat-openbsd && rm -rf /var/cache/apk/*
I've tried using newrelic infra 1.7.6, as well as 1.5.0 (per your link). I've tried many different options for the flex config, including with/without brackets.
I see in the kubernetes config that the envvar exists on the podspec:
containers:
- env:
- name: NRIA_IS_FORWARD_ONLY
value: "true"
- name: NRIA_PASSTHROUGH_ENVIRONMENT
value: NRIA_IS_FORWARD_ONLY,NRIA_LICENSE_KEY,NEW_RELIC_METADATA_KUBERNETES_CLUSTER_NAME
- name: NRIA_LICENSE_KEY
valueFrom:
secretKeyRef:
key: NRIA_LICENSE_KEY
name: newrelic-license
- name: NEW_RELIC_METADATA_KUBERNETES_CLUSTER_NAME
value: k8s.mytestcluster.tld
- name: NEW_RELIC_METADATA_KUBERNETES_NODE_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: spec.nodeName
- name: NEW_RELIC_METADATA_KUBERNETES_NAMESPACE_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
- name: NEW_RELIC_METADATA_KUBERNETES_POD_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.name
And I see the passthrough var in the pod logs (as well as am able to printenv and see it from exec-ing into the pod):
$ kubectl logs nri-linkerd-gf8nx
[WARN tini (25455)] Tini is not running as PID 1 and isn't registered as a child subreaper.
Zombie processes will not be re-parented to Tini, so zombie reaping won't work.
To fix the problem, use the -s option or set the environment variable TINI_SUBREAPER to register Tini as a child subreaper, or run Tini as PID 1.
time="2019-12-20T15:00:58Z" level=info msg="runtime configuration" agentUser=root component="New Relic Infrastructure Agent" executablePath= maxProcs=1 pluginDir="[/etc/newrelic-infra/integrations.d /var/db/newrelic-infra/integrations.d]"
time="2019-12-20T15:00:58Z" level=info msg="Creating Service" component="New Relic Infrastructure Agent" elapsedTime="982.457µs" version=1.5.0
time="2019-12-20T15:00:58Z" level=info msg="Agent service manager started successfully" component=AgentService elapsedTime=1.010244ms service=newrelic-infra
time="2019-12-20T15:00:58Z" level=info msg="Checking network connectivity..." component=AgentService service=newrelic-infra
time="2019-12-20T15:00:58Z" level=info msg=Initializing component=AgentService elapsedTime=135.191836ms service=newrelic-infra
time="2019-12-20T15:00:58Z" level=info msg="New Relic Infrastructure Agent Running" component=AgentService elapsedTime=243.94468ms service=newrelic-infra
time="2019-12-20T15:00:58Z" level=info msg="Agent plugin" plugin=metadata/attributes
time="2019-12-20T15:00:58Z" level=info msg="Integration info" arguments="map[container_discovery:true]" command=metrics commandLine="[nri-flex --metrics]" env-vars="map[VERBOSE:0 CONTAINER_DISCOVERY:true NRIA_IS_FORWARD_ONLY:true NRIA_LICENSE_KEY:<HIDDEN> NEW_RELIC_METADATA_KUBERNETES_CLUSTER_NAME:k8s.mytestcluster.tld PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin]" instance=nri-flex integration=com.newrelic.nri-flex interval=30 labels="map[]" os=linux prefix=integration/com.newrelic.nri-flex protocolVersion=2 workingDir=/var/db/newrelic-infra/custom-integrations
time="2019-12-20T15:00:58Z" level=info msg="Integration health check starting" instance=nri-flex integration=com.newrelic.nri-flex prefix=integration/com.newrelic.nri-flex working-dir=/var/db/newrelic-infra/custom-integrations
time="2019-12-20T15:00:58Z" level=info msg="Integration health check finished with success" instance=nri-flex integration=com.newrelic.nri-flex prefix=integration/com.newrelic.nri-flex working-dir=/var/db/newrelic-infra/custom-integrations
But my queries for this value in insights continue to only produce the placeholder result.
from nri-flex.
@Kav91 any update on the above? We're still facing this problem and unable to appropriately leverage envvars in our flex config.
from nri-flex.
hey @j0sh3rs apologies for the delay, I am putting some time aside tomorrow to try and replicate and debug this.
I do have a suspicious it could not be Flex related, and it could entirely be that Flex was not passed all the envs from the agent for some reason, but I need to confirm.
from nri-flex.
Discovered the issue, the env substitution occurs correctly for standard flex configs, but not ones generated by container discovery.
Looking into applying a fix now, should be a quick one hopefully 🤞
from nri-flex.
@j0sh3rs fix is applied in the 0.8.9 release -> https://github.com/newrelic/nri-flex/releases
If you still experience any issues, feel free to reopen the issue.
Thanks for catching this one!
from nri-flex.
Related Issues (20)
- Add automatic time server discovery for Windows NTP Clock Drift integration HOT 2
- linux-file-count.yml does not work as-is
- Review/create e2e tests to be able to upgrade go version HOT 1
- Upgrade Go version to > 1.15
- Flex IP Discovery on Kubernetes HOT 3
- Flex not working though API call works with Curl -k HOT 1
- Impossible to use the '%' character in a db query (MySQL)
- Running Flex Serverless - Azure Function App?
- Getting Parse errors in case if docker discovery doesn't finds any suitable containers
- Add support for Oracle DB HOT 1
- null value being converted to unicode HOT 8
- [Repolinter] Open Source Policy Issues HOT 1
- Extra middle whitespace in `name: nri-flex` throws an error HOT 3
- "lookups" function fails when looking up more than one value in same command HOT 1
- [Repolinter] Open Source Policy Issues HOT 1
- Sampling rate to New Relic does not go below 15s HOT 2
- [Repolinter] Open Source Policy Issues HOT 1
- Not possible to add user/pass as global to invoke PowerShell script with specific credentials HOT 3
- Swedish characters like åäö is not working in Flex via PowerShell HOT 3
- Recursively get data by using the 'nextCursor' attribute in Nerdgraph API HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nri-flex.