Using the Standalone Machine Agent, you can supplement the existing metrics in the AppDynamics Controller UI with your own custom metrics. There are many extensions currently available on the AppSphere Community site. Some are created by AppDynamics and some have been created by users.
Similar to built-in metrics, your custom metrics are subject to the following AppDynamics features:
- Automatic baselines and anomaly detection
Availability to display on custom dashboards
- Availability to use in policies
- Visibility of all metrics in the Metric Browser and on the Infrastructure tab (where you can display external metrics and AppDynamics metrics on the same graph)
Add New Custom Metrics
To create custom metrics, you create a monitoring extension. In your extension, you define the name and path of your metric (where it appears in the metric browser tree), what type of metric it is (sum, average, and so on), and how the data for the metric should be rolled up as it ages. One Agent can run many extensions, although you may need to increase the amount of memory for the JVM Agent. You can have multiple copies of the same extension if they are in different directories.
A custom metric can be common across nodes or associated with a specific tier. When you create a metric, you specify the path in which it will appear in the metric tree. To create a common custom metric, use the root tree path Custom Metrics in your metric declaration. To create a tier-specific metric, specify the metric path associated with that component.
If your application uses a large number of AppDynamics extensions with the Standalone Machine Agent, you may need to increase the size of the memory allocation:
Monitoring Extension Types
You can implement custom metrics using these mechanisms:
- Using a script:
You can write a shell script (Linux and Unix-like systems) or batch file (Windows) to report custom metrics every minute to the Standalone Machine Agent. The Standalone Machine Agent passes these metrics on to the Controller.
See Build a Monitoring Extension Using Scripts
- Using Java:
Your custom metrics may be too complicated to collect using a script. For example, you may need to perform complex calculations or call a third-party API to retrieve the metrics. In this case, you can extend the
JavaServersMonitorclass to collect the metrics and report them to the Standalone Machine Agent. Your Java program extends the
JavaServersMonitorclass to provide your custom functionality.
See Build a Monitoring Extension Using Java
- Using HTTP:
If you enable the Agent HTTP listener, you can post HTTP requests to the Standalone Machine Agent to send it custom metrics every minute. To do this, start the Standalone Machine Agent with a Jetty HTTP listener.
See Machine Agent HTTP Listener