Monitoring of Windows Shared Cluster

Monitoring Windows Shared Clusters can be achieved in many different ways. This article demonstrates the power of NetCrunch scripts combined with data parsers to show you how easy and fast it is to setup NetCrunch to collect data about free and used space on clusters

Pre-Requisites

  • Machine with Cluster Shared Volume installed
  • User with rights to login to the machine and access to Cluster Shared Volume
  • NetCrunch Server added to the trusted hosts on the machine with Cluster Shared Volume (Remote invoke-command should be available from the NetCrunch Server machine)

The Script

Included script uses cmd-let to access Cluster Shared Volume information such as:

  • Name of the cluster
  • Free Space
  • Used Space
  • %Free
  • Size

By default, information about all clusters is collected.

$objs = @() $c = Get-ClusterSharedVolume foreach ( $csv in $c ) { $csvinfos = $csv | select -Property Name -ExpandProperty SharedVolumeInfo foreach ( $csvinfo in $csvinfos ) { $obj = New-Object PSObject -Property @{ Clustername = $Clu Name = $csv.Name Size = $csvinfo.Partition.Size FreeSpace = $csvinfo.Partition.FreeSpace UsedSpace = $csvinfo.Partition.UsedSpace PercentFree = $csvinfo.Partition.PercentFree } $objs += $obj } } $objs | ConvertTo-Json

After executing the script, data is converted into JSON which will be parsed in NetCrunch in the next step

The script should be saved in the place accessible by NetCrunch e.g. C:\scripts\script.ps1

The Parser

The parser is a way for NetCrunch to understand the output of any script, program, file, etc.

Parser below takes data that is yielded by the script and transforms it into counters that can be understood by NetCrunch.

Since the data output of the script is JSON it's very easy to transform it into the counters.

Use Javascript as the type of the parser

const dataToParse = JSON.parse(data) dataToParse.forEach(cluster => { result .counter('Cluster/Free Space(GB)', cluster.FreeSpace/1024/1024/1024, cluster.Name) .counter('Cluster/Used Space(GB)', cluster.UsedSpace/1024/1024/1024, cluster.Name) .counter('Cluster/Percent Free(%)', cluster.PercentFree, cluster.Name) .counter('Cluster/Size(GB)', cluster.Size/1024/1024/1024, cluster.Name) })

Data Parser

If you wish to know more about parsers, visit this Data Parsers page.

Sensor Configuration

  • Script type: Powershell
  • Script File: Invoke-Command
  • Check 'Pass credentials through PSCredential object' - select proper credentials here (mentioned in pre-requisites)
  • Click on Script Parameters and provide two params.
    • -FilePath path/to/your/file
    • -ComputerName DNS name of computer with Cluster
  • Set output data format to parser you've created in the previous step
sensor config

Right now it's possible to check if the script works - click on the 'test' icon in the top right corner of the window. If the test is successful you should see output similar to the screen below:

Test

You should be able to see available counters with instances named after your cluster names.

Result

The last step is to either add collectors and/or alerts that are based on the counters. To do that - click either on 'add collectors' or 'add alerts' and follow steps of the 'editor' window.

Result

If everything is configured properly - monitoring should start and data should be gathered by NetCrunch like all other counters.

clusterpowershellpssharedwindows

NetCrunch Network Monitoring

Network Maps, Dashboards, and Alerts.
Monitor anything. Network, cloud, config.