NCC : Automator to the rescue

Share on:

NCC : Automator to the rescue

What is NCC

NCC is a built-in tool in the Nutanix stack to help check overall health of your clusters. Some have rightfully called it The Swiss Army Knife of Nutanix Troubleshooting Tools.

It does a number of checks ranging from known driver issues to obsolete firmware and more. Personally I run it semi-regularly or before doing anything special on clusters (update/upgrade, expansion). In short, it’s a great tool.

Only problem is that the output is a text file and I wanted to have something to provide a summary, more exactly produce the list of Knowledge Base articles.

macOS Automator to the rescue

Few people know or use Automator on macOS and that’s a shame. It’s a great automation tool for mere mortals with no or limited coding required (but you can add some if desired).

Automator:inline

So here is the step by step workflow. You could create it as a service to right click on the ncc file and start automator or even as an application.

1. Open Automator

Located in your Application Folder or Command+Space and type automator

2. Create a new wokflow

Select the workflow type. You will be able to convert it to a standalone application or service later

3. Add “Ask for Finder Item”

This step will enable you to select the ncc output file you downloaded. I only change the prompt title and the default file location.

4. “Get Select Finder Item”

This step is required so that the selected file gets passed on the next step

5. “Combine Text Files”

This one is a bit of an oddity but it’s there to convert the text output in Rich Text Format (RTF) as the next step is expecting this format

6. “Extract Data from Text” / “Extract URLs from Text”

This will leverage macOS data detectors to grab any URL in the NCC output

7. “Filter URLs”

This step is required to filter out strings that looks like URL but aren’t such as nutanix@ip_address. You only need to set a basic filter : Entire URL - begins with - http://

8. Action Step

At this stage we have our list of URLs so what’s next all depends on what you want to do. Personal favorites are :

  • “Set Contents of TextEdit Document” which opens TextEdit with the list of URLs
  • “Display webpages” whcih opens each URLs in a different tab (you will have to login with your Nutanix Portal credentials so hopefully you have them saved in Keychain to login quickly and save on typing)

Conclusion

Both NCC and Automator are great tools and you should use them. From there, your imagination is the limit ! You could add a few steps to trigger the NCC health check instead of doing it manually and/or insert a step that would download the latest ncc (hint : “Run shell script” and scp are your friends)

As I mentionned earlier, you could convert this workflow as a service to right click on a NCC file and run it. Or as an application and combine it with folder events so that whenever you downlowd a NCC file, the application kicks in automatically.

This is what I consider my “NCC Assistant” v0.01. If I have enough time, I’ll build something a bit more polished in Xcode and share it with the community.

Any issues, reach out on Twitter. If you want a copy of the workflow, it is available on GitHub