Thursday, December 15, 2016

Create your own PowerShell Modules

If you are coding in PowerShell, most likely you have been using modules.  If you are using the Netapp Ontap PowerShell toolkit, you certainly know the line "Import-Module DataOntap".

So you can probably guess that importing a module is just loading someone else's code.  A module, when professionally written is most likely "compiled" code.  Code written C# or another .NET language and compiled into a DLL.  In Visual Studio you can create PowerShell projects.  Does that mean, if you want you own module, you need to start learning Visual Studio and C# ?  Hell no, you can create your own module in matter of minutes with nothing more that just plain old PowerShell.

Friday, December 9, 2016

Powershell Logging - The professional way

I've seen many PowerShell scripts in my career.  Fantastic ones and awful ones.  But I have very very rarely seen scripts where proper logging has been done.  Everyone seems to know write-output.  The clever ones know write-verbose and write-warning.  Some are really smart and write their own logging functions, allowing some level of customization.


If you really want to show off with your logging, you need the full monty.  You want screen logging, rolling log files with automated time-stamps and you want event viewer logging.  Obviously, you want to have control of what and when.

Thursday, December 8, 2016

Invoke workflow with Perl and REST

Ever heard of REST ?  In a nutshell : REST is a way of talking to a remote 'system' using existing standards.  http(s) as the protocol and json or xml as the carrier.  Reading is a GET, Writing is a POST.

Oh, and did you know WFA has a REST api ?  That's right, you can talk to WFA with about any programming language there is.

I'm a powershell / .NET guy, so I'll post a powershell sample ASAP.  But I just saw this nice piece of PERL code from my colleague Todd and couldn't wait sharing.  I guess Todd won't mind :), and hopefully he'll add some more comment to this article.

Incremental Naming

I had a discussion yesterday about incremental naming.  A discussion that started after my post about reservations and verifications.
My colleague stated that reservations are not needed for the incremental naming to work and that rather the verification had a bigger role in it.

It ended up in a debate where both have a point.  So how does incremental naming work ?

Monday, December 5, 2016

Tutorial : Move all volumes from one aggregate to another

Whether it's for a migration or a Non-disruptive operation.  Every once in a while, you might need to clean out an entire aggregate and move all the volumes to one or more aggregates.  Those volume moves can take a while, and you don't want them all running at the same time.  Maybe you want only 1 at a time, or maybe 2.  I've created a workflow that does exactly that.  Using an excel file as input and a datasource to collect the vol move information.  In this tutorial we will go over all the bits and pieces, including reservations, custom datasources, importing excelfiles and repeat rows.

WFA and reservations, what is it and how does it work ?

If you know a little about WFA, you probably know that WFA gets all his information from external sources.  Most of the time, it gets its information from OnCommand Unified Manager (OCUM).  Now OCUM, re-scans its information every 15 minutes.    After that re-scan, you still need to wait for the WFA re-scan to happen.  Agreed, you can configure OCUM to update the WFA cache database right after its own refresh (reducing the LAG-time), but you will always have a potential 15 minutes LAG.  So how can WFA work around that problem ?  That's what you will learn in this article.

Friday, December 2, 2016

WFA Command to install a Root CA Certificate on a SVM

For a customer I had to create SVM's and join them in AD.  However, the Active Directory Server was using a public certificate.  Thus, to be able to join the SVM in AD, we first had to install the Root CA certificate on the SVM.  A troublesome manouvre if you have to it manually with the CLI.  Since were provisioning with WFA, why not just create a command to do this.  The customer also has lots of site and DC's, so we added the functionality to set the preferred DC as well.
Below is the code, but I've also added the DAR file.

Wednesday, November 30, 2016

Abstract provisioning using an Excel file

Often customers don't want the operator to pick clusternames or vserver names.  He wants to abstract that part and rather go for more practical input like "datacenter" or "location" or "environment".  In this tutorial we will create a provisioning workflow and we will make that abstraction by using an Excel file.

Tuesday, November 29, 2016

SQL Select Queries with JOINS for dummies

To work with WFA, I often say, you don't have to be a developer, and I stick with that statement.  However, when we want some decent userinput, we will have to write a SQL Query every now and then, and although a simple select query is easy to learn, whenever I start talking about "JOINS", they tend to get lost.  In this tutorial I will try to teach you why we need joins and how they work.

Tutorial : Resize a volume, the proper way

After we created our first workflow, we will now create a workflow that will resize a volume.  Simple you might say, but we will check first if the actual aggregate can sustain the growth whilst still being under a comfortable threshold (85%).  If the aggregate cannot sustain the growth, we will find a better aggregate, move the volume and then resize it.

Thursday, November 24, 2016

WFA Powershell Commands Slow ?

Are you running WFA and are all PowerShell commands slow ?

Maybe CRL checking is enabled...

PowerShell cmdlets are sometimes "signed" and when they are run, they tend to go the the web and check the CRL (Certificate Revocation List).  Now if internet connection is not allowed or slow, this will impact the speed of the commands.

Wednesday, November 23, 2016

Create you first WFA workflow

Together we will create your first workflow.  Just a simple one, we will create a volume with WFA.  However, we are going through the first best practices and we will have WFA automatically pick an aggregate for us.  Your first step to automation !

Monday, November 21, 2016

Wfa string, char and numeric functions

Sometimes you need to manipulate strings or numbers in WFA.  You need to extract a character, or add a number.  A lot of those functions are missing.  So here is a library of string, char & number functions I often use.

Generating number sequence in MySQL

Sometimes you need to create a dropdown box with a list sequential numbers.  Now that can be just plain 1,2,3.  But it could just as well be 400,500,600, ...
Use-cases are for example, you want to provide a dropdown box to resize a volume, but you don't want the operator to go below the current size and you don't want him to over 10TB for example and you always want it to be a multiple of 100GB.  How do you provide such a list ?

Find a netapp lun by WWID

When you create userinput and you need to present some luns in a dropdownbox, most of the time, you just list up your luns. However, sometimes you want to create a portal to non-netapp people. Linux people for example. And they have no clue of what the lun is named. They do however have the WWID, a hexadecimal string. Part of that string is the actual netapp lun serial number. With some simple MySQL querying, it's very simple to determine the actual lun.

Sunday, November 20, 2016

Powershell Transpose Table Data

I had a question from a friend this weekend how he could transpose a powershell table.  I couldn't find anything working on the web, so created my own.

Saturday, November 19, 2016

WFA Datasource Template

If you are working with WFA for quite some time, you will eventually need more advanced workflows, requiring a custom scheme and dictionaries.  And most likely you will want to import external data and import that data into you custom dictionaries.  To import that data, you will need to have a custom datasource.