Hi, Im new for appdynamics.
The thing is I want to configure the database collector automatically through the Database Monitoring API , insteed of use the GUI in the appdynamics controller. I followed the appdynamics doc : https://docs.appdynamics.com/display/PRO42/Use+the+Database+Monitoring+API+to+Configure+Collectors, it worked with getting the collector information, but not work with creating collector.
My database collector creating command is :
curl --user <controller_user>@<account_name>:<password> http://<controller_ip>:<port>/controller/rest/databases/collectors/create -H "Accept: application/json" -H "Content-type: application/json" -X POST -d "{'json':{'data':'[{'config':{'name':'<db_name>','type':'MONGO','hostname':'<db_hostname>','enableOSMonitor':false,'hostUsername':'<username>','hostPassword':'<password>','port':<db_port>,'loggingEnabled':true}}]'}}"
and the response is :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>Error report</title><style type="text/css"><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - </h1><hr/><p><b>type</b> Exception report</p><p><b>message</b></p><p><b>description</b>The server encountered an internal error () that prevented it from fulfilling this request.</p><hr/></body></html>
I have no idea why, Do I need to configure some setting to allow creating collector via curl or is my curl command wrong?
It works now. The JSON shouldn't contain the feild name id and use \" to separate each field value.
so the JSON format would look like this :
"{\"version\":0,\"name\":\"<db_name>\",\"nameUnique\":true,\"builtIn\":false,\"createdBy\":\"admin\",\"createdOn\":1477638562524,\"modifiedBy\":\"admin\",\"modifiedOn\":1477638562524,\"type\":\"MONGO\",\"hostname\":\"<db_host>\",\"useWindowsAuth\":false,\"username\":\"<user>\",\"password\":\"<password>\",\"port\":<port>,\"loggingEnabled\":false,\"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\":null,\"certificateAuth\":false,\"removeLiterals\":true,\"sshPort\":0,\"agentName\":\"Default Database Agent\"}"