cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Create Oracle Database via REST

Josh.Fox
Creator

Hello,

I am trying to create an Oracle database collector with the REST API. I don't seem to be able to get it working. The example online is of a SQL server, so I was hoping someone could please provide an example of an Oracle server JSON payload. Below is what I get if I do a GET. Also, our controller version is 4.5, so not sure if maybe that is part of the problem. The error I get is just a generic 500 Internal Server Error.

{
"id": 42,
"version": 0,
"name": "Oracle-OLTP",
"nameUnique": true,
"builtIn": false,
"createdBy": null,
"createdOn": 1531336844000,
"modifiedBy": null,
"modifiedOn": 1531336844000,
"type": "ORACLE",
"hostname": "Oracle-OLTP.domain",
"useWindowsAuth": false,
"username": "USER",
"password": "appdynamics_redacted_password",
"port": 1521,
"loggingEnabled": true,
"enabled": true,
"excludedSchemas": [
""
],
"jdbcConnectionProperties": [],
"databaseName": null,
"failoverPartner": null,
"connectAsSysdba": false,
"useServiceName": true,
"sid": "SRVC",
"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": "Default Database Agent",
"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": [],
"jmxPort": 0
}
2 REPLIES 2

Hiroki.Ito
AppDynamics Team
Hi @Josh.Fox ,

Thank you for posting to the community.

Although some keys such as id, version, createdOn and modifiedOn are unnecessary, The JSON you posted may be able to create Oracle database collector with the REST API, because it worked with version 4.5.17.

Could you confirm if you are using a curl command like below?
curl -X POST --user {username}@{account_name}:{password} "{Controller_URL}/controller/rest/databases/collectors/create" -H"Accept: application/json" -H"Content-type: application/json" -d @{PATH_TO_JSON_FILE}

In addition, could you please share what is shown in the controller's log located at <controller_home>/logs/server.log
after executing the API and get 500 Internal Server Error?
The log can be searched by "Exception Id" returned by the API
 
e.g.
  • API Response
<html><body><h1>500 Internal Server Error</h1><br/>Exception Id:d9aeaa41-ce82-4965-a4f1-211b17235ee5<br/></body></html>

  • server.log
[#|2021-07-02T04:37:51.653+0000|SEVERE|glassfish 4.1|com.singularity.ee.controller.servlet.handlers.aa|_ThreadID=49;_ThreadName=http-listener-1(4);_TimeMillis=1625200671653;_LevelValue=1000;|500 Error with Exception Id: d9aeaa41-ce82-4965-a4f1-211b17235ee5 and Class Name: java.lang.NullPointerException
java.lang.NullPointerException
...

Best Regards,
Hiroki

Found something helpful? Click the Accept as Solution button to help others find answers faster.
Liked something? Click the Thumbs Up button.

Hello, thanks for the response, this is super helpful. I got this working with some help. Here is the working JSON payload:

 

{
"type": "ORACLE",
"agentName": "Default Database Agent",
"name": "MYTest",
"hostname": "MYTest.domain",
"enterpriseDB": false,
"failoverPartner": null,
"port": 1521,
"customConnectionString": null,
"useServiceName": true,
"sid": "SRVCID",
"connectAsSysdba": false,
"username": "USER",
"password": "password",
"loggingEnabled": true,
"enableOSMonitor": false,
"hostOS": null,
"useLocalWMI": false,
"hostDomain": null,
"sshPort": 0,
"certificateAuth": false,
"hostUsername": null,
"hostPassword": ""
}
 
Hope this saves the next person some time. The 'type' field has to be all caps. I believe these are all the required fields but not absolutely sure on this.