The Surly Admin

Father, husband, IT Pro, cancer survivor

PSNetScaler Module

I’ve been working a lot lately on our load balancer, a Citrix NetScaler 7500 to be specific.  Since we upgraded the to version 10.5 (and got rid of that crappy Java interface) the web experience is actually pretty pleasant and I do most of my work there.  If I have a lot of changes I occasionally drop into the CLI, but mostly I’m on the web interface.  That said, I love me some PowerShell and I thought wouldn’t it be amazing to have some PowerShell cmdlets?  Read on to see how the PSNetScaler module was born.

Citrix.NetScaler Module

Some quick Googling quickly turned up the Citrix.NetScaler module by RamblingCookieMonster.  Now, Warren does some great stuff and I’ve been following him for a while so I didn’t really need to look any further.  I quickly downloaded the module, loaded it up and began playing–and it wasn’t long before I was pulling information out of my NetScaler.  Great stuff, this is exactly while PowerShell has modules and why I’m so excited about how the community is really building these things out.

But, unfortunately, there’s a but.  The repository hasn’t been updated for 2 years–and I later learned that Warren’s new job doesn’t have NetScaler’s so it’s unlikely to be updated any time soon.  Not to worry, the module is on Github so I could fork it and get to work.  I had recently done a pull request to Boe Prox’s excellent PoshRSJob so was feeling pretty excited to contribute to this module too.  The changes I had in mind were pretty ambitious too, so I got to work.

One of the biggest changes I wanted to make was how the Connect-NSSession function worked.  Warren’s original plan was to have each function be independent, or have the ability to accept a web session that was created by Connect-NSSession.  One of the accepted practices I had been seeing was for you to connect to a service and that’s persistent (much like PowerCLI does things with Connect-VIServer), so I decided to change things up to make the Connect-NSSession a requirement.  I could concentrate all of the connection code in there and prepare the environment for more work.  I then started adding independent functions for getting the different objects available in NetScaler.

And so came PSNetScaler

After I had done enough work that I felt comfortable to make a Pull Request, I did so and waited anxiously.  And waited.  And waited.  Uh oh.  Did I do something wrong?  Did I go so outside the bounds of what Warren wanted to do that I’d pissed him off?  And as a side note, this is why if you put a module out there that you want people to contribute to, it’s important to create a CONTRIBUTING.MD file in your repository and give some specific instructions about how you want things done.  I decided to reach out to Warren and see what was going on.  Turns out he was in the middle of moving to Massachusetts and a new job, and his wife was pregnant to boot.  So, kinda busy.  I don’t understand why anything like that would stand in the way of a good PowerShell module, but people have strange priorities.

Turns out he thought it was great that someone was working on it, but he couldn’t really help or even moderate since he didn’t have a NetScaler to test against.  So the first thought was to transfer the Citrix.NetScaler module over to me, but Warren made a good point that this was kind of in his portfolio of work, and he’d hate to not have it there.  And since nothing I’m doing has changed the core functionality he wrote, I completely understood.  He then recommended that I create a new repository and just work independently from there.  Hence PSNetScaler was born.

PSNetScaler is a really ambitious project, one I might not have started had I truly thought about it–I wonder how many big modules start out that way?–but now I’m doing it and really enjoying the results so there’s no backing out.  There are hundreds, if not thousands of things to configure in NetScaler, and I doubt this module will ever cover all of them, but I’d like to cover the big stuff.  It’s going to start with “GET” first, and then eventually move into “SET” and we’ll see from there.

A little help?

It is my hope that the module will attract some attention from other NetScaler people who would be willing to make some contributions, even if it’s just issues and ideas.  If I’m working on it by myself–which I will be doing–it’s going to be a long time before there’s a fully functional module.  So take a look, follow it if you want, and if you see something you’d like to do go for it!

Plans

One thing I’d like to do with this is the Get-NSBindings cmdlet.  It sounds simple enough but I want to add a -Recurse switch to it that will allow you to “GET” a load balancing virtual server, pipe it into Get-NSBindings with -Recurse and it will return the entire chain of objects.  You could pipe that into ImportExcel and have instant configuration reports.

I recently added Get-NSVitalStats which will be metric tracking–more metrics will be added but I’d love input from the community on what you’d like to see.  I actually have this in production right now collecting metrics for our Graphite and Graphana setups.

I need a lot of information about the objects returned to display them correctly, and to identify Bindings properly so I’ve been thinking about using hash tables stored in $NSSession to do that, or maybe even defining PowerShell classes–but not everyone will be on PowerShell v5 so that’s a big limiting factor.  My lack of knowledge of C# is also a problem so defining classes that way would be rough.   No decision on this yet.

That’s it for now!

PSNetScaler

Advertisement

March 11, 2016 - Posted by | PowerShell | , ,

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: