Page 1 of 2
Monitor a Folder Size in Windows
Posted: Thu Aug 17, 2017 6:28 am
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.
Re: Monitor a Folder Size in Windows
Posted: Thu Aug 17, 2017 10:43 am
by cdienger
Re: Monitor a Folder Size in Windows
Posted: Thu Aug 17, 2017 1:25 pm
by lpereira
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.
Re: Monitor a Folder Size in Windows
Posted: Thu Aug 17, 2017 2:24 pm
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
Re: Monitor a Folder Size in Windows
Posted: Thu Aug 17, 2017 2:54 pm
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?
Re: Monitor a Folder Size in Windows
Posted: Thu Aug 17, 2017 3:20 pm
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.
Re: Monitor a Folder Size in Windows
Posted: Thu Aug 17, 2017 4:00 pm
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.
Re: Monitor a Folder Size in Windows
Posted: Thu Aug 17, 2017 4:32 pm
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.
Re: Monitor a Folder Size in Windows
Posted: Thu Aug 17, 2017 5:00 pm
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
Re: Monitor a Folder Size in Windows
Posted: Fri Aug 18, 2017 3:49 am
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.