This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Modify Credential Resource Mapping with a script.

Hi, I am trying to automate the creation of agents to monitor Linux servers. I have a script that runs external to foglight, that gets a list of all the servers, then compares it to all the agents already running, and if there is a server with out an agent, it calls the rest api to run a script to create the agent and set the agent properties. It then does another rest api call to run a script that activates the agent. This part work, but then the agent shuts itself down, and has the below errors in the logs.

Unable to connect to host "XXX.XX.XXX.XXX"
com.quest.glue.api.services.NoCredentialsException: No credentials were provided to establish a connection to host XXX.XX.XXX.XXX

I think this means it is not picking up the credentials. So I manually edited the resource mapping in the credentials to include the ip address of some of the servers, and the agent for those started working. I am now trying to write a script internal to foglight that will edit the resource mapping of the credential, with the intent of running it through the rest api, and passing it the ip that needs to be added. I have tried sever things with out any luck. It seems like I need to be able to get the object of the credential I want to modify, but I am don't know how to do that. It seems like I should be using the methods in the CredentialDataAccessService CredentialDataQuery interfaces but I can't get them to work. Below is how is seems to me is should be laid out to get the creds, but I can not get it to work.

CredentialDataAccessService.createRequesterInfo()
CredentialDataAccessService.createQuery(RequesterInfo clientInfo)
CredentialDataQuery.setSourceAddress(java.net.InetAddress address)
CredentialDataAccessService.executeQuery(CredentialDataQuery query)

I think if I can get those working I should have the object for the credentials right? I should then be able to use other methods that require the credentials id. How do I do this? Am I even going about is the right way?