cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Injecting Java Agent into Apache NiFi start file

miteglia
Participant

Hi Everyone,

Good day!

Does anyone know if Dynatrace can support Apache NiFi? Specifically for application monitoring. I've looked around the web and haven't seen anything about it so far.

Appreciate if someone can comment on this and point me in the right direction.

Thank you.

10 REPLIES 10

andreas_grabner
Dynatrace Leader
Dynatrace Leader

Hi Michele

I think we discussed this via email. My assumption was that you should give it a try and instrument your Apache NiFi with a Dynatrace Java Agent. If you had a chance to try it out let us know if you were successful

andi

miteglia
Participant

Just to clarify, the above inquiry was posted before the time of our email exchange.

Hi Andi,

Yes, that's what I'm working on at the moment. We tried injecting the Java agent in NiFi installed on a Linux machine (openSUSE VM) and it worked.

However on a Windows PC, we get an "input line is too long" error when inserting the agent (-agentpath:"C:\Dynatrace 6.5\agent\lib64\dtagent.dll"=name=JavaApplication_Test,collector=localhost:9998)

- into the run-nifi.bat file.

I posted a separate inquiry for this on: https://answers.dynatrace.com/questions/175559/iss...

I've tried everything from PowerShell to editing nifi-env.bat, but still doesn't work. Now I'm looking into how JVMs work.

Micky

Hi Micky,

I would try the following:

1. Make sure the path to the agent has no spaces (use mklink, if needed)

2. Remove the double quotes surrounding the path

3. Shorten the agent name to something like just "NiFi"

4. Remove the ":9998" port, since it does not need to be specified when the default port is used

This will make your agentpath as short as possible, and avoid any issues that might be caused by spaces in the path, or by double quotes being parsed incorrectly.

HTH,

dave

Hi Dave,

Thanks for the suggestion. I did steps 1,2 and 4, but still get the same error.

I even named the agent just one letter, "d". This is what it looks like now:

set DYNA_ARGS=-agentpath:"C:\d.dll"=name=JavaApplication_Test,server=localhost

But removing the double quotes returns a syntax error though.

I'm not sure how to proceed anymore I've exhausted a loot of options already. I was able to do the same thing for Linux though and no issues.

dave_mauney
Dynatrace Champion
Dynatrace Champion

Hi Micky,

I created a "dynatrace" sub directory under the "bin" directory, and copied the "lib64" directory there.

Then I used this:

set JAVA_ARGS=-agentpath:dynatrace\lib64\dtagent.dll=name=NiFi,collector=localhost -Dorg.apache.nifi.bootstrap.config.log.dir=%NIFI_LOG_DIR% -Dorg.apache.nifi.bootstrap.config.pid.dir=%NIFI_PID_DIR% -Dorg.apache.nifi.bootstrap.config.file=%BOOTSTRAP_CONF_FILE%

I saw the agent log statements in the console, so I think it works.

I was able to recreate some of your "too long" and "syntax" messages before trying this, so give it a whirl and hopefully it will do the trick for you...

HTH,

dave

Oh my gosh your answer worked!! Thanks so much!! If I had points to give away, I'd give you a lot.

This path doesn't work:

C:\Dynatrace 6.5\agent\lib64\dtagent.dll

It returns the following error:

Error occurred during initialization of VM Could not find agent library dynatrace\lib64\dtagent.dll in absolute path, with error: Can't find dependent libraries

I think it's the spaces! C:\Dynatrace 6.5\agent\lib64\dtagent.dll has a space, whereas C:\nifi-1.1.2\bin\lib64\dtagent.dll doesn't have a single one.

I also tried to put the quotation marks and it failed: "C:\dtagent.dll"

So to sum up, the issues were:

1. It doesn't accept spaces because of the character limitation of Windows

2. Putting " " on the file path also results in error

This is the complete path

-agentpath:C:\dtagent.dll=name=JavaApplication1_Monitoring,server=localhost:9998

I just put the .dll in C:\. But I also tried your suggestion and put it into bin and that worked too.

Hi Micky,

Glad it works for you now!

dave

Hi @Dave M.,

Would you know the equivalent to "set JAVA_ARGS" in Linux?

export JAVA_ARGS. But I found at another customer that setting JAVA_ARGS was only instrumenting the main process. A child process that does the actual work was not being instrumented until we set the agentpath in bootstrap.conf.

Sorry for not responding earlier, I have been too busy to check the forums lately.

HTH,

dave

dave_mauney
Dynatrace Champion
Dynatrace Champion

Just putting this answer at the bottom in case anyone misses it above.

It seems there are two places you can set the agentpath:

nifi.ini - but this seems to only affect the "master" process.

bootstrap.conf - affects the "worker" process for sure, not sure about the "master" (because they already were setting it in nifi.ini).

We saw nice PurePaths after adding it in boostrap.conf, so I would start here and then look at nifi.ini only if needed.

HTH,

dave