CA APM Grafana APMSQL queries

Document ID : KB000117748
Last Modified Date : 18/10/2018
Show Technical Document Details
Introduction:
Grafana integration with CA APM is a new feature in CA APM 10.7 SP2
https://docops.ca.com/ca-apm/10-7/en/ca-apm-release-notes/release-comparison
https://docops.ca.com/ca-apm/10-7/en/integrating/apmsql-cookbook/using-grafana-with-ca-apmsql
This article discusses some of the requirements when submitting queries from Grafana
Environment:
APM 10.7 SP2 
Grafana reporting tool: https://grafana.com/grafana
Instructions:
1. <agent_specifier regex> 
The traditional agent specifier regex is a combination of agent_host, agentnt_process and agent_name i.e. 'agent_host|agent_process|agent_name'
However for the query via Grafana the agent specifier regex is built only around the agent_name.
Therefore simply using the exact 'agent_name" will ensure a match e.g for agent name "SCCD-Server01" e.g.
apmsql 'SCCD-Server01' 'Frontends|Apps|%:Responses Per Interval' agg_value exact
Also using a partial agent_name with regex wildcards at either or both ends should also work e.g.
apmsql 'SCCD.*' 'Frontends|Apps|%:Responses Per Interval' agg_value exact

agwnt_name example query


2. Handling special characters in agent names
When querying for example agent names like "Custom Metric Agent (Virtual)*" the parentheses need to be escaped
However a simple escape with single '\' is not enough when using Grafana because it strips it out. Therefore a double escape '\\' is needed e.g.
a. MOM with agent name: Custom Metric Agent (Virtual)
apmsql 'Custom Metric Agent \\(Virtual\\)' 'Enterprise Manager|Health:Heap Capacity (%)' agg_value exact
b. Collector with agent name: Custom Metric Agent (Virtual) (willy03-I2438@25001)
apmsql 'Custom Metric Agent \\(Virtual\\) \\(willy03-I2438@25001\\)' 'Enterprise Manager|Health:Heap Capacity (%)' agg_value exact

MOM and Collector example queries

 
Additional Information:
This was discussed in detail in CA APM Community post "No data points (grafana+apmsql)": 
https://communities.ca.com/message/242148374-re-no-data-points-grafanaapmsql