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
How to create Check Folder size
Re: How to create Check Folder size
As a not Windows guy, I can't tell you for sure, but I would say whatever you're the most comfortable in.bostjanc wrote:1ST QUESTION:
Would it be better that this written as VBS or POWERSHELL script or it really doesn't mater?
Take a look at this article, it should clear it up for you a bit: http://docs.nsclient.org/howto/external_scripts.htmlbostjanc wrote: How do you enable the script to work with nsclient++?
That's our job.bostjanc wrote:Please respond
Former Nagios Employee.
me.
me.
Re: How to create Check Folder size
Thank you for the reply.
I have manged to establish vbs script working
I needed to add this lines into ini file:
[/settings/external scripts]
allow arguments=true
[/settings/external scripts/scripts]
; my script
check_folder_size = cscript.exe //T:30 //NoLogo scripts\\check_folder_size.vbs "$ARG1$" "$ARG2$" "$ARG3$"
But now I have one more problem regarding the VBS scripting not working ok.
As soon as put SUBFOLDERS in PATH it does not work.
Working: D:\FOLDER
Not working:
D:\FOLDER\SUBFOLDER
D:\\FOLDER\\SUBFOLDER
"D:\FOLDER\SUBFOLDER"
'D:\FOLDER\SUBFOLDER'
Status information: " C:Program FilesNSClient++scriptscheck_folder_size.vbs(29, 1) Microsoft VBScript runtime error: Path not found "
I have manged to establish vbs script working
I needed to add this lines into ini file:
[/settings/external scripts]
allow arguments=true
[/settings/external scripts/scripts]
; my script
check_folder_size = cscript.exe //T:30 //NoLogo scripts\\check_folder_size.vbs "$ARG1$" "$ARG2$" "$ARG3$"
But now I have one more problem regarding the VBS scripting not working ok.
As soon as put SUBFOLDERS in PATH it does not work.
Working: D:\FOLDER
Not working:
D:\FOLDER\SUBFOLDER
D:\\FOLDER\\SUBFOLDER
"D:\FOLDER\SUBFOLDER"
'D:\FOLDER\SUBFOLDER'
Status information: " C:Program FilesNSClient++scriptscheck_folder_size.vbs(29, 1) Microsoft VBScript runtime error: Path not found "
Re: How to create Check Folder size
But the funny thing is that running VBS with arguments on client Works with no problem. With " or without it.
Re: How to create Check Folder size
I found the solution.
You need also to add to ini for it to work:
[/settings/NRPE/server]
allow nasty characters=true
[/settings/external scripts]
allow nasty characters=true
You need also to add to ini for it to work:
[/settings/NRPE/server]
allow nasty characters=true
[/settings/external scripts]
allow nasty characters=true
Re: How to create Check Folder size
Awesome! Yes, NSClient++ has some security in play to prevent everything from executing.
Are we good to mark this thread as resolved?
Are we good to mark this thread as resolved?
Former Nagios Employee
Re: How to create Check Folder size
Yep, case closed.
With best regards
With best regards