VMware Smart Assurance : How to discover vCenter in Smarts ESM via CLI and add credentials via CLI/API ?
search cancel

VMware Smart Assurance : How to discover vCenter in Smarts ESM via CLI and add credentials via CLI/API ?

book

Article ID: 345349

calendar_today

Updated On:

Products

VMware

Issue/Introduction

Symptoms:
How to discover vCenter in Smarts ESM via CLI and add credentials via CLI/API ?

Environment

VMware Smart Assurance - SMARTS

Resolution

Below is the function that can be used to add vCenter credential via API:

addCredential( "VIRTUALCENTER","vcenter_host_Name","username","password","","443","TRUE");

 

Below are the commands via CLI:
 
1. Operations on Credential_Util
 
 Administrator@linbgb124 /cygdrive/c/Git_Workspace/ESM_Latest/smarts/install/winnt-x86-64/optimize/bin
$ ./dmctl -b localhost:<broker_port> -s <domain_name> getO Credential_Util | tee

 
Operations for class Credential_Util:
    <object> clone <string>clone_name
    <string> testCredential <string>sType <string>sHost <string>sUserID <string>sPassword <string>sDomain <string>sP
<string>sOp2
    <string> addCredential <string>sType <string>sHost <string>sUserID <string>sPassword <string>sDomain <string>sPo
boolean>sTestBeforeAdding
    <string> addCred <string>sType <string>sHost <string>sUserID <string>sPassword <string>sDomain <string>sPort <bo
n>sTestBeforeAdding <boolean>sEncrypted
    <string> removeCredential <string>sType <string>sHost <string>sUserID <string>sPassword <string>sDomain <string>
t <string>sOp2
    <string> validateExistingCredential <string>sType <string>sHost <string>sUserID <string>sPassword <string>sDomai
tring>sPort <string>sOp2
    <string> configureCredentialsFromFile <string>sFileName
    <structure set> getAllCredentials
    <boolean> insertVeritasPassword <object>param <string>hostName <string>credName
    <boolean> setWMICred <object>wmi <string>sUserName <string>sCredName <string>sDomain
    <boolean> insertJVMPassword <object>jvm <string>credName

 
 
2. Add vCenter credentials on ESM
 
$ ./dmctl -b localhost:<broker_port> -s <domain_name> invoke Credential_Util::Credential-Util addCredential "VIRTUALCENTER" "vcenter_host_Name" "username" "password" " " "443" "TRUE" | tee
 
 
3. To discover the vCenter host on IP server
 
operations on ICF_TopologyManager
 
$ ./dmctl -b localhost:<broker_port> -s <domain_name> getO ICF_TopologyManager | grep create
    <void> create <string>nameOrAddr <string>community <string>snmpState <string>sourceType <unsigned short>snmpPort <st
ring>snmpVersionStr <string>accessMode <string>seedName <string>nameFormat <string>user <string>engineID <string>authPro
tocol <string>privProtocol <string>authPass <string>privPass <string>context <string>accessAddressFormat <string>display
Name <string>systemType <string>domainName <string>sourceAddress

 
$ ./dmctl -b localhost:<broker_port> -s <domain_name> invoke ICF_TopologyManager::ICF-TopologyManager create "vcenter_host_Name" |tee
 

4. To discover the vCenter host on ESM server
 
Write a asl script to invoke the discovery in ESM as given in the sample code
  
tpmgr = object("ICF_TopologyManager","ICF-TopologyManager");
 
AgentAddress = agentObj->AgentAddress;
 
  if (port == "443")
  {
   url = "https://".AgentAddress."/sdk";
  }
  else
  {
   url = "https://".AgentAddress.":".port."/sdk";
  }
 
  paramList = list();
  paramList += list("user",username);
  paramList += list("credname",credName);
  paramList += list("url",url);
  paramList += list("agentAddress",AgentAddress);
 
  tpmgr->addManagedElementWithParamSet(elementName,"VCenterDiscovery",paramList,TRUE);