Monitor Consul with AppDynamics CNS
Consul produces a range of metrics in various formats, which enables operators to measure the health and stability of a datacenter, and diagnose or predict potential issues.
This tutorial will show you how to use the HashiCorp Consul Monitoring Extension for AppDynamics CNS to collect Consul telemetry data and node information.
The integration enables you to collect information about HashiCorp Cloud Platform (HCP) Consul environments through Consul client agents. AppDynamics CNS is also HCP Consul Verified. You will install AppDynamics Machine Agent on the Consul agents and use statsite as a metrics aggregator to collect node telemetry metrics.
The extension provides you with two example dashboards that will be imported into your AppDynamics controller.
Prerequisites and configuration
In order to complete this tutorial the following prerequisites need to be satisfied:
- A running Consul or HCP Consul datacenter to monitor with AppDynamics.
- An AppDynamics SaaS or On-Prem controller version 4.5 or greater.
- The Consul agents that are being monitored will also need to meet AppDynamics Machine Agent requirements and supported environments.
Setup monitoring
You will perform the integration in four steps:
- Install AppDynamics Machine Agent including the JRE on the Consul nodes.
- Install HashiCorp Consul Monitoring Extension for AppDynamics CNS.
- Build and install statsite (which is a metrics aggregator like statsd) to collect node metrics.
- Configure Consul to send telemetry data to the AppDynamics agent.
Install AppDynamics Machine Agent bundle
To integrate your Consul datacenter with AppDynamics you will install and configure the AppDynamics Machine Agent on all the nodes you want to monitor and configure Consul to send telemetry data to it.
Download the AppDynamics Machine Agent Bundle.
As
root
or super user, unzip and setup the service file.An official installation guide is available on the AppDynamics documentation website
Configure the AppDynamics Machine Agent to communicate with the controller when running in standalone mode.
Note, this requires editing the controller file
controller-info.xml
. You will need to obtain your AppDynamics Controller access information and configure it incontroller-info.xml
file before you begin the steps below. Refer to configure the Standalone Machine Agent for the configuration reference.It is highly recommended to increase the value of
maxMetrics
so that data doesn't get truncated. Add Java options in AppDynamics agent service definition to increase the value ofmaxMetrics
.
Configure AppDynamics machine agent for Consul telemetry
Now that the agent is configured you can install the monitoring extension for AppDynamics CNS.
Clone the consul-appd-extension repo and copy the contents of folder
statsite
into /opt/appdynamics/machine-agent/monitors/StatSite
:
Compile and install statsite
The extension uses statsite to import statsd Consul metrics into AppDynamics. To achieve this, it will need a statsite executable embedded in the agent folder. This following sections demonstrate how to build statsite for your nodes.
Due to the amount of dependencies necessary to successfully build statsite it is recommended to perform the build activity on a machine different from the Consul agents to avoid dependency issues or installing un-necessary software on the nodes. Once the build is completed you can distribute the binary to the Consul nodes to perform the integration.
Install dependencies
This tutorial provides you with commands to perform the build for different Linux flavors but you should refer to the official statsite installation guide to find the best set of steps for your OS.
Compile
Install
The installation will require you to copy the statsite
executable into
/opt/appdynamics/machine-agent/monitors/StatSite
for every node you want to
monitor.
Configure Consul to send metrics to statsite
The last step in the integration is to configure your Consul agents to send their telemetry data to AppDynamics CNS via statsite.
You can apply it to Consul by copying the file into your Consul configuration folder and then by performing a rolling restart of all the nodes that will use the integration.
Display telemetry Metrics
For a complete list of Consul metrics supported by these integrations, as well as details on what each metric means, consult the Consul telemetry documentation.
Note
The AppDynamics Integration with HCP Consul collects a subset of Consul's default metrics that do not pertain to server health.
Finding metrics
All metrics reported by the extension will be available in the Metric Browser
at Controller > Applications > Application > Metric Browser
.
Application Infrastructure Performance > Consul > Custom Metrics > statsd > consul
lists the available Consul metrics:
Application Infrastructure Performance > Consul > Custom Metrics > statsd > envoy
lists metrics available for the Connect service mesh.
Custom dashboard
The extension repository provides two custom dashboards to get you started on
monitoring Consul. They are located in the dashboards
folder.
To import the dashboards:
- Log into your AppDynamics controller. Select the
Dashboards & Reports tab > Dashboards > Import
. - Upload the
.json
dashboard file.
Once uploaded the dashboards will be available in the Dashboard & Reports tab
.
Note
You will need to change the value for the key applicationName
within the templates to match your application name.
Custom health rules
AppDynamics CNS provides the ability to customize health rules, the policy statements that define triggers. Health rules for Consul are created against the applications that are using its service discovery and service mesh so that the metrics for the application as well as Consul can be seen against particular applications in AppDynamics.
Next steps
In this tutorial you learned how to integrate AppDynamics machine agent with Consul and HCP Consul to collect metrics and import custom dashboards into AppDynamics CNS to have a monitoring starting point and consider your options for visualizing, aggregating, and alerting on those metrics.
For more information on how to personalize your dashboards you can refer to AppDynamics documentation for creating custom dashboards.