DX NetOps Manager

 View Only

Free script to run discovery in command line in CA Performance Center 

Oct 19, 2015 08:22 PM

Summary

This document describes a custom perl script that you can use to run discovery using command line. You will need the name of the discovery profile, username and password for DA rest client.

 

Background

Although there is a scheduling option for managing discovery profiles, this script will give more flexibility for running discovery profiles.

 

Approach

A Perl script is provided, that kick starts discovery.

 

This script can be run from any machine which has Strawberry perl and a valid connection to Data Aggregator using rest client.

 

1. Issue aHTTP PUT to http://<dahost>8581/rest/tenant/<daTenantId>/discoveryprofiles/<daDiscoveryProfileId> with the following content:

Body:

  <DiscoveryProfile version="1.0.0">

  <RunStatus>START</RunStatus>

  </DiscoveryProfile>

2. Print discovery status as Discovery complete if a "200 OK" is the return content in the PUT


Check the status of a discovery

You can periodically check the status of a running discovery.

1. Issue an HTTP GET to http://<dahost>8581/rest/discoveryprofiles/<daDiscoveryProfileId>.

2. Check the “RunStatus” value in the response. A “READY” or “SCHEDULED” status means that the discovery is complete.

 

Prerequisites

- Perl installed (tested with Strawberry Perl 5.18)

- Perl modules REST::Client, XML::Simple, MIME::Base64;

- access to the Data Aggregator REST webservice http://DA:8581/rest

 

Support

There is no support for this script. It has to be run at YOUR risk. See terms and conditions before running this script here (Terms for User sites - CA Technologies). Please email Seenu_Mathew (seenu.mathew@ca.com) for any feedback on this script.

 

Usage of runDiscovery.pl is as follows

 

  -h <hostname or ip address of CA Data Aggregator + port> eg: dahost:8581

  -u <Username that has access to DA (usually admin)>

  -p <Password>

  -n <Name of Discovery Profile>


Example:

1. perl runDiscovery.pl -h DataAggregatorHostname:8581 -user admin -pass admin -n "Routers DiscProfile""

  The above command will run the discovery profile with the name Routers DiscProfile on the default tenant with id 1

Statistics
0 Favorited
10 Views
1 Files
0 Shares
4 Downloads
Attachment(s)
zip file
runDiscovery.pl.zip   2 KB   1 version
Uploaded - May 29, 2019

Tags and Keywords

Comments

Nov 07, 2018 05:06 PM

I have a work around to GET the itemId of the device, and then PUT the nameAlias.

ex.

GET THE DEVICE ID to manipulate by IP ADDRESS:

xml=`curl -k -v -uobscureuserID:securepassword https://PC.cso.domain.com:8181/pc/center/webservice/devices/ | grep -b1 192.112.230.151`; xml2=`echo ${xml##*<itemId>}` ; itemId=`echo $xml2 | cut -d"<" -f1`

 

The above leaves me with a variable  $itemId required for the next command. 

USE a   PUT   to set the ALIAS for a device.
curl -k -v -uobscureuserID:securepassword -X PUT -H "Content-Type: text/xml"  +   https://PC.cso.domain.com:8181/pc/center/webservice/devices/deviceItemId/$itemId/aliasName/NEW-SERVER-ALIAS-NAME

Nov 07, 2018 11:36 AM

Does anyone use this and find that the newly discovered device becomes Active and reachable, but has no hostname or alias name?    I have to log into the GUI, and go to managed devices, and click the "REDISCOVER" button for it to resolve the host name.   This seems like I must be doing something wrong.    Everything works perfectly except the device name shows up blanks.    Any thoughts ?

Oct 27, 2015 09:47 AM

Thank you for sharing this with the community Seenu_Mathew

Related Entries and Links

No Related Resource entered.