How to check folder size with NRPE (Windows folder)

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
dlukinski
Posts: 1130
Joined: Tue Oct 06, 2015 9:42 am

How to check folder size with NRPE (Windows folder)

Post by dlukinski »

Hello Nagios Support

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

Thank you,
Dimitri
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

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

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
dlukinski
Posts: 1130
Joined: Tue Oct 06, 2015 9:42 am

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

Post 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
Last edited by tgriep on Wed May 02, 2018 10:45 am, edited 1 time in total.
Reason: Fixed link to the reddit site
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

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

Post 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.
You do not have the required permissions to view the files attached to this post.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
dlukinski
Posts: 1130
Joined: Tue Oct 06, 2015 9:42 am

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

Post 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
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

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

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
dlukinski
Posts: 1130
Joined: Tue Oct 06, 2015 9:42 am

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

Post 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
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

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

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
dlukinski
Posts: 1130
Joined: Tue Oct 06, 2015 9:42 am

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

Post 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
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

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

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked