There are cases where CA PM administrators need the ability to export Discovery Profiles (DP) from Data Aggregator for later import into the same or another instance.
Use cases include
- Transfer DP from test to production system
- Cleanup profiles
- Export DP for scripted updates (like adding/removing hosts, changing SNMP profiles etc)
- Broken DA/DR and the need to set up a new instance
Two Perl scripts are provided: exportProfiles.pl and importProfiles.pl.
Both scripts use the DA REST interface to access the following entities:
- SNMP profiles: retrieved to lookup the profile name (during export) and profile id (during import)
- IP Domain list: retrieved to lookup the profile name (during export) and profile id (during import)
- Discovery Profiles: retrieved and saved to xml file during export; created from xml file during import
SNMP profiles and IP Domains are not exported/imported. They are hosted by CA PC and we assume they exist on the target system under the same name.
They are as well covered by mysql netqosportaldb export/import.
While the names are the same in export and import environment, the IDs could differ. During export, an association file is created with the SNMP profile name and IP Domain name for each Discovery Profile. During import, the SNMP and Domain IDs are being looked up on the target system, they replace the stored IDs in the discovery profile for the import.
The scripts operate only for the single default tenant.
- Perl 5.18 or better
- Modules REST::Client, XML::LibXML
- Access to http://DA-HOST:8581/rest
Both scripts have been tested with Strawberry Perl on Windows and are in use by customers.
perl exportProfiles.pl DA-HOST:8581 discPrfExp.xml profileAssociations.csv
DPName, ID, Name, ID, Type
perl importProfiles.pl DA-HOST:8581 discPrfExp.xml profileAssociations.csv
DPname, Name, ID, valid, Type
DPname --------------------------------------- POST: RC
DPwithv3, Default Domain, 2, 1, DOMAIN
DPwithv3, sysedge, 2112, 1, SNMP
DPwithv3, v3Prof2, 2146, 2, SNMP
DPwithv3, v3Prof1, 2145, 3, SNMP
DPwithv3 --------------------------------------- POST: 200
Discovery profile export file: discPrfExp.xml
Associations file: profileAssociations.csv
discovery profiles to import: out- discPrfExp.xml (importProfiles.pl)
Testing options for importProfiles.pl
- Pass 4th parameter (hidden debug switch) with value 1 or 2:
o 1: Write generated Discovery Profiles to file only, no POST to DA
(output: not POSTed)
o 2: Append “-2” to the Discover Profile name, e.g. for import into same DA
Error handling during import
- If SNMP profile names or IP Domain names that are saved in the associations file cannot be found on the target system, the discovery profile is not valid and does not get imported
Your feedback is appreciated so please post any comments in this thread. As with all free Infrastructure Management Field Developed Utility postings, inquiries should be made through questions or comments in this thread, and the author, Lutz_Holzbecher, will provide a response.
All information downloaded or accessed (including field packs, customized solutions, patches etc.) are provided AS IS and no warranties are provided or made. For more information you may click here.