Remotely Checking Windows: Mapped Network Drives
Robert Reeves
robert.reeves at newisys.com
Tue Jan 3 22:50:27 CET 2006
I got it working.
Add this to your nrpe.cfg file...
command[check_nrpe_new_disk]=C:\WINNT\system32\cscript.exe /Nologo
C:\nrpe\plugins\checkmappednetworkdrives.vbs $ARG1$ $ARG2$ $ARG3$
Here's checkmappednetworkdrives.vbs...
'On Error Resume Next
DeviceName = WScript.Arguments.Item(0)
'Wscript.Echo "DeviceName=" & DeviceName
WarningPercentage = WScript.Arguments.Item(1)
'Wscript.Echo "WarningPercentage=" & WarningPercentage
CriticalPercentage = WScript.Arguments.Item(2)
'Wscript.Echo "CriticalPercentage=" & CriticalPercentage
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer &
"\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from
Win32_MappedLogicalDisk WHERE DeviceID=""" & DeviceName & """")
For Each objItem in colItems
PercentageFree = objItem.FreeSpace / objItem.Size
PercentageFree = Int(PercentageFree * 100)
If (PercentageFree <= Int(CriticalPercentage)) Then
ReturnCode = "CRITICAL"
ElseIf (PercentageFree <= Int(WarningPercentage)) Then
ReturnCode = "WARNING"
Else
ReturnCode = "OK"
End If
Wscript.Echo ReturnCode & " " & objItem.DeviceID & " -
Percentage Free = " & PercentageFree & "% (" & objItem.FreeSpace & "/" &
objItem.Size & ")"
Next
-----Original Message-----
From: nagios-users-admin at lists.sourceforge.net
[mailto:nagios-users-admin at lists.sourceforge.net] On Behalf Of Robert
Reeves
Sent: Wednesday, December 21, 2005 10:39 AM
To: Subhendu Ghosh
Cc: nagios-users at lists.sourceforge.net
Subject: RE: [Nagios-users] Remotely Checking Windows: Mapped Network
Drives
All are WindowsXP.
I'll look into WMI32_MappedLogicalDisk. Have you had success with that
before?
Thanks!
Robert
-----Original Message-----
From: nagios-users-admin at lists.sourceforge.net
[mailto:nagios-users-admin at lists.sourceforge.net] On Behalf Of Subhendu
Ghosh
Sent: Wednesday, December 21, 2005 10:03 AM
To: Robert Reeves
Cc: nagios-users at lists.sourceforge.net
Subject: Re: [Nagios-users] Remotely Checking Windows: Mapped Network
Drives
On Wed, 21 Dec 2005, Robert Reeves wrote:
> I have several windows servers that use mapped network drives. At
> times, these drives become unavailable and halt services. I would like
> to be able to monitor these drives.
>
> I have both NRPE_NT and nsclient running on the Windows boxes. Both
> responses are not working for me:
>
> NRPE
> Status: OK
> Status Information: DEBUG : 12/21/05 08:59:15: GetDiskFreeSpaceEx()
> returned an error
>
> Nsclient:
> Status: UNKNOWN
> Status Information: Free disk space : Invalid drive
>
> I have attempted to run both services as the SYSTEM account and as a
> valid domain user. Both result in the same response.
>
> There is an earlier thread that suggests granting the SYSTEM user
> permissions to the share. However, due to some uniqueness with how we
> set up the mapped network drives, I am unable to change the
> permissions on the shares. There are from a Linux box running Samba.
>
> Does anybody have a solution for this? I simply need to make sure the
> drives are accessible from the Windows server, so I'm willing to go in
> a different location instead of checking free space left.
>
> Thanks,
>
> Robert
>
server os - win2k or win2k3?
Have you tried using NRPE_NT with a script that uses the
WMI32_MappedLogicalDisk to enumerate mapped disks?
--
-sg
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log
files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when
reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log
files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=ick
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when
reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
More information about the Users
mailing list