Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
Directory
pintxoj
bypintxoj, June 28, 2016
Here is a little fix to this plugin. First fixed the Warinig and Critical alarms (thanks for the comment), and then added a basic perfdata (only the size in MB no critical and warning value)
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 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 If
bypintxoj, February 25, 2015
For those who try this script and always send Critical to nagios i made this fix and it works now. Look at the bottom of the script and search for this:
if (intMaxTemp = intTemperatureWarning) then return_code = WARNING
if (intMaxTemp >= intTemperatureCritical) then return_code = CRITICAL
if (intMaxTemp = cstr(intTempCritical)) then return_code = 2
if (intMaxTemp rning = 55
intTempCritical = 70
Change that values as you need.
Now the script works, as i say, without arguments, but with my knowledge of scripting is quite more than nothing.
if (intMaxTemp = intTemperatureWarning) then return_code = WARNING
if (intMaxTemp >= intTemperatureCritical) then return_code = CRITICAL
if (intMaxTemp = cstr(intTempCritical)) then return_code = 2
if (intMaxTemp rning = 55
intTempCritical = 70
Change that values as you need.
Now the script works, as i say, without arguments, but with my knowledge of scripting is quite more than nothing.