Nagios Pi Part Three
Since my last post I’ve been mostly looking at how to start and shut down my environment at a certain times with success in starting but failure in shutting down.
The starting of my environment was an easy enough task with a simple bash script to send WOL packets to my hosts and using a For loop to fire it off five times for good measure.
There was some difficulty getting the script to run from a cron job but this turned out to be that I needed to put my path in the script and once that was done it now fires off at 6am every weekday.
On the shutting down side, I managed to work out the minimum local user permissions needed on an ESXi host for a user to shut it down and even got the sample VMware SDK perl script hostinfo to work with the low level user. The trouble I had after sorting out using a different Perl library for SSL so it didn’t balk at a self signed certification was that my license level doesn’t allow shutting a host down through the API.
Yes, you guessed it, I’m running a free license on my ESXi hosts and didn’t realise that the API is only limited to read actions. After that I went back to seeing if I could SSH on to the server and shut it down that way with a low level user but so far it appears only root level users can SSH on to a host.
There’s various articles and discussions out there about it but to be honest I ran out of time and inclination by that point. I shall revisit it though as it would be nice to have one script turn on the environment in the morning and one shut it down gracefully in the evening. On the FreeNas side I was looking for ways to do that and out of all the methods there was someone who just had a cronjob to check if the client’s were responding to ping. If none were responding the cron job shut FreeNas down. Sometimes the simple method is the best !