How to health check the EPAgent HTTP RESTful interface port

Document ID : KB000115946
Last Modified Date : 27/09/2018
Show Technical Document Details
It is useful to be able to test the health of the EPAgent HTTP RESTful interface port after enabling it in the file using property:
APM 9.7, 10.x
For example EPAgent using HTTP port 9080 (introscope.epagent.config.httpServerPort=9080

1. Test http://EPAGENT_HOST:9080/apm/metricFeed from a browser e.g. Chrome:
If the EPAgent HTTP port is down or not accessible the result will be as follows:
This site can’t be reached 
willy03-i2438 refused to connect. 
Search Google for willy03 2438 9080 apm metric Feed 

If the EPAgent HTTP port is up and accessible the result will be as follows (NOTE: only POST is supported): 
Problem accessing /apm/metricFeed. Reason:

HTTP method GET is not supported by this URL

Powered by Jetty:// 

 2. Similar checks can be done with curl installed on Linux or on Windows (On Windows curl can be installed via Mingw-64 from
a. Using basic curl command with -I option for HEAD only:
C:\Program Files\Git\mingw64\bin>curl -I http://EPAGENT_HOST:9080/apm/metricFeed 
HTTP/1.1 405 HTTP method GET is not supported by this URL 
Cache-Control: must-revalidate,no-cache,no-store 
Content-Type: text/html;charset=ISO-8859-1 
Content-Length: 1351

b. Using curl command with POST and a valid payload: 
C:\Program Files\Git\mingw64\bin>curl -k -X POST http://EPAGENT_HOST:9080/apm/metricFeed -H "Content-Type:application/json; charset=UTF-8" -d "{\"metrics\":[{\"type\":\"IntCounter\", \"name\":\"Time (µs)\", \"value\":"12"}]}"

NOTE: Using the common port 8080 for the property introscope.epagent.config.httpServerPort will cause a conflict problem if it is already being used by another Web Server or Application Server. In particular when installing EPAgent on the same server as the APM Enterprise Manager running WebView on default port 8080 this type of error will be seen because the EPAgent jetty server fails to start and the request is going to the WebView jetty server:
Problem accessing /apm/metricFeed. Reason: 
Powered by jetty:// 
Additional Information:
1. EPAgent 101: Use the SDK to Send Data to APM