How to create Check Folder size
Posted: Mon Mar 21, 2016 11:40 am
Hi there.
I am a rookie in nagios stuff.
So far I have managed to install and configure:
Nagios on Linux CentOS 7
NagiosQL on Linux CentOS 7
NsClient++ 0.4.4.15
I am using integrated commands: (check_nrpe_arg_ssl) for checking free space on disk on Windows server.
$USER1$/check_nrpe -H $HOSTADDRESS$ -p 5888 -u -t 60 -c $ARG1$ -a $ARG2$ $ARG3$ $ARG4$ $ARG5$ $ARG6$ $ARG7$
check_drivesize
'drive=C'
'warn=used gt 80%'
'crit=used gt 90%'
So far so good.
Now the next step is to implement checking folder size on Windows Machines.
I'm tottaly lost here so please a little help.
1st I have tried using "the integrated default stuff":
check_files
path=d:\temp
warn='size gt 1G'
crit='size gt 2G'
And I can see that this checks only file sizes but not folder sizes.
Ok, so my next assumption is that I Will probably need to get a script on the internet for checking folder size, and put it on nsclient++ on Windows machine under scripts.
Here comes the fun part of being a rookie:
1ST QUESTION:
Would it be better that this written as VBS or POWERSHELL script or it really doesn't mater?
2ND QUESTION:
How do you enable the script to work with nsclient++?
Let me explain my question:
So GOOGLE returned me the results for folder size scripts for nagios usage and I found this VBS script which seems ok to me:
https://exchange.nagios.org/directory/P ... bs/details
The idea is that I wish to be alerted when 1 folder exceedes 5 GB of size.
So I have downloaded the VBS and copied it on Windows machine where NSCLIENT++ is installed: C:\Program Files\NSClient++\scripts
Now the next step I assumed you Will probably need to declare that you have a new super-trupper VBS script in the scripts folder so that NsCLient++ Will be aware of it. I assumed that you do that by editing:
C:\Program Files\NSClient++\nsclient.ini
So far everything logical except what to put in nsclient.ini?
On this txt (https://exchange.nagios.org/components/ ... 2&cf_id=29) it's saying that you must put:
set your nrpe.cfg for command for example
command[check_foldersize]=c:\windows\system32\cscript.exe //NoLogo //T:30 c:\nrpe_nt\bin\check_folder_size.vbs c:\yourfolder 50 78
50 70 are parameters for warning and critical value in MB
Logical, but I use Nsclient++ and not NRPE client on Windows machine, so I guess syntax will be different, right?
This is the ini file that I have it on Windows machine:
https://drive.google.com/file/d/0B_Cst0 ... sp=sharing
So what to put in ini for check_folder_size.vbs to work?
Do you configure it like allias?
Please respond
With best regards
I am a rookie in nagios stuff.
So far I have managed to install and configure:
Nagios on Linux CentOS 7
NagiosQL on Linux CentOS 7
NsClient++ 0.4.4.15
I am using integrated commands: (check_nrpe_arg_ssl) for checking free space on disk on Windows server.
$USER1$/check_nrpe -H $HOSTADDRESS$ -p 5888 -u -t 60 -c $ARG1$ -a $ARG2$ $ARG3$ $ARG4$ $ARG5$ $ARG6$ $ARG7$
check_drivesize
'drive=C'
'warn=used gt 80%'
'crit=used gt 90%'
So far so good.
Now the next step is to implement checking folder size on Windows Machines.
I'm tottaly lost here so please a little help.
1st I have tried using "the integrated default stuff":
check_files
path=d:\temp
warn='size gt 1G'
crit='size gt 2G'
And I can see that this checks only file sizes but not folder sizes.
Ok, so my next assumption is that I Will probably need to get a script on the internet for checking folder size, and put it on nsclient++ on Windows machine under scripts.
Here comes the fun part of being a rookie:
1ST QUESTION:
Would it be better that this written as VBS or POWERSHELL script or it really doesn't mater?
2ND QUESTION:
How do you enable the script to work with nsclient++?
Let me explain my question:
So GOOGLE returned me the results for folder size scripts for nagios usage and I found this VBS script which seems ok to me:
https://exchange.nagios.org/directory/P ... bs/details
The idea is that I wish to be alerted when 1 folder exceedes 5 GB of size.
So I have downloaded the VBS and copied it on Windows machine where NSCLIENT++ is installed: C:\Program Files\NSClient++\scripts
Now the next step I assumed you Will probably need to declare that you have a new super-trupper VBS script in the scripts folder so that NsCLient++ Will be aware of it. I assumed that you do that by editing:
C:\Program Files\NSClient++\nsclient.ini
So far everything logical except what to put in nsclient.ini?
On this txt (https://exchange.nagios.org/components/ ... 2&cf_id=29) it's saying that you must put:
set your nrpe.cfg for command for example
command[check_foldersize]=c:\windows\system32\cscript.exe //NoLogo //T:30 c:\nrpe_nt\bin\check_folder_size.vbs c:\yourfolder 50 78
50 70 are parameters for warning and critical value in MB
Logical, but I use Nsclient++ and not NRPE client on Windows machine, so I guess syntax will be different, right?
This is the ini file that I have it on Windows machine:
https://drive.google.com/file/d/0B_Cst0 ... sp=sharing
So what to put in ini for check_folder_size.vbs to work?
Do you configure it like allias?
Please respond
With best regards