CheckFileSize not working on Nsclient ++ 0.52 version

An open discussion forum for obtaining help with Nagios Core. Nagios Core users of all experience levels are welcome here. Subforum have been created for the discussion of Nagios Core and Nagios Plugin development.

NOTE: The SourceForge.net mailing lists have been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

CheckFileSize not working on Nsclient ++ 0.52 version

Postby rohithroki » Tue May 08, 2018 9:20 am

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: 115
Joined: Mon Nov 30, 2015 6:12 am

Re: CheckFileSize returning error in Nagios server

Postby rohithroki » Tue May 08, 2018 11:27 am

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

Re: CheckFileSize not working on Nsclient ++ 0.52 version

Postby npolovenko » Tue May 08, 2018 4:38 pm

Hi, @rohithroki. Looks like there is a bit different syntax in the newer version of the nsclient:
https://support.nagios.com/kb/article/file-and-folder-checks-783.html
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
npolovenko
Support Tech
 
Posts: 1833
Joined: Mon May 15, 2017 5:00 pm

Re: CheckFileSize not working on Nsclient ++ 0.52 version

Postby rohithroki » Wed May 09, 2018 12:51 pm

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

Re: CheckFileSize not working on Nsclient ++ 0.52 version

Postby kyang » Thu May 10, 2018 1:32 pm

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.
viewtopic.php?f=7&t=46910&hilit=+check+files
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
kyang
Support Tech
 
Posts: 1792
Joined: Tue Jul 25, 2017 3:35 pm

Re: CheckFileSize not working on Nsclient ++ 0.52 version

Postby rohithroki » Thu May 17, 2018 11:29 pm

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

Re: CheckFileSize not working on Nsclient ++ 0.52 version

Postby kyang » Fri May 18, 2018 11:19 am

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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
kyang
Support Tech
 
Posts: 1792
Joined: Tue Jul 25, 2017 3:35 pm

Re: CheckFileSize not working on Nsclient ++ 0.52 version

Postby rohithroki » Tue May 22, 2018 9:38 am

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

Re: CheckFileSize not working on Nsclient ++ 0.52 version

Postby kyang » Tue May 22, 2018 2:12 pm

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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
kyang
Support Tech
 
Posts: 1792
Joined: Tue Jul 25, 2017 3:35 pm

Re: CheckFileSize not working on Nsclient ++ 0.52 version

Postby rohithroki » Mon Jun 25, 2018 6:10 am

Hi Kyang,

The issue has been fixed.Please lock the thread.

Cheers,
Simbu.S
rohithroki
 
Posts: 115
Joined: Mon Nov 30, 2015 6:12 am

Next

Return to Nagios Core

Who is online

Users browsing this forum: No registered users and 29 guests