Let’s discuss a technical issue that likely only affects software developer environments where you have an automated build. I needed to start monitoring a Jenkins CI build instance with a New Relic Application monitor on Linux. The issue is that the automatic application installer does not work since the application is launched via a java -jar command.
I looked at the New Relic documentation and it did not have a specific example for this type of scenario. There was a generic statement “The New Relic Java agent should work on any application server by passing the -javaagent:/path/to/newrelic.jar switch to the JVM.”
This almost worked but there was one caveat. You need to place this before you launch the -jar /path/to//jenkins.war parameter.
The Jenkins launch command should look something like this:
/usr/bin/java -Dcom.sun.akuma.Daemon=daemonized -Djava.awt.headless=true -Xms4g -Xmx4g -XX:MaxPermSize=2048M -DJENKINS_HOME=/usr1/data/jenkins -javaagent:/path/to/newrelic.jar -jar /path/to/jenkins.war –logfile=/path/to/jenkins.log –webroot=/path/to/war –daemon –httpPort=80 –ajp13Port=8009 –debug=5 –handlerCountMax=100 –handlerCountMaxIdle=20 –prefix=/jenkins
I accomplished this by modifying the /etc/init.d/jenkins script on startup.