Hello,
In our environment we currently have a incompatability issue, regarding Operating System and the CCA Agent.
We have virtual machines with RHEL 9 installed and the CCA agent does not support this Operating System.
We have already developed a way to collect information about the hosts, but our current issue is regarding registering the host itself in the platform.
We know of two ways:
- Through the interface, which is a manual process
- Through the SDK, which can be automated using a script.
We have tried to use the documentation available for the SDK, and used the classes and methods available to do this but to no avail.
While trying to register a new host, we always get the error: Cannot add the server "host" : host
Based on what we know, we think it's because it is trying to do an automatic discovery of the machine, but we don't want it to.
So, my question is how can we do this? Our most basic requirement right now is to just register the new machine in the platform without using the manual process via interface. I will paste here the code we are using for reference:
package CCACreateNewServer;
import java.io.*;
import com.ca.acm.sdk.net.SDKException;
import com.ca.acm.sdk.ci.Server;
import com.ca.acm.sdk.net.ACMSDKService;
import com.ca.acm.sdk.ci.*;
public class CCACreateNewServer {
private String url;
private String username;
private String password;
private String server_name;
private String server_ip;
public CCACreateNewServer(final String par_url, final String par_username, final String par_password, final String par_server, final String par_ip) {
this.url = "http://" + par_url + "/services/SDKService";
this.username = par_username;
this.password = par_password;
this.server_name = par_server;
this.server_ip = par_ip;
}
public void AddNewServer() throws SDKException {
try {
System.out.println(">> Locating service for the url: " + this.url);
if (ACMSDKService.locateService(this.url)) {
System.out.println(">> Trying to begin session...\n");
if (ACMSDKService.beginSession(this.username, this.password)) {
ACMSDKService.setSessionTimeOut(60);
System.out.println(">> Session has been started. Timeout was set to 60 minutes...");
Server sv = null;
sv = new Server();
sv.setAttribute("srvr_name", this.server_name);
sv.setAttribute("ip_addr", this.server_ip);
sv.setAttribute("os_name","Linux");
if (this.server_ip.indexOf(":") >= 0) {
sv.setAttribute("ipv6_addr", this.server_ip);
} else {
sv.setAttribute("ipv4_addr", this.server_ip);
}
Server serverObj = (Server)sv.add();
String Id = null;
Id = serverObj.getId();
if (serverObj.getId() != "-1") {
System.out.println("Server Success");
}
}
}
}
catch (Exception ex) {
System.out.println("\n" + ">> Exception ex: <<" + "\n" + ex);
}
finally {
ACMSDKService.endSession();
System.out.println("\n" + ">> Session ended <<");
}
}
public static void main(final String[] args) throws SDKException {
System.out.println("\n\n>>>>> Program CCACreateNewServer FS has been started! <<<<<\n");
final CCACreateNewServer CreateServer = new CCACreateNewServer(
"url:port",
"username",
"password",
"host",
"ip_addr"
);
CreateServer.AddNewServer();
System.out.println(">>>>> Program Ended! <<<<<\n");
}
}
Can anyone help with this please?