Check_MK monitoring Mapped Drives/NFS Mounts

 

This local check will monitor mapped drives for a particular user (NOTE: This requires the Check_MK agent service to be run as the user in question so must be a local administrator account).

Changing the Check_MK agent to run as the user:

  1. Open up the services module in Windows (Start > services.msc) and locate the Check_mk agent.
  2. Double click on the service and go to the Log On tab
  3. Enter the credentials of the local administrator account that you wish to monitor the mapped drives / NFS mounts for
  4. Click OK to save the settings, restart the service to ensure this is still running.

The Local Script:

Create a powershell script (check_mapped_drives.ps1) with the below contents in C:\Program Files (x86)\check_mk\local – Update line #2 to be a list of the volume letters you wish to monitor (comma separated with colon included):

## Add the mapped / NFS mounts you wish to monitor in the below list, comma separated.
"F:,Z:".split(",") | foreach {

	$checkmap= net use | select-string $_

	if ($checkmap) {
		write-host "0 nfs_share_$_ - $_ share mapped"
	} else {
		write-host "2 nfs_share_$_ - $_ share not mapped"
	}
}

Any comments or questions? Get in touch here or Email me at [email protected]