Monitoring Cluster Shared Volumes

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
kiddbios
Posts: 54
Joined: Wed Feb 01, 2012 12:57 pm

Monitoring Cluster Shared Volumes

Post by kiddbios »

Hello,

We use Hyper-V 2012 for our virtualization platform. One of the features of Hyper-V in a clustered environment is the use of Cluster Shared Volumes, which are essentially mount points that all of the servers in the cluster can read and write to, but they can only hold Hyper-V data. The CSVs do not have a drive letter assigned to them. We had an issue recently where a CSV became full and this caused all the VMs hosted on that volume to stop. Is there a way to monitor CSVs with Nagios XI?
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Monitoring Cluster Shared Volumes

Post by abrist »

There are plugins on the exchange for checking hyper-v systems, though none of the look like they are for CSV storage. Have you considered using snmp or writing a powershell script?

http://exchange.nagios.org/directory/Pl ... ce/details
http://exchange.nagios.org/directory/Pl ... th/details
http://powershellcommunity.org/Forums/t ... fault.aspx
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
kiddbios
Posts: 54
Joined: Wed Feb 01, 2012 12:57 pm

Re: Monitoring Cluster Shared Volumes

Post by kiddbios »

We have created the powershell script and confirmed that it works from the host, but we are unable to execute it via Nagios. We're using the following command:

$USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c check_csv

This has been added to the nsclient.ini file

check_csv=cmd /c echo scripts/check_csv.ps1; exit $LastExitCode | powershell.exe -Command -

This is the error we're getting:

COMMAND: /usr/local/nagios/libexec/check_nrpe -H 192.168.1.50 -t 30 -c check_csv
OUTPUT: No handler for command: cmd
kiddbios
Posts: 54
Joined: Wed Feb 01, 2012 12:57 pm

Re: Monitoring Cluster Shared Volumes

Post by kiddbios »

OK, we got all the script and NRPE parameters working properly. We can run the test from within the CCM (it prompts for a hostname) and we can also successfully run the test directly from the command line on the XI box itself. The issue we're having now is that as soon as we try to add any host or hostgroup to the service in the CCM, we get an error that the config cannot be applied. Looking at the config debug it just says there is an error on line 14.

Any help is greatly appreciated.
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Monitoring Cluster Shared Volumes

Post by sreinhardt »

Could you post your error from applying configuration, as well as the check command you created please?
edit: more of the error than just line 14, like what file it is errorring on and what is the object containing line 14.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
kiddbios
Posts: 54
Joined: Wed Feb 01, 2012 12:57 pm

Re: Monitoring Cluster Shared Volumes

Post by kiddbios »

We got it sorted. Had to do with the max attempts and what not.

Thanks,

Brad
kiddbios
Posts: 54
Joined: Wed Feb 01, 2012 12:57 pm

Re: Monitoring Cluster Shared Volumes

Post by kiddbios »

For those of you who need it:

This is the powershell script. It monitors all of the CSVs connected to a windows cluster. Copy this into a text document, name it check_csv.ps1 and put it in the NSClient++ scripts directory (Typically c:\program files\nsclient++\scripts). The warning threshold level can be set in the 4th line of the code ($warninglevel = X).

#Load the FailoverClusters module
Import-Module FailoverClusters

$warninglevel = 15 # The percent to send warning at
$message = @()
$warning = @()
$critical = @()
$nl = [Environment]::NewLine

$csv_status = Get-ClusterSharedVolume
foreach ( $csv in $csv_status )
{
$expanded_csv_info = $csv | select -Property Name -ExpandProperty SharedVolumeInfo
foreach ( $csvinfo in $expanded_csv_info )
{
$obj = New-Object PSObject -Property @{
Name = $csvinfo.Name
Path = $csvinfo.FriendlyVolumeName
Size = $csvinfo.Partition.Size
FreeSpace = $csvinfo.Partition.FreeSpace
UsedSpace = $csvinfo.Partition.UsedSpace
PercentFree = $csvinfo.Partition.PercentFree
}
if ($csvinfo.Partition.PercentFree -lt $warninglevel)
{ $critical = 2}
elseif ($csvinfo.Partition.PercentFree -eq $warninglevel)
{ $warning = 1}
else
{ $message = 0}
}
}

#Write-Output $ToSend
if($critical -eq 2)
{
$ToSend = "CRITICAL -CSV Status is above threshold capacity "
Write-Host $ToSend
exit 2
}
elseif ($warning -eq 1)
{
$ToSend = "WARNING - CSV Status is at threshold capacity "
Write-Host $ToSend
exit 1
}
else
{
Write-Host "OK - CSV status is good"
exit 0
}


You will then need to edit the nsclient.ini (we are using the most current version of NSC++ as of April 19th, 2013) and add these lines:

[/settings/external scripts/wrappings]
bat = scripts\\%SCRIPT% %ARGS%
ps1 = cmd /c echo scripts\\%SCRIPT% %ARGS%; exit($lastexitcode) | powershell.exe -command -
vbs = cscript.exe //T:30 //NoLogo scripts\\lib\\wrapper.vbs %SCRIPT% %ARGS%

[/settings/external scripts/wrapped scripts]
check_csv = check_csv.ps1

[/settings/external scripts/alias]
alias_updates = check_csv -warning 0 -critical 0

[/settings/NRPE/server]
allowed hosts = (your monitoring host here)
allow arguments = true
allow nasty characters = true
port = 5666
timeout = 60

[/settings/external scripts]
allow arguments = 1
allow nasty characters = 1
timeout = 60




You will then need to create a command in XI. This is the command:

$USER1$/check_nrpe -H $HOSTADDRESS$ -p 5666 -t 30 -c check_csv


After that create your service using that check. You don't need to put in any arguments, just be sure to set your max attempts, check intervals, etc. Add your host or hostgroup to the service and you'll be monitoring the space utilization on your CSV.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Monitoring Cluster Shared Volumes

Post by abrist »

Thanks for the added info. Locking thread.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Locked