Monitor a Folder Size in Windows

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
lpereira
Posts: 143
Joined: Thu Jul 27, 2017 4:23 pm

Monitor a Folder Size in Windows

Post by lpereira »

Hello all:
I'm wondering if there are a possibility to monitor a specific folder in Nagios XI, (for instance, System Volume Information).

We want to receive an alert once the folder reaches (for example) 8 or 10gb of used space on the disk.

is there a way to configure this?

Thanks in advance.
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Monitor a Folder Size in Windows

Post by cdienger »

As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
lpereira
Posts: 143
Joined: Thu Jul 27, 2017 4:23 pm

Re: Monitor a Folder Size in Windows

Post by lpereira »

cdienger wrote:I found a couple plugins that you may be interested in:

https://exchange.nagios.org/directory/P ... bs/details
https://exchange.nagios.org/directory/P ... le/details
i have doubts regarding check_folder_size. the script says i need "NRPE_NT daemon". i have installed NSclient ++ on my windows machines instead. it is the same? should i install anything extra?

regards.
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Monitor a Folder Size in Windows

Post by cdienger »

I was able to get it work with slight modifications. I saved the check_folder_size.vbs script to c:\program files\nsclient++\scripts\ and then to find the size of the nsclient++ folder I added the following command line to the settings/external scripts/scripts section:

Code: Select all

[/settings/external scripts/scripts]
check_foldersize=C:\windows\System32\cscript.exe //NoLogo //T:30 "c:\program files\nsclient++\scripts\check_folder_size.vbs" "c:\program files\nsclient++\" 50 78
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
lpereira
Posts: 143
Joined: Thu Jul 27, 2017 4:23 pm

Re: Monitor a Folder Size in Windows

Post by lpereira »

cdienger wrote:I was able to get it work with slight modifications. I saved the check_folder_size.vbs script to c:\program files\nsclient++\scripts\ and then to find the size of the nsclient++ folder I added the following command line to the settings/external scripts/scripts section:

Code: Select all

[/settings/external scripts/scripts]
check_foldersize=C:\windows\System32\cscript.exe //NoLogo //T:30 "c:\program files\nsclient++\scripts\check_folder_size.vbs" "c:\program files\nsclient++\" 50 78
So, i need to specify every Folder i want to monitor on the nsclient.ini file? as you did for Nsclient++ folder?
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Monitor a Folder Size in Windows

Post by mcapra »

Or have your NSClient++ command definition for check_foldersize accept an argument that represents the path. Then you would configure the individual folders on the Nagios side of things. Both are viable options.
Former Nagios employee
https://www.mcapra.com/
lpereira
Posts: 143
Joined: Thu Jul 27, 2017 4:23 pm

Re: Monitor a Folder Size in Windows

Post by lpereira »

mcapra wrote:Or have your NSClient++ command definition for check_foldersize accept an argument that represents the path. Then you would configure the individual folders on the Nagios side of things. Both are viable options.
Which command should i run on the Linux side?

i got an error trying to invoke check_nrpe
[root@NAgiosxi libexec]# ./check_nrpe -H xxx.xxx.xxx.xxx -c check_foldersize
CHECK_NRPE: Error - Could not complete SSL handshake.
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Monitor a Folder Size in Windows

Post by cdienger »

Code: Select all

    [/settings/external scripts/scripts]
    check_foldersize=C:\windows\System32\cscript.exe //NoLogo //T:30 "c:\program files\nsclient++\scripts\check_folder_size.vbs" "c:\program files\nsclient++\" 50 78
could be:

Code: Select all

    [/settings/external scripts/scripts]
    check_foldersize=C:\windows\System32\cscript.exe //NoLogo //T:30 "c:\program files\nsclient++\scripts\check_folder_size.vbs" "$ARG1$" 50 78
for example and you could then run:

Code: Select all

./check_nrpe -H NSCLIENTIP -c check_foldersize -a "c:\program files\nsclient++"
For the handshake error, check the nsclient and make sure you have a line that allows the nagios machine to connect. It should look like:

Code: Select all

allowed hosts = 127.0.0.1, nagios_ip_address
If you edit this file you need to restart the nsclient service.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
lpereira
Posts: 143
Joined: Thu Jul 27, 2017 4:23 pm

Re: Monitor a Folder Size in Windows

Post by lpereira »

i was able to have it working by adding a "-n" at the end.
[root@NagiosXI libexec]# ./check_nrpe -H 172.30.0.56 -c check_foldersize -n
OK:8,6 MB|'FolderSize'=8.59999MB
Now i would need to figure out how to add it as a service in NagiosXI GUI
User avatar
tacolover101
Posts: 432
Joined: Mon Apr 10, 2017 11:55 am

Re: Monitor a Folder Size in Windows

Post by tacolover101 »

this should help explain it - https://assets.nagios.com/downloads/nag ... gement.pdf

basically, navigate to CCM, click 'services', create a new one, assign the host as the host for 172.30.0.56, select the check command as 'check_nrpe' and fill out your argument variables to line up with what you're running over the CLI.
Locked