Page 1 of 1
Check WMI Plus - checkfoldersize including sub folders
Posted: Fri May 13, 2016 7:56 am
by krobertson71
Trying to monitor the windows winsxs folder for total size c:\windows\winsxs. When I use checkfoldersize it ignores the sub-directories. Is there a way for the check to calculate the size of the folder including these sub-directories?
Any help, or suggestions, even if it's a custom solution I am all ears!
Re: Check WMI Plus - checkfoldersize including sub folders
Posted: Fri May 13, 2016 11:01 am
by ssax
Yes, looks like you can, you need to add
-4 s to your command.
Code: Select all
checkfoldersize
WARNING - This check can be slow and may timeout, especially if including subdirectories.
It can overload the Windows machine you are checking. Use with caution.
ARG1 full path to the folder. Use '/' (forward slash) instead of '\\' (backslash). eg "C:/Windows"
ARG4 Set this to s to include files from subdirectories eg -4 s
NODATAEXIT can be set for this check.
WARN/CRIT can be used as described below.
If you specify --nodatamode then you can use WARN/CRIT checking on the _ItemCount. _ItemCount should only ever be 0 or 1.
This allows you to control how the plugin responds to non-existant files.
Valid Warning/Critical Fields are: _FolderSize (Default), _ItemCount.
You can always read more by running:
Code: Select all
/usr/local/nagios/libexec/check_wmi_plus.pl -h
Re: Check WMI Plus - checkfoldersize including sub folders
Posted: Fri May 13, 2016 11:20 am
by lmiltchev
ssax was faster.

I was just trying the "-4 s" option. It is indeed
very slow. I had to increase the timeout.
Code: Select all
[root@localhost libexec]# ./check_wmi_plus.pl -H x.x.x.x -u <username> -p <password> -m checkfoldersize -a "c:/TEMP" -4 s -t 30
OK - Folder c:/TEMP/ is 2.009MB. Found 1 files(s). (List is on next line)|'c:/TEMP/ Size'=2106698bytes; 'File Count'=1;
The file(s) found are c:\temp\test.log
After creating a new folder in c:\TEMP, and copying over two files to it.
Code: Select all
[root@localhost libexec]# ./check_wmi_plus.pl -H x.x.x.x -u <username> -p <password> -m checkfoldersize -a "c:/TEMP" -4 s -t 30
OK - Folder c:/TEMP/ is 2.205MB. Found 3 files(s). (List is on next line)|'c:/TEMP/ Size'=2312445bytes; 'File Count'=3;
The file(s) found are c:\temp\subfolder\check_license.sh
c:\temp\subfolder\counters.txt
Re: Check WMI Plus - checkfoldersize including sub folders
Posted: Fri May 13, 2016 12:30 pm
by krobertson71
Thanks guys. I should have checked the help file.
Going to have to say no go on this monitoring request anyway. Winsxs is the directory MS uses for when we update/patch.
Currently the average on most servers is around 22k subfolders going back 5 years and around 20 gigs big. Unless I put the timeout to over 30 mins or so it's not going to finish.
They just need to run a proper scheduled task to clean that per MS instructions anyway.
Thanks for the help anyway! That information will still come in useful for a normal (not on steroids) directory.
Re: Check WMI Plus - checkfoldersize including sub folders
Posted: Fri May 13, 2016 1:09 pm
by ssax
Ah okay, hopefully it'll be useful in the future! Locking and marking as resolved.