Create and Run Discovery Profile with REST for Performance Management
search cancel

Create and Run Discovery Profile with REST for Performance Management

book

Article ID: 44175

calendar_today

Updated On:

Products

CA Performance Management - Usage and Administration

Issue/Introduction

This article shows how to create a discovery profile through REST and run it.

How to create a Discovery Profile without the Performance Management web UI.

How to create a Discovery Profile with REST.

How to run a Discovery Profile with REST.

Can I create and start a discovery profile through REST?

How to discover devices in the Data Aggregator via the REST API 

Environment

All supported Performance Management releases

Resolution

Create a Discovery Profile 

A discovery profile needs an Tenant ID, IP domain ID, and SNMP Profile ID. In this example we'll use the default options present.

Note: The REST based URLs for the DA in steps 1, 2 and 3 can also be pulled up in a browser tab instead of a REST API client.

1. Find the Default Tenants ID.

Issue an HTTP GET to http://<dahost>:8581/rest/tenants. This will fetch the list of tenants from the DA. Make a note of the Default Tenant’s ID. We’ll call this “daTenantId”. For example, in a support lab the Default Tenant is shown as:

<Tenant version="0.0.0">
<ID>1</ID>
<ChangedOn>1568991597</ChangedOn>
<Name>Default Tenant</Name>
<Activated>true</Activated>
<Culture>en-US</Culture>
<Description>The default tenant area</Description>
<AccountID/>
<Theme>CA-Blue</Theme>
<Flags>0</Flags>
<IsAlso>
<IsA name="SyncableTenant" rootURL="syncabletenant"/>
<IsA name="DataAggregatorTenantMetering" rootURL="datenantmetering"/>
</IsAlso>
</Tenant>

In this example the ID for the "daTenantId" reference value in this example scenario is 1.

2. Find the Default Domains ID.

Issue a HTTP GET to http://<dahost>:8581/rest/ipdomains for a list of IP domains. (To scope the list by tenant, see the reference guide.) 

From the list, make a note of the IP Domain ID of the Default Domain. We’ll call this “daIpDomainId”. For example, in a support lab the Default Domain is shown as:

<IPDomain version="0.0.0">
<ID>2</ID>
<Status>ACTIVE</Status>
<ChangedOn>1568991597</ChangedOn>
<Flags>0</Flags>
<Name>Default Domain</Name>
<DNSProxyEnabled>false</DNSProxyEnabled>
<Description>The default domain for devices, interfaces, interface addresses and networks.</Description>
<IsAlso>
<IsA name="SyncableIPDomain" rootURL="syncableipdomain"/>
</IsAlso>
</IPDomain>

In this example the ID for the "daIpDomainId" reference value in this example scenario is 2.

3. Find the Default SNMP Profile ID. There are two options here. SNMPv1 and v2c Profiles, or SNMPv3 Profiles. In this case we'll use the system default v1 profile.

To find v1 and v2c Profiles issue an HTTP GET to http://<dahost>:8581/rest/profiles/snmpv1

To find v3 Profiles issue an HTTP GET to http://<dahost>:8581/rest/profiles/snmpv3

For example in a support lab the Default SNMP Profile is shown as:

<SNMPv1Profile version="1.0.0">
<ID>1254</ID>
<CommunityName>QUVTOv2rU7kbjNnWycBidE9etgw= </CommunityName>
<PortNumber>161</PortNumber>
<IsAlso>
<IsA name="CommunicationProfile" rootURL="profiles"/>
<IsA name="Syncable" rootURL="syncable"/>
</IsAlso>
<CommunicationProfile version="1.0.0">
<UseForWrite>false</UseForWrite>
<Rank>1</Rank>
<ProfileName>default</ProfileName>
</CommunicationProfile>
<CommunicationFailurePolicy version="1.0.0">
<Retries>2</Retries>
<Timeout>3000</Timeout>
</CommunicationFailurePolicy>
</SNMPv1Profile>

In this example the ID for the "defaultSNMPProfileId" reference value is 1254.

4. Now we can issue a REST POST request to create the new Discovery Profile. We're naming it "Paris" in this example.

Issue a HTTP POST to http://<dahost>:8581/rest/tenant/<daTenantId>/discoveryprofiles with the following content. This is a sample URL using the above info:

http://<dahost>:8581/rest/tenant/1/discoveryprofiles

NOTE: Must scope by tenant – POST’s to http://<dahost>:8581/rest/discoveryprofiles will not work!

Body (successful result): 

<DiscoveryProfile version="1.0.0"> 
<Item version="1.0.0"> 
<Name>Paris</Name> 
</Item> 
<!-- IPRangesList can be omitted if empty --> 
<IPRangesList> 
<IPRanges>x.x.x.1-x.x.x.2</IPRanges> 
</IPRangesList> 
<!-- IPListList can be omitted if empty --> 
<IPListList> 
<IPList>x.x.x.1</IPList> 
<IPList>x.x.x.2</IPList> 
</IPListList> 
<!-- HostNamesList can be omitted if empty --> 
<HostNamesList> 
<HostNames>HostA</HostNames> 
<HostNames>HostB</HostNames> 
</HostNamesList> 
<!-- If omitted, use all SNMP Profiles in Tenant --> 
<SNMPProfileIDList> 
<!-- These ID’s are DA Item ID’s for the profiles --> 
<SNMPProfileID>defaultSNMPProfileId</SNMPProfileID> 
</SNMPProfileIDList> 
<!-- ActivationStatus is required (true/false) --> 
<ActivationStatus>true</ActivationStatus> 
<!-- IcmpDiscoveryEnabled is optional --> 
<IcmpDiscoveryEnabled>true</IcmpDiscoveryEnabled> 
<IPDomainMember version="1.0.0"> 
<!-- DA's IP Domain ID --> 
<IPDomainID>daIpDomainId</IPDomainID> 
</IPDomainMember> 
</DiscoveryProfile> 

This is a sample Body using the above ID's that creates a new Discovery Profile named Paris that will try to discover 2 IPs and has Use ICMP enabled.

<DiscoveryProfile version="1.0.0">
<Item version="1.0.0">
<Name>Paris</Name>
</Item>
<IPListList>
<IPList>x.x.x.x</IPList>
<IPList>x.x.x.x</IPList>
</IPListList>
<SNMPProfileIDList>
<SNMPProfileID>1254</SNMPProfileID>
</SNMPProfileIDList>
<UseListOfSnmpProfiles>true</UseListOfSnmpProfiles>
<ActivationStatus>true</ActivationStatus>
<IcmpDiscoveryEnabled>true</IcmpDiscoveryEnabled>
<IPDomainMember version="1.0.0">
<IPDomainID>2</IPDomainID>
</IPDomainMember>
</DiscoveryProfile>
 

Running a Discovery Profile 

To run the new profile we need to determine it's new ID. Use this URL to list all Discovery Profiles. http://<dahost>:8581/rest/discoveryprofiles. This is the new Paris one we just created.

<DiscoveryProfile version="1.0.0">
<ID>132614</ID>
<IcmpDiscoveryEnabled>true</IcmpDiscoveryEnabled>
<IPListList>
<IPList>x.x.x.x</IPList>
<IPList>x.x.x.x</IPList>
</IPListList>
<SNMPProfileIDList>
<SNMPProfileID>1254</SNMPProfileID>
</SNMPProfileIDList>
<CreatePingables>true</CreatePingables>
<UseListOfSnmpProfiles>false</UseListOfSnmpProfiles>
<RunStatus>READY</RunStatus>
<ActivationStatus>true</ActivationStatus>
<IsAlso>
<IsA name="IPDomainMember" rootURL="ipdomainmember"/>
</IsAlso>
<IPDomainMember version="1.0.0">
<IPDomainID>2</IPDomainID>
</IPDomainMember>
<Item version="1.0.0">
<Name>Paris</Name>
<CreateTime>Thu May 28 9:57:13 2020 -0400</CreateTime>
</Item>
</DiscoveryProfile>

The ID for it is 132614. We'll use that in the next REST call to issue a request to start the profile and run it.

We do that by issuing an HTTP PUT to http://<dahost>:8581/rest/tenant/<daTenantId>/discoveryprofiles/<daDiscoveryProfileId> with the following content.

The sample URL from this scenario example would be:

HTTP PUT:

http://<dahost>:8581/rest/tenant/1/discoveryprofiles/132614

Body: 

<DiscoveryProfile version="1.0.0"> 
<RunStatus>START</RunStatus> 
</DiscoveryProfile>