The purpose of this monitor is to use arbitrary queries against a SQL database as metrics for AppDynamics. The connection to the database is via JDBC. One instance of the SQLMonitor will connect to one JDBC Datasource, if multiple Datasources are required run multiple instances of SQLMonitor.
1. Download and unzip SQLMonitor.zip from AppSphere.
2. Copy the SQLMonitor directory to `<MACHINE_AGENT_HOME>/monitors`.
You will need to provide your own JDBC driver for the database you want to connect to.
Put the driver JAR file in the same directory and add it to the classpath element in the monitor.xml file.
Please make sure to not use tab (\t) while editing yaml files. You may want to validate the yaml file using a yaml validator http://yamllint.com/
1. Configure the SQL server instances by editing the config.yaml file in `<MACHINE_AGENT_HOME>/monitors/SQLMonitor/`. Below is the format
metricPrefix: "Custom Metrics|SQL|"
2. Configure the path to the config.yaml file by editing the <task-arguments> in the monitor.xml file. Below is the sample
<task-arguments> <!-- config file--> <argument name="config-file" is-required="true" default-value="monitors/SQLMonitor/config.yml" /> .... </task-arguments>
Only queries that start with SELECT are allowed.!
The queries to get the metric values from the database should only return one row and one column, additional rows and columns will be ignored. The name of the metric will be the first column name return by the query.
select value as count from statistics where uuid = 472
displayPrefix helps to give better visualization on schema name or table name for particular sql metric.
- command: "select foo as foobar from bar where id = 10"
- command: "select foo as foobar from bar where id = 5"
Always feel free to fork and contribute any changes directly via GitHub.
For any support questions, please contact firstname.lastname@example.org.