How and where to set newrelic.config.file

Hello Everyone,

I will try to explain my problem first, please bear with me.

I am trying to monitor three JVMS(containers) residing on a single virtual machine.
I would like to use single new relic.jar for this. I have copied it in local VM storage and mounted it in docker containers of all three JVMs.

Now i would like to expose JMX metrics from these JVMs and i understand i need to write extensions for the same and mention the path in new relic.yml.

I will need to write three different extension files i presume.

I was wondering if i could create different config file for different agents , may be i can mention different extension folder in those config files.

So i was trying to figure out how to set config file for new relic agent at runtime.
I hope i have given complete context of my problem , feel free to give any feedback.

Sample docker-compose:

image: kafka-rest-mr-service
network_mode: host
- zookeeper
- ‘8082:8082’
KAFKAREST_JMX_OPTS: “ -Djava.rmi.server.hostname=”
JMX_PORT: 1098
KAFKA_JVM_PERFORMANCE_OPTS: “-server -XX:+UseG1GC -XX:MaxGCPauseMillis=20 -XX:InitiatingHeapOccupancyPercent=35 -XX:+DisableExplicitGC -Djava.awt.headless=true -javaagent:/root/newrelic/newrelic/newrelic.jar”
- /root/newrelic/newrelic/:/root/newrelic/newrelic/

Please vote for my feature request: I think this would also help in your scenario.

1 Like

@wkiNewRelic Your feature request is indeed useful , I will vote for it. However its not what i am looking for. I read your request details and you mentioned you are using custom.yml file for all those web applications. My question was more about how to make your application use that custom.yml instead of the default one: newrelic.yml. In documentations its mentioned we can use newrelic.config.file but i couldn’t understand where i need to set this option.

Please help if possible. My applications are container based and i am using docker-compose to spawn them , please advise.


Hi, @mail.yogesh.gupta: You may override the default config file location by setting the newrelic.config.file system property. For more information about setting Java system properties, you may find this article helpful:

@philweber Thanks for taking time to respond. I figured it out myself. We need to set it in docker compose like this:

KAFKA_JVM_PERFORMANCE_OPTS: “-server -XX:+UseG1GC -XX:MaxGCPauseMillis=20 -XX:InitiatingHeapOccupancyPercent=35 -XX:+DisableExplicitGC -Djava.awt.headless=true -javaagent:/newrelic/newrelic.jar -Dnewrelic.config.file=/home/ubuntu/newrelic/zk_newrelic.yml”

@mail.yogesh.gupta Thanks for sharing your solution! We are glad to hear you were able to figure it out.