CheckFileSize not working on Nsclient ++ 0.52 version

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
rohithroki
Posts: 138
Joined: Mon Nov 30, 2015 6:12 am

CheckFileSize not working on Nsclient ++ 0.52 version

Post 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
Last edited by rohithroki on Tue May 08, 2018 11:28 am, edited 1 time in total.
rohithroki
Posts: 138
Joined: Mon Nov 30, 2015 6:12 am

Re: CheckFileSize returning error in Nagios server

Post 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
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: CheckFileSize not working on Nsclient ++ 0.52 version

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
rohithroki
Posts: 138
Joined: Mon Nov 30, 2015 6:12 am

Re: CheckFileSize not working on Nsclient ++ 0.52 version

Post 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
kyang

Re: CheckFileSize not working on Nsclient ++ 0.52 version

Post 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
rohithroki
Posts: 138
Joined: Mon Nov 30, 2015 6:12 am

Re: CheckFileSize not working on Nsclient ++ 0.52 version

Post 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
kyang

Re: CheckFileSize not working on Nsclient ++ 0.52 version

Post 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.
rohithroki
Posts: 138
Joined: Mon Nov 30, 2015 6:12 am

Re: CheckFileSize not working on Nsclient ++ 0.52 version

Post 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
kyang

Re: CheckFileSize not working on Nsclient ++ 0.52 version

Post 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.
rohithroki
Posts: 138
Joined: Mon Nov 30, 2015 6:12 am

Re: CheckFileSize not working on Nsclient ++ 0.52 version

Post by rohithroki »

Hi Kyang,

The issue has been fixed.Please lock the thread.

Cheers,
Simbu.S
Locked