Alfred is an app for Mac OS X which boosts productivity with hotkeys and keywords. The app enables searching your Mac and the web, and control your Mac using customized actions and workflows. The workflow I built using Python language enable Nutanix administrators to view and manage hosts and virtual machines from their own desktops (MacOS only) in an easy manner.
The best way to understand the possibilities is watching this video:
(Video recorded with an early release of the workflow. Many functions have been added since.)
How to use the workflow:
- To configure the workflow use: ntnx config (do not hit enter)
- To get entities use: ntnx get hosts or ntnx get vms
- To power off a vm use ALT + PowerOn after selecting a vm
I have published the workflow and the Python source code in my Github repository here. Feel free to download the package and contribute back with your own implementations and triggers. If you plan to modify the code please be aware that Nutanix API has two interfaces, being one to manage entities that are common to all hypervisors, while the second one is specific to manage AHV virtual machines and few host operations.
After the initial configuration Alfred will automatically create a file called ntnxapi_data.json in /Users/yourusername/Library/Application Support/Alfred 2/Workflow Data/com.aleibovici.ntnxapi/. If for any reason your workflow is not able to connect to your cluster, delete this file and re-run the configuration process.
If the requests module is not pre-loaded the workflow will not work. Type easy_install requests in a terminal session to install the module.
[Update] April, 290th. 2016
Added self-update capabilities, and a new function to show VMs from a particular host
[Update] April, 19th, 2016
Added ability to search hosts and virtual machines by name instead by ‘uuid’. Before this update the users would have to select items from a displayed list; now it is also possible to type them.
[Update] April, 18th, 2016
Since the video was recorded I have already done few improvements to the workflow, including AHV icons and a Alerts option.
[Update] May, 1st, 2016
- Added new color-coded cluster, host and vm icons based entity state
- Added new shortcut to access NTNX GET context menu without typing
- Added cluster-hosts option to display only hosts that belong to the cluster
- Added option to enter and exit host from maintenance mode. When this option is selected all virtual machines in the host all live-migrated to other hosts. (this feature is only available for AHV clusters)
- Added support for vSphere clusters
- Implemented automated deployment for necessary Python packages.
*** important *** to enable the workflow to automatically download the packages you must run the following command using OS X terminal “pip install –user -U pip“.