I’ve had the opportunity to head to some exciting places over the last few weeks/months and especially in the more recent weeks i’ve been heading up and down the country on a regular basis. This has given me time whilst sat on the train “yay!” to really spend some time playing around with HP OneView.. I’ve already had a go at wrapping some of the API in Objective-C and decided to make something a little bit more useful.
I probably should have done my development work in a language that is a little bit more recent, something such as python etc.. however I stuck with a 43 (at time of writing) year old programming language .. C. This does give me the option of porting it to anything with a C compiler and libcurl so the option is there 🙂 I’ve also made use of the libjannson library which is fantastic for manipulating and reading JSON (http://www.digip.org/jansson/).
So, what i’ve ended up with is a simple tool that can plug into automation tools pretty easily (Chef, Puppet, Ansible i’m looking at you) that can interact with HP OneView and do some simple reporting in JSON or Tab delimited output. It also can do somethings that currently aren’t available.. such as interact with multiple HP OneView instances!
I’d full screen this before clicking play.. 🙂
This is a quick example of pulling some details from one instance (Enclosure-Groups, Server Hardware Type) and using that to move a server profile from one HP OneView to another..
I’ve uploaded the code to github and it’s available at the URL https://github.com/thebsdbox/OVCLI . The code uploaded is aimed in an Xcode environment, however it can be easily recompiled to work on anything with a C compiler.
Simply get the libjansson code and compile that (don’t even need to install it), find the libjannson.a should be in /src/.libs/ and copy that over the OS X compiled libjansson.a .. then use the following line in the directory with the code:
$ gcc *.c –lcurl ./libjannson.a –o OVCLI
That is all that’s required.. well the curl libraries are needed as well. I’ll put together a user guide at a later date.