Page 1 of 2
CheckFileSize not working on Nsclient ++ 0.52 version
Posted: Tue May 08, 2018 9:20 am
by rohithroki
Hello Experts,
I need to check the file size of the path in windows
Nsclient version : 0.52
I am defining the commands in commands.cfg in Nagios server
define command{
command_name CheckFileSize
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckFileSize -a ShowAll MaxWarn=$ARG1$ MaxCrit=$ARG2$ File:$ARG3$=$ARG4$
}
but I am getting the output as
./check_nrpe -H <IP Address> -c CheckFileSize -a ShowAll MaxWarn=1.5G MaxCrit=2G File:"Mail Box space"="D:/notes/data/mail.box"
Unknown command(s): checkfilesize
Is there any alternative plugin to get the file size of the path via check_nrpe?
Thanks in Advance
Simbu
Re: CheckFileSize returning error in Nagios server
Posted: Tue May 08, 2018 11:27 am
by rohithroki
Hello experts,
check File size is working perfectly on Nsclient 0.39 version
please find the output of the same
[root@INFSGDCNGOS04 libexec]# ./check_nrpe -H ,IP Address> -c CheckFileSize -a ShowAll MaxWarn=1.5G MaxCrit=2G File:"Mail Box space"="D:/notes/data/mail.box"
OK: Mail Box space: 3.25M|'Mail Box space'=3.25MB;1024;2048
It's not working on Nsclient++ 0.52 version.
[root@INFSGDCNGOS04 libexec]# ./check_nrpe -H 10.176.130.35 -c CheckFileSize -a ShowAll MaxWarn=1.5M MaxCrit=2M File:"nsf logs"="D:/notes/data/log.nsf"
Unknown command(s): checkfilesize
Please sort out this issue.
Thanks
Simbu
Re: CheckFileSize not working on Nsclient ++ 0.52 version
Posted: Tue May 08, 2018 4:38 pm
by npolovenko
Hi,
@rohithroki. Looks like there is a bit different syntax in the newer version of the nsclient:
https://support.nagios.com/kb/article/f ... s-783.html
Re: CheckFileSize not working on Nsclient ++ 0.52 version
Posted: Wed May 09, 2018 12:51 pm
by rohithroki
Hi ,
Thanks for your reply.
I have checked with latest File size syntax from nagios server and I am getting this error.
[root@INFSGDCNGOS04 libexec]# ./check_nrpe -H <IP address> -c check_files -a path='D:\\notes\\data\\log.nsf' "detail-syntax=%(mailbox): %(size)" "warn=size>20k"
CHECK_NRPE: No output returned from daemon.
I have tried with front & single slash as well ,it's not working.
Please help me out to fix the issue.
Regards,
Simbu
Re: CheckFileSize not working on Nsclient ++ 0.52 version
Posted: Thu May 10, 2018 1:32 pm
by kyang
I'm not sure what version of NSClient++ you are on now or if you are only mentioning about 0.52.
But try seeing if this works?
Code: Select all
/usr/local/nagios/libexec/check_nrpe -H <IP address> -c check_files -a "path=D:/notes/data/log.nsf" "detail-syntax=%(mailbox): %(size)" "warn=size>20k"
This is just based off of a previous forum thread examples I used.
https://support.nagios.com/forum/viewto ... heck+files
Re: CheckFileSize not working on Nsclient ++ 0.52 version
Posted: Thu May 17, 2018 11:29 pm
by rohithroki
Hi Kyang,
Thank you for the information.
But the Ideal thing is ,I need plugin to the check the file size inside the directory.
As the below mentioned output.
[root@INFSGDCNGOS04 libexec]# ./check_nrpe -H ,IP Address> -c CheckFileSize -a ShowAll MaxWarn=1.5G MaxCrit=2G File:"Mail Box space"="D:/notes/data/mail.box"
OK: Mail Box space: 3.25M|'Mail Box space'=3.25MB;1024;2048
We are using latest version of Nsclient
nsclient++ 0.5.2.35 , but the above plugin is not working in the latest version.
Please help me out to fix the issue.
Thanks,
Simbu
Re: CheckFileSize not working on Nsclient ++ 0.52 version
Posted: Fri May 18, 2018 11:19 am
by kyang
Hello,
According to the pages mentioned by npolovenko & NSClient++
https://support.nagios.com/kb/article/f ... s-783.html
https://docs.nsclient.org/reference/win ... file-sizes
Which uses check_files on 0.5+:
Here is my example for you. I have a folder with 3 text files inside. The path to the folder is A:\testCheck and the files along with the size of each are
file1(94kb),
file2(688kb),
file3(1,845kb).
Code: Select all
./check_nrpe -H 192.168.3.242 -c check_files -a 'path=A:\testCheck' pattern=*.txt 'detail-syntax=%(filename): %(size)' 'warn=size>500k' max-depth=1
WARNING: 2/3 files (file2.txt: 704352, file3.txt: 1888944)|'file1.txt size'=93.79687KB;500;0 'file2.txt size'=687.84375KB;500;0 'file3.txt size'=1.80143MB;0.48828;0
So it's showing, 2 of the 3 files are over my
"warn=size>500k". Specifically file2 and file3.
You can also see the perfdata is showing the size of each file.
Code: Select all
'file1.txt size'=93.79687KB;500;0 'file2.txt size'=687.84375KB;500;0 'file3.txt size'=1.80143MB;0.48828;0
You can change it to warn you about any size of the files within the folder. This is just an example to get you going the right direction.
Re: CheckFileSize not working on Nsclient ++ 0.52 version
Posted: Tue May 22, 2018 9:38 am
by rohithroki
Hi Kyang,
Thanks for the update.
It's working fine.
[root@INFSGDCNGOS04 libexec]# ./check_nrpe -H <IP Address> -p 5666 -c check_files -a "path=D:\notes\data\mail.box" 'detail-syntax=%(filename): %(size)' 'warn=size>3.2M' 'crit=size>2G' max-depth=1
WARNING: 1/1 files (mail.box: 3407872)|'mail.box size'=0.00317GB;0.00292;2
Is there any argument to get output as GB or MB
Code: Select all
WARNING: 1/1 files [b](mail.box: 3407872)[/b]
It will very easy to identify the exact information.
Please help to sort this issue.
Thanks,
Simbu
Re: CheckFileSize not working on Nsclient ++ 0.52 version
Posted: Tue May 22, 2018 2:12 pm
by kyang
It looks like there isn't a way to do this.
Looking at the documentation for 0.5.2
https://docs.nsclient.org/reference/win ... heck_files
Also, there was a Feature Request added to NSClient github a while back on this same matter with check_files, but the author has yet to add it in.
https://github.com/mickem/nscp/issues/125
Unfortunately, that is the only way as we do not maintain anything about NSClient.
Re: CheckFileSize not working on Nsclient ++ 0.52 version
Posted: Mon Jun 25, 2018 6:10 am
by rohithroki
Hi Kyang,
The issue has been fixed.Please lock the thread.
Cheers,
Simbu.S