0

Running vROpsCLI on Windows

vRealize Operations Manager can be easily configured manually using the UI. But if you’re looking to make large scale changes, then you’re also looking at a large time investment. Thankfully our friends at Blue Medora (Steve Miller and Mark Arbogast to be specific) released an open source solution to automate vROps configuration tasks. Steve published a blog post with some example use cases.

The purpose of this blog post is to outline the process of running vROpsCLI on a Windows PC. vROpsCLI has two dependencies, Python, and Pipenv. I’ll walk you through the installation of both.

First, download and install Python from https://www.python.org/

Be sure to select Add Python 3.x to PATH

If you don’t, then you can create a new system variable called PYTHON_HOME with the value matching the path of your Python install folder. In my case, that’s C:\Users\mbradford\AppData\Local\Programs\Python\Python37-32. You could skip this step and just add the full path to the path variable, but this is cleaner as I’ll be adding more than one path.

Double click on the Path system variable.

Enter the following values

%PYTHON_HOME%

%PYTHON_HOME%\Scripts\

And while we’re here we’ll add the location where pipenv will install to. Complete this step even if you clicked the Add Python 3.x to Path option during install. C:\Users\username\AppData\Roaming\Python|Python37\Scripts

Launch Powershell and upgrade pip by entering “pip install –upgrade pip”

Install pipenv by entering the following “pip install –user pipenv”

Download vROpsCLI from https://github.com/BlueMedoraPublic/vropscli

Unzip the contents into a folder. In this case I used c:\vROps CLI\.

If you don’t wish to enter your credentials each time you run vROpsCLI then create a file in c:\Users\your_user\ called .vropscli.yml

Enter the following information into .vropscli.yml:

default:
    host: "vrops.fqdn"
    user: "admin"
    pass: "password"

If you’re not comfortable saving passwords in plain text, don’t worry. vROpsCLI will encrypt the password the first time you run it.

Launch powershell and enter “pipenv shell”

Enter “python .\vropscli.py” for a list of commands

As you can see, there are a lot of things you can do with vROpsCLI. Below is the complete list.

vropscli.py –
vropscli.py – config
vropscli.py – createAdapterInstances
vropscli.py – createAlertDefinition
vropscli.py – createAlertDefinitions
vropscli.py – createCredentials
vropscli.py – deleteAdapterInstance
vropscli.py – deleteAdapterInstances
vropscli.py – deleteAlertDefinition
vropscli.py – deleteAlertDefinitions
vropscli.py – deleteCredential
vropscli.py – generateAlertTemplate
vropscli.py – getAdapter
vropscli.py – getAdapterCollectionStatus
vropscli.py – getAdapterConfig
vropscli.py – getAdapterConfigs
vropscli.py – getAdapterKindConfigParams
vropscli.py – getAdapterKinds
vropscli.py – getAdapters
vropscli.py – getAlertsDefinitionsByAdapterKind
vropscli.py – getAllCredentials
vropscli.py – getCollectors
vropscli.py – getCredential
vropscli.py – getCurrentActivity
vropscli.py – getPakInfo
vropscli.py – getPakStatus
vropscli.py – getResource
vropscli.py – getResourcesOfAdapterKind
vropscli.py – getSolution
vropscli.py – getSolutionLicense
vropscli.py – getVropsLicense
vropscli.py – groupInstall
vropscli.py – installPak
vropscli.py – saveCliCred
vropscli.py – setSolutionLicense
vropscli.py – setVropsLicense
vropscli.py – startAdapterInstance
vropscli.py – stopAdapterInstance
vropscli.py – token
vropscli.py – updateAdapterInstances
vropscli.py – updateAlertDefinitions
vropscli.py – uploadPak
vropscli.py – version

Run a command to see if it works. I’ll run “python .\vropscli.py getAdapters”

All my vROps adapters are listed. It’s alive!!!!

Getting fancy

If you feel that opening a pipenv shell to run vROpsCLI is pretty clunky, you’re not alone. Thankfully there’s an easier way! Once you’ve completed all the steps above and verified that vROpsCLI can talk to your vROps instance, we can package everything up into a single executable.

From the pipenv shell enter the following commands.

“pipenv install pyinstaller”

“pyinstaller -F .\vropscli.py”

This will create an executable file in the dist subfolder.

From a new shell you just have to run the executable. This is so much easier!

Matt Bradford

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.