AppDynamics Knowledge Base

How to Enable the http listener on a Windows Machine agent

How to Enable the http listener on a Windows Machine agent

Machine Agent HTTP Listener - How to Enable the http listener on a Windows Machine agent

You can send metrics to the Machine Agent using its HTTP listener. You can report metrics through the Machine Agent by making HTTP calls to the Agent.

The HTTP listener is not enabled by default. To activate the HTTP listener, restart the Machine Agent and set the metric.http.listener system property as mentioned below.

Step-by-step guide:

There are two ways to enable this property via the Command line with Java Arguments or add the parameters in the VMOPTIONs file if you’re running machine agent as a services.

 Option 1:  Running machine agent as a services

  1. Assuming the Machine agent is installed under this directory then go to this path For Example

C:\Program Files\AppDynamics\Machine Agent\bin

      2. Add the below properties under VMOPTIONS File which is located under Machine Agent\bin folder.           

metric.http.listener: Required. Set to true.

metric.http.listener.port: Optional. Set to the port to be used, defaults to 8293.

metric.http.listener.host: Optional. This describes which interface to accept requests on.

You can set it as follows

-Dmetric.http.listener=true

-Dmetric.http.listener.port=8293

-Dmetric.http.listener.host=0.0.0.0

 

image.png

 

Sending a custom metric to the AppDynamics Machine Agent running locally (on port 8293) using the built-in HTTP listener.

C:\Users\Administrator>curl -v "http://localhost:8293/machineagent/metrics?name=Custom%20Metrics%7CTest%7CMy%20Metric&value=42&type=..."

* Host localhost:8293 was resolved. IPv6: ::1
*IPv4: 127.0.0.1
*Trying [::1]:8293...
*Connected to localhost (::1) port 8293

> GET /machineagent/metrics?name=Custom%20Metrics%7CTest%7CMy%20Metric&value=42&type=average HTTP/1.1
> Host: localhost:8293
> User-Agent: curl/8.9.1
> Accept: */*

* Request completely sent off
< HTTP/1.1 204 No Content
< Date: Wed, 12 Feb 2025 05:01:08 GMT
< Content-Type: application/xml
< Server: Jetty(9.4.56.v20240826)

* Connection #0 to host localhost left intact

Option 2:  Machine Agent Running as a Runtime via Command line

Run the below command and give the path where Java Agent has been installed for example here Machine Agent is installed under C:\Program Files\AppDynamics directory so change the path based on your machine agent has been installed.

  1. Please add the HTTP listener property during runtime

    <machine_agent_home>/bin/machine-agent -Dmetric.http.listener=true -Dmetric.http.listener.port=<port_number> -Dmetric.http.listener.host=0.0.0.0​

For example:

C:\Program Files\AppDynamics\Machine Agent\jre\bin\Java -Xmx256m -Dlog4j.configuration=file:C:\Program Files\AppDynamics\Machine Agent\conf/logging/log4j.xml -Dmetric.http.listener=true -Dmetric.http.listener.port=8293 -Dmetric.http.listener.host=0.0.0.0 -jar C:\Program Files\AppDynamics\Machine Agent\machineagent.jar &

Note: Ensure that you place the options/parameters before the JAR name in your start-up command.

Validation Check

Once the Property has been added you can see the details under the logs file as mentioned below and also can see the custom metric under the metric browser UI.

image.png

Check in AppDynamics Controller UI under Metric Browser

image.png

Sample Metric -"My Metric" and "You Metric"

image.png

Labels (2)
Version history
Last update:
‎02-14-2025 01:37 PM
Updated by: