What is included:
There are two Python script files and three PowerShell script files. The Powershell scripts are used to gather the data that needs to be pushed to vROPs.
The Python files are used to process and push the data to vROps
These programs were written in Python2.7 and Powershell 5.0 versions.So your system should have Python 2.7 and Powershell 5.0. Also, download and install the nagini module from vRealize Operations Manager. It can be found at “https:///suite-api” . Visit the page, download and install the Python Client. Typically Windows boxes don’t have Python installed in it. Download and install Python 2.7.x version on your Windows machine.
How to run:
Download all the files to the same location. The program has three parts.
Part 1: Setting up the environment:
For the first time run, Set-VCdetails.ps1 using PowerShell. You can simply open PowerShell windows and run the script with C:\ .\Set-VCdetails.ps1
This will ask you for the following information:
- vCenter Server Name:
- vCenter User Id:
Once this information is provided, it will create vcdetails.txt (contains vCenter server name and user name) and passwd.txt (contains the password in encrypted format).
Next run set-env.py file. You can run it like following:
#python set-env.py, this will ask for the following inputs:
- Adapter Kind:
- Resource Kind:
- vROPs server IP/FQDN:
- user id:
- vROps password:
Once all the above information is provided, the script generates env.json in the same location. The provided password is saved in encrypted format.
Part 2: Getting the data from vCenter server:
Run the “Get-VMDetails.ps1” file with PowerShell cmdline. This will get values from vcdetails.txt and passwd.txt file and generate data.json file in the same location. This data.json will have the desired output values.
Part 3: Pushing the data to vROps server:
Next run data-push.py from cmdline with #python data-push.py. This will gather required information from env.jon, data.json and push data to vROps server
You should schedule two jobs, one for Get-VMDetails.ps1 and another for data-push.py to run these scripts one after other.
Check the format of the data-push.json file to further utilize the data.
Points to Note:
Though this has specific use cases implemented, you should be able to easily modify the scripts to suit your need.