Page 1 of 1

How to check folder size with NRPE (Windows folder)

Posted: Mon Apr 30, 2018 9:42 am
by dlukinski
Hello Nagios Support

How to check folder size with NRPE (Windows folder)?

Thank you,
Dimitri

Re: How to check folder size with NRPE (Windows folder)

Posted: Mon Apr 30, 2018 2:10 pm
by npolovenko
Hello, @dlukinski. Please make sure that you have the check_folder_size.vbs script in the NSClient scripts folder. You should have it there by default, i think.

Here's an example of the command:

Code: Select all

check_foldersize = cscript.exe //T:30 //NoLogo scripts\check_folder_size.vbs c:\yourfolder 50 78
Here's an example of the nrpe command:

Code: Select all

./check_nrpe -H 192.168.3.145 -c check_foldersize

Re: How to check folder size with NRPE (Windows folder)

Posted: Mon Apr 30, 2018 2:17 pm
by dlukinski
npolovenko wrote:Hello, @dlukinski. Please make sure that you have the check_folder_size.vbs script in the NSClient scripts folder. You should have it there by default, i think.

Here's an example of the command:

Code: Select all

check_foldersize = cscript.exe //T:30 //NoLogo scripts\check_folder_size.vbs c:\yourfolder 50 78
Here's an example of the nrpe command:

Code: Select all

./check_nrpe -H 192.168.3.145 -c check_foldersize

Hi

1. Where to get the script?
- also found PS1 script https://www.reddit.com/r/nagios/comment ... rver_with/
- How to edit INI and XI Command / Service to get this working?

2. check_foldersize - Unknown command

Thank you

Re: How to check folder size with NRPE (Windows folder)

Posted: Mon Apr 30, 2018 2:37 pm
by npolovenko
@dlukinski, I zipped the script file for you. Unzip it and place it in the scripts directory.

Code: Select all

C:\Program Files\NSClient++\scripts
I verified that this plugin works. Go ahead and try it and if you don't like it I'll come up with the command for the one you suggested.


This definition:
check_foldersize = cscript.exe //T:30 //NoLogo scripts\check_folder_size.vbs c:\yourfolder 50 78
Should go into the following section in nsclient.ini file:
[/settings/external scripts/scripts]

Don't forget to restart the nsclinet service after you modify the nslcient.ini.

Re: How to check folder size with NRPE (Windows folder)

Posted: Mon Apr 30, 2018 3:35 pm
by dlukinski
npolovenko wrote:@dlukinski, I zipped the script file for you. Unzip it and place it in the scripts directory.

Code: Select all

C:\Program Files\NSClient++\scripts
I verified that this plugin works. Go ahead and try it and if you don't like it I'll come up with the command for the one you suggested.


This definition:
check_foldersize = cscript.exe //T:30 //NoLogo scripts\check_folder_size.vbs c:\yourfolder 50 78
Should go into the following section in nsclient.ini file:
[/settings/external scripts/scripts]

Don't forget to restart the nsclinet service after you modify the nslcient.ini.

we are now getting this:

C:\Program Files\NSClient++\scripts\check_folder_size.vbs(31, 1) Microsoft VBScript runtime error: Permission denied


Also tried using FileSize count from here: https://support.nagios.com/kb/article/f ... s-783.html
- does not work
- either files or the folder\\* check

Re: How to check folder size with NRPE (Windows folder)

Posted: Mon Apr 30, 2018 3:49 pm
by npolovenko
@dlukinski
C:\Program Files\NSClient++\scripts\check_folder_size.vbs(31, 1) Microsoft VBScript runtime error: Permission denied
Let's check the permissions.
Right click on the script, then go to properties and in the security settings tab make sure that users have full control permissions.
I'd probably check the permissions on the whole scripts folder as well.

Re: How to check folder size with NRPE (Windows folder)

Posted: Mon Apr 30, 2018 3:58 pm
by dlukinski
npolovenko wrote:@dlukinski
C:\Program Files\NSClient++\scripts\check_folder_size.vbs(31, 1) Microsoft VBScript runtime error: Permission denied
Let's check the permissions.
Right click on the script, then go to properties and in the security settings tab make sure that users have full control permissions.
I'd probably check the permissions on the whole scripts folder as well.
I got check_files (working) with same permissions as this script: Read & Execute

Re: How to check folder size with NRPE (Windows folder)

Posted: Mon Apr 30, 2018 4:57 pm
by npolovenko
@dlukinski, Do you get the same kind of errors when you run the plugin locally with no arguments?

I start to think that the problem with permissions is not on the plugin's side but on the target folder's side, that you're trying to query for a size.

Please check the permissions on the target folder in a similar way you checked the script's permissions.

Looks like someone on this forum had a similar issue:
https://tutel.me/c/programming/question ... +not+found

Code: Select all

takeown /f C:\Users /r /d y                          
icacls C:\Users /grant administrators:F /T 
Where C:\Users is the folder that you're monitoring.

Re: How to check folder size with NRPE (Windows folder)

Posted: Tue May 01, 2018 8:40 am
by dlukinski
npolovenko wrote:@dlukinski, Do you get the same kind of errors when you run the plugin locally with no arguments?

I start to think that the problem with permissions is not on the plugin's side but on the target folder's side, that you're trying to query for a size.

Please check the permissions on the target folder in a similar way you checked the script's permissions.

Looks like someone on this forum had a similar issue:
https://tutel.me/c/programming/question ... +not+found

Code: Select all

takeown /f C:\Users /r /d y                          
icacls C:\Users /grant administrators:F /T 
Where C:\Users is the folder that you're monitoring.
icalcs was deprecated long time ago. Administrators already have full access anyways.

Still does not explains why stock VBS scripts work

Re: How to check folder size with NRPE (Windows folder)

Posted: Tue May 01, 2018 1:22 pm
by npolovenko
@dlukinski, I see you have opened a ticket for the same issue in our ticketing system, so I will be closing this thread.