How to health check the EPAgent HTTP RESTful interface port

Document ID : KB000115946
Last Modified Date : 27/09/2018
Show Technical Document Details
Introduction:
It is useful to be able to test the health of the EPAgent HTTP RESTful interface port after enabling it in the IntroscopeEPAgent.properties file using property:
introscope.epagent.config.httpServerPort 
Environment:
APM 9.7, 10.x
Instructions:
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 
ERR_CONNECTION_REFUSED


If the EPAgent HTTP port is up and accessible the result will be as follows (NOTE: only POST is supported): 
HTTP ERROR: 405 
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 https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/installer)
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"}]}"
{"validCount":1}


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:
HTTP ERROR 404 
Problem accessing /apm/metricFeed. Reason: 
NOT_FOUND 
--------- 
Powered by jetty:// 
Additional Information:
1. EPAgent 101: Use the SDK to Send Data to APM
2. https://docops.ca.com/ca-apm/10-7/en/implementing-agents/infrastructure-agent/epagent-plug-ins/standalone-epagent/install-and-configure-the-standalone-epagent/configure-the-standalone-epagent-restful-interface
3. https://docops.ca.com/ca-apm/10-7/en/implementing-agents/infrastructure-agent/epagent-plug-ins/standalone-epagent/standalone-epagent-properties#StandaloneEPAgentProperties-StandaloneEPAgentConfiguration