VMware vCheck NTP and Syslog Plugin Amendments

By | June 9, 2015

I’m a big fan of the vCheck script by the very talented Alan Renouf and community, but a couple of the plugins don’t work as well as I’d like with our environment, where we have multiple NTP and Syslog servers and these settings can differ depending on the cluster within a single vCenter. So I’ve made a few changes to the vCheck NTP and Syslog plugins.

NTP Plugin

The file is called “31 NTP Name and Service.ps1” and kept in the “30 Host” folder.

I’m going to cut out the bottom part of the plugin script as there would only be cosmetic changes made there.

There are two changes here:

  • The line “$($_ | Get-VMHostNtpServer)” has been enclosed in quotation marks to expand the array into a string.
  • The check at the end has been changed so we are now checking if the NTP server values are in the provided array.

I’m fairly sure the list of NTP servers are ordered (but have been known to be wrong before), so I’m leaving the list of servers in the order that PowerCLI decides to return them. So when specifying a list of NTP servers, do it in the order they should be used/configured.

Syslog Servers

The syslog plugin file is called “51 Syslog Name.ps1” and it is also in the “30 Host” folder.

I don’t believe that the syslog hosts are ordered (they certainly shouldn’t be), so in the code below we’re looking at the list of syslog hosts sorted alphabetically.

The code is now:

There’s a few changes:

  • The ‘SyslogSettings’ section, supporting ESXi 4.x has been removed.
  • The line “$(($_ | Get-VMHostSysLogServer).Host | sort Host)” sorts the names and expands the array into a string.
  • The comparison check at the end now checks for presence in the array.

Summary

This is very much a lazy fix to a problem I had, and there will be a better solution. For instance, it’s not going to check that hosts in a certain cluster have particular settings – just that all hosts have a valid setting permissable for the vCenter. But it’ll do the job, and for everything else there should be host profiles – and there is vCheck plugin that can be used unaltered to check on those 😉