Monitor several folders size in Windows
Posted: Mon Oct 02, 2017 9:55 am
Hello all:
This is related this post https://support.nagios.com/forum/viewto ... 16&t=45210
i was able to monitor a Windows folder by his size. however i'm unable to figure out how to monitor multiple folders
i have downloaded the script from here:
https://exchange.nagios.org/directory/P ... bs/details
what i did is add the folder path in nsclient.ini
can anyone tell me how can i get this working?
thanks
This is related this post https://support.nagios.com/forum/viewto ... 16&t=45210
i was able to monitor a Windows folder by his size. however i'm unable to figure out how to monitor multiple folders
i have downloaded the script from here:
https://exchange.nagios.org/directory/P ... bs/details
Code: Select all
Set WshShell = WScript.CreateObject("WScript.Shell")
If WScript.Arguments.Length = 0 Then
Set ObjShell = CreateObject("Shell.Application")
ObjShell.ShellExecute "wscript.exe" _
, """" & WScript.ScriptFullName & """ RunAsAdministrator", , "runas", 1
WScript.Quit
End if
Dim strfolder
Dim intwarning
Dim intcritic
Dim wsh
Dim intvelkost
Dim intjednotka
Dim Perf_Data
'##########################################################'
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set wsh = CreateObject("WScript.Shell")
'##########################################################'
If Wscript.Arguments.Count = 3 Then
strfolder = Wscript.Arguments(0)
intwarning = Wscript.Arguments(1)
intcritic = Wscript.Arguments(2)
Set objFolder = objFSO.GetFolder(strfolder)
intjednotka = 1048576 '1MB->bytes'
intvelkost = objFolder.Size/intjednotka
Perf_Data = "|'FolderSize'=" & round (objFolder.Size / 1048576,1) & "MB;"
if (objFolder.Size/1024000) > Cint(intcritic) then
Wscript.Echo "CRITICAL:" & round (objFolder.Size / 1048576,1) & " MB" & Perf_Data
Wscript.Quit(2)
elseif (objFolder.Size/1048576) > Cint(intwarning) then
Wscript.Echo "WARNING:" & round (objFolder.Size / 1048576,1) & " MB" & Perf_Data
Wscript.Quit(1)
else
Wscript.Echo "OK:" & round (objFolder.Size /1048576,1) & " MB" & Perf_Data
Wscript.Quit(0)
end if
else
Wscript.Echo "UNKNOWN:"& strfolder &"-" & intwarning & "-" & intcritic
Wscript.Quit(3)
End Ifwhat i did is add the folder path in nsclient.ini
i have tried to add a similar line below pointing to the same folder on drive G but i got only one output when i run the command Nagios Side.; A list of scripts available to run from the CheckExternalScripts module. Syntax is: <command>=<script> <arguments>
[/settings/external scripts/scripts]
check_foldersize=C:\windows\System32\cscript.exe //NoLogo //T:30 "C:\Program Files\nsclient++\scripts\check_folder_size.vbs" "E:\System Volume Information" 8192 5120
can anyone tell me how can i get this working?
thanks