Download PDF
Download page Database Visibility API.
Database Visibility API
Use the Database Visibility API to get, create, update, and delete Database Visibility Collectors.
Include the following headers for all Database Visibility API requests:
Accept: application/json; Content-type: application/json
JSON is currently the only supported format.
Get all Collectors
GET /controller/rest/databases/collectors
Get a Specific Collector
GET /controller/rest/databases/collectors/{configurationId}
Create a Collector
POST /controller/rest/databases/collectors/create
The JSON you send must contain the relevant Collector information. The required fields describing the Collector vary based on the type of database. See the table in the "UI Collector versus JSON Collector Configuration Field Names" section that follows for more information.
Below is a sample JSON request payload:
{
"type":"MYSQL",
"name":"localdocker_dbagent-MySQLCollector",
"hostname":"mysql",
"port":"3306",
"username":"root",
"password":"appdynamics_redacted_password",
"enabled":true,
"excludedSchemas":null,
"databaseName":null,
"failoverPartner":null,
"connectAsSysdba":false,
"useServiceName":false,
"sid":null,
"customConnectionString":null,
"enterpriseDB":false,
"useSSL":false,
"enableOSMonitor":false,
"hostOS":null,
"useLocalWMI":false,
"hostDomain":null,
"hostUsername":null,
"hostPassword":"",
"dbInstanceIdentifier":null,
"region":null,
"certificateAuth":false,
"removeLiterals":true,
"sshPort":0,
"agentName":"localdocker_dbagent",
"dbCyberArkEnabled":false,
"dbCyberArkApplication":null,
"dbCyberArkSafe":null,
"dbCyberArkFolder":null,
"dbCyberArkObject":null,
"hwCyberArkEnabled":false,
"hwCyberArkApplication":null,
"hwCyberArkSafe":null,
"hwCyberArkFolder":null,
"hwCyberArkObject":null,
"orapkiSslEnabled":false,
"orasslClientAuthEnabled":false,
"orasslTruststoreLoc":null,
"orasslTruststoreType":null,
"orasslTruststorePassword":"",
"orasslKeystoreLoc":null,
"orasslKeystoreType":null,
"orasslKeystorePassword":"",
"ldapEnabled":false,
"customMetrics":null,
"subConfigs":[
{
"type":"MYSQL",
"name":"localdocker_dbagent-MySQLCollector sub-collector",
"hostname":"mysql-remote",
"port":"3388",
"username":"root",
"password":"different-password",
"enabled":true,
"excludedSchemas":null,
"databaseName":null,
"failoverPartner":null,
"connectAsSysdba":false,
"useServiceName":false,
"sid":null,
"customConnectionString":null,
"enterpriseDB":false,
"useSSL":false,
"enableOSMonitor":false,
"hostOS":null,
"useLocalWMI":false,
"hostDomain":null,
"hostUsername":null,
"hostPassword":"",
"dbInstanceIdentifier":null,
"region":null,
"certificateAuth":false,
"removeLiterals":true,
"sshPort":0,
"agentName":"localdocker_dbagent",
"dbCyberArkEnabled":false,
"dbCyberArkApplication":null,
"dbCyberArkSafe":null,
"dbCyberArkFolder":null,
"dbCyberArkObject":null,
"hwCyberArkEnabled":false,
"hwCyberArkApplication":null,
"hwCyberArkSafe":null,
"hwCyberArkFolder":null,
"hwCyberArkObject":null,
"orapkiSslEnabled":false,
"orasslClientAuthEnabled":false,
"orasslTruststoreLoc":null,
"orasslTruststoreType":null,
"orasslTruststorePassword":"",
"orasslKeystoreLoc":null,
"orasslKeystoreType":null,
"orasslKeystorePassword":"",
"ldapEnabled":false,
"customMetrics":null
}
]
}
Update a Collector
- Make a GET request for the collector that you want to update.
- Copy the JSON response body that is returned by the GET request to a text editor, and modify the fields that you want to update.
Make a POST request for the collector that you want to update, and include the updated JSON.
POST /controller/rest/databases/collectors/update
CODEBelow is a sample JSON request payload:
{ "id":1, "type":"MYSQL", "name":"localdocker_dbagent-MySQLCollector", "hostname":"mysql", "port":"3306", "username":"root", "password":"appdynamics_redacted_password", "enabled":true, "excludedSchemas":null, "databaseName":null, "failoverPartner":null, "connectAsSysdba":false, "useServiceName":false, "sid":null, "customConnectionString":null, "enterpriseDB":false, "useSSL":false, "enableOSMonitor":false, "hostOS":null, "useLocalWMI":false, "hostDomain":null, "hostUsername":null, "hostPassword":"", "dbInstanceIdentifier":null, "region":null, "certificateAuth":false, "removeLiterals":true, "sshPort":0, "agentName":"localdocker_dbagent", "dbCyberArkEnabled":false, "dbCyberArkApplication":null, "dbCyberArkSafe":null, "dbCyberArkFolder":null, "dbCyberArkObject":null, "hwCyberArkEnabled":false, "hwCyberArkApplication":null, "hwCyberArkSafe":null, "hwCyberArkFolder":null, "hwCyberArkObject":null, "orapkiSslEnabled":false, "orasslClientAuthEnabled":false, "orasslTruststoreLoc":null, "orasslTruststoreType":null, "orasslTruststorePassword":"", "orasslKeystoreLoc":null, "orasslKeystoreType":null, "orasslKeystorePassword":"", "ldapEnabled":false, "customMetrics":null, "subConfigs":[ { "id":2, "type":"MYSQL", "name":"localdocker_dbagent-MySQLCollector sub-collector", "hostname":"mysql", "port":"3388", "username":"root", "password":"appdynamics-redacted-password", "enabled":true, "excludedSchemas":null, "databaseName":null, "failoverPartner":null, "connectAsSysdba":false, "useServiceName":false, "sid":null, "customConnectionString":null, "enterpriseDB":false, "useSSL":false, "enableOSMonitor":false, "hostOS":null, "useLocalWMI":false, "hostDomain":null, "hostUsername":null, "hostPassword":"", "dbInstanceIdentifier":null, "region":null, "certificateAuth":false, "removeLiterals":true, "sshPort":0, "agentName":"localdocker_dbagent", "dbCyberArkEnabled":false, "dbCyberArkApplication":null, "dbCyberArkSafe":null, "dbCyberArkFolder":null, "dbCyberArkObject":null, "hwCyberArkEnabled":false, "hwCyberArkApplication":null, "hwCyberArkSafe":null, "hwCyberArkFolder":null, "hwCyberArkObject":null, "orapkiSslEnabled":false, "orasslClientAuthEnabled":false, "orasslTruststoreLoc":null, "orasslTruststoreType":null, "orasslTruststorePassword":"", "orasslKeystoreLoc":null, "orasslKeystoreType":null, "orasslKeystorePassword":"", "ldapEnabled":false, "customMetrics":null } ] }
CODE
The JSON you send must contain all the details of the existing collector with only the fields that you want to modify changed. To ensure you have all the fields, use the Get a Specific Collector call.
To add a new sub-collector to an existing collector, provide the sub-collector details without the id
field.
Delete a Specific Collector
DELETE /controller/rest/databases/collectors/{configurationId}
Below is an example of a delete request.
DELETE /controller/rest/databases/collectors/{1}
Batch Delete Multiple Collectors
POST /controller/rest/databases/collectors/batchDelete
Send an array of the configuration Ids of the Collectors.
Below is an example of a batch delete command.
curl --user {username}@{account_name}:{password} -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '[1,2,3]' {Controller_URL}/controller/rest/databases/collectors/batchDelete
Get All Monitored Database Servers
GET /controller/rest/databases/servers
Example
curl --user {username}@{account_name}:{password} {Controller_URL}/controller/rest/databases/servers
The output is a list of database servers and their details.
Get Database Server Details
GET /controller/rest/databases/servers/{dbserver_id}
Example
curl --user {username}@{account_name}:{password} {Controller_URL}/controller/rest/databases/servers/{dbserver_id}
The output contains a list of the database's details, including name, node ID, and database type.
Get all Database Agent Events
GET /controller/rest/applications/_dbmon/events
For a list of query string parameters, see Retrieve Event Data.
Example
curl --user {username}@{account_name}:{password} {Controller_URL}/controller/rest/applications/_dbmon/events?time-range-type=BEFORE_NOW&duration-in-mins=30&event-types=%20AGENT_EVENT,DB_SERVER_PARAMTER_CHANGE&severities=INFO,WARN,ERROR
The output gives you a list of events. For each event element, you can determine the node that the event is mapped to by looking for the entity-definition element.
Get all Database Monitoring Application Nodes
GET /controller/rest/applications/_dbmon/nodes
Example
curl --user {username}@{account_name}:{password} {Controller_URL}/controller/rest/applications/_dbmon/nodes
UI Collector versus JSON Collector Configuration Field Names
Use the table below to ensure you use the correct field names for your API calls. The Collector configuration field names are described in Configure the Database Agent to Monitor Server Hardware and Add Database Collectors.
Section | UI Collector Configuration Field Name | JSON Collector Configuration Field Name |
---|---|---|
id (AppDynamics assigns this ID to the Collector when you configure the Collector. You need this ID when doing a batch delete.) | ||
Database Type | type | |
Database Agent | agentName | |
Database | name | |
Connection Details | Hostname/IP Address | hostname |
EnterpriseDB | enterpriseDB | |
Failover Partner | failoverPartner | |
Listener Port | port | |
Custom JDBC Connection String | customConnectionString | |
Use Service Name | useServiceName | |
SID or SERVICE_NAME | sid | |
Connect as a sysdba | connectAsSysdba | |
Username | username | |
Password | password | |
Logging Enabled | ||
Hardware Monitoring | Monitor Operating System | enableOSMonitor |
Operating System | hostOS | |
Use Local WMI | useLocalWMI | |
Domain | hostDomain | |
SSH Port | sshPort | |
Use certificate | certificateAuth | |
Username | hostUsername | |
Password | hostPassword |
SSL field
In addition to JSON Configuration Fields listed above, there is also the ssl field. SSL is a configurable property for the Database Agent. If the Database Agent has been configured to use SSL, then you must also provide the ssl field and its value in your Database Visibility API calls.