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

Dynatrace-AppMon-REST-Monitor-Plugin modify request header

chris_weigelt
Newcomer


Attempting to run a rest monitor but failing due to default header key-value pair of "Content-Type: text/plain". Do anyone know how to adjust Content-Type:application/json


2017-12-04 14:30:16 INFO [RestMonitor@<monitor name>_0] Executing method: POST, URI: http://my.host.com:9081/DecisionService/rest/v1/*********/1.0/************/WADL, with PostData: true
2017-12-04 14:30:16 FINE [wire@<monitor name>_0] http-outgoing-1364 >> "POST /DecisionService/rest/v1/*********/1.0/************/WADL HTTP/1.1[\r][\n]"
2017-12-04 14:30:16 FINE [wire@<monitor name>_0] http-outgoing-1364 >> "Content-Length: 649[\r][\n]"
2017-12-04 14:30:16 FINE [wire@<monitor name>_0] http-outgoing-1364 >> "Content-Type: text/plain; charset=UTF-8[\r][\n]"
2017-12-04 14:30:16 FINE [wire@<monitor name>_0] http-outgoing-1364 >> "Host: my.host.com:9081[\r][\n]"
2017-12-04 14:30:16 FINE [wire@<monitor name>_0] http-outgoing-1364 >> "Connection: Keep-Alive[\r][\n]"
2017-12-04 14:30:16 FINE [wire@<monitor name>_0] http-outgoing-1364 >> "User-Agent: dynaTrace/6[\r][\n]"
2017-12-04 14:30:16 FINE [wire@<monitor name>_0] http-outgoing-1364 >> "Expect: 100-continue[\r][\n]"

5 REPLIES 5

lawrence_cuneaz
Dynatrace Guide
Dynatrace Guide

Hi Chris,

The bad news is that looking through the source code of the application I found no content type being set explicitly.

Good news is that the plugin comes with the full source code. You can just check out the plugin through the AppMon client and add this either as a parameter or hard-code the setting. Check out the Develop Plugin Documentation for further details on coding plugins.

Regards,

Lawrence

Lawrence, Thanks for the feed back. You confirmed my fear. Hoping Gabriel's suggestion below will do the trick.

gabriel_casella
Dynatrace Pro
Dynatrace Pro

Hi Chris,

fortunately I have made this change before. You can check-out it here: https://github.com/gbc921/Dynatrace-REST-Monitor-P...

The only restriction is that only one header can be added, but would not be that harder to parse more headers.

Please let me know whether that works/helps you somehow.

Tks,

Hi Gabriel, I attempted a test using your code. A field to set the header values was not readily available. The test saw the same result. I'll try to look through the code see if I can figure out where to make the change. I'm not a java guy so any suggestion to where to look would be helpful. Thanks for the help!

Can you please post a screenshot of how you tried to do on AppMon using my plugin?

If my memory doesn't fail, you just had to select the checkbox and input the header in the format 'header:value'. But we can't add more then one.

Looking forward,