This script will be required for other scripts that will focus on cluster functionality. It is presented separately from the Hyper-V scripts because its commands will only be useful in a cluster environment. Many of them do not even require Hyper-V to be installed on the nodes. Like the Hyper-V scripts, you must have NSClient++ installed on all of the nodes.

Check out this comprehensive introduction to Nagios prepared by Eric if you want to get started with the free monitoring tool – you’ll find three additional scripts to get you started with Nagios in Hyper-V. You can also check out Nagios for Hyper-V: Alert on Low Cluster Shared Volume Space which follows up on this article.

Last updated: May 17, 2017 to 1.1.1. Important! You must update the other base files as well!

Nagios Configuration Files

Start with the configuration file changes as listed on the Hyper-V base scripts article. If you are only interested in the cluster scripts and not any of the Hyper-V scripts, you must still make all of these changes as shown in that article:

  • Uncomment the Windows.cfg line in nagios.cfg
  • Add a “host” entry to one of the .cfg files to represent the cluster(s) that you want to monitor. In the Hyper-V base scripts article, you’ll find an example in the hypervhost.cfg listing
  • Create an entry for a cluster object in templates.cfg. In the Hyper-V base scripts article, it is referred to as a Hyper-V host, but you can change that to anything that suits you.

The remaining configuration file to change is the commands file, where you will enter all of the cluster commands alongside the others.


You can use a different name for the grouping if it suits your environment. The actual command shown in the following section is just an example. For the actual command, please refer to the article that includes the entire script package.

NSClient++ Configuration

There are some general notes in the base Hyper-V scripts article that are all applicable here. The primary point that bears repeating is that the host must have its execution policy lowered to at RemoteSigned at the highest. You can run Set-ExecutionPolicy -ExecutionPolicy RemoteSigned.

C:\Program Files\NSClient++\nsclient.ini

The base Nagios article includes a section on configuring the ini file correctly. The portion that establishes PowerShell functionality and a couple of samples for checks are shown below:

C:\Program Files\NSClient++\scripts\clusterbase.ps1

Further check scripts will be published on this blog that utilize the above.