Check number of files on a directory

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.

Re: Check number of files on a directory

Postby cocoyanouck » Thu May 18, 2017 1:41 am

Arf ... :cry:

Code: Select all
root@nagios-debian:/home/nagios# /usr/local/nagios/libexec/check_nrpe -H 10.20.2.12 -c check_files -a path='C:\\Windows'
CHECK_NRPE STATE CRITICAL: Socket timeout after 10 seconds.
root@nagios-debian:/home/nagios# /usr/local/nagios/libexec/check_nrpe -H 10.20.2.12
Erreur de segmentation
Attachments
nsclient.log
(25.14 KiB) Downloaded 3 times
cocoyanouck
 
Posts: 54
Joined: Fri Apr 08, 2016 3:17 am

Re: Check number of files on a directory

Postby tgriep » Thu May 18, 2017 10:14 am

Edit the nsclient.ini file and remove all of nagios-debian entries,
Find this entry and change it from
Code: Select all
allow nasty characters = 1

to
Code: Select all
allow nasty characters = true


Find this entry and change it from
Code: Select all
level = info

to
Code: Select all
level = debug


save the file and restart the NSClient++ service.

Then run the check_nrpe command with the log file enabled to see if it captures any errors.
Code: Select all
/usr/local/nagios/libexec/check_nrpe -H 10.20.2.12 -g /tmp/nrpe.log


If it fails, post the /tmp/nrpe.log file from the Nagios server and the nsclient.log file and the updated nsclient.ini file from the Windows Host.

One question, do you have the check_nrpe command working with other Windows servers?
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
tgriep
Madmin
 
Posts: 5019
Joined: Thu Oct 30, 2014 9:02 am

Re: Check number of files on a directory

Postby cocoyanouck » Mon May 22, 2017 5:05 am

I have made all the modification, then :

Code: Select all
root@nagios-debian:/home/nagios# /usr/local/nagios/libexec/check_nrpe -H 10.20.2.12 -g /tmp/nrpe.log
I (0.5.0.62 2016-09-14) seem to be doing fine...


And the nsclient.log :

Code: Select all
2017-05-22 18:03:19: debug:c:\source\master\include\nrpe/server/protocol.hpp:72: Accepting connection from: 10.20.2.33, count=1
2017-05-22 18:03:19: debug:c:\source\master\include\nrpe/server/protocol.hpp:72: Accepting connection from: 10.20.2.33, count=1
2017-05-22 18:04:36: debug:c:\source\master\include\nrpe/server/protocol.hpp:72: Accepting connection from: 10.20.2.33, count=1
2017-05-22 18:04:36: debug:c:\source\master\include\nrpe/server/protocol.hpp:72: Accepting connection from: 10.20.2.33, count=1
2017-05-22 18:04:36: debug:c:\source\master\include\nrpe/server/protocol.hpp:72: Accepting connection from: 10.20.2.33, count=1
2017-05-22 18:04:36: debug:c:\source\master\include\nrpe/server/protocol.hpp:72: Accepting connection from: 10.20.2.33, count=1
2017-05-22 18:04:36: debug:c:\source\master\include\nrpe/server/protocol.hpp:72: Accepting connection from: 10.20.2.33, count=1
2017-05-22 18:04:36: debug:c:\source\master\include\nrpe/server/protocol.hpp:72: Accepting connection from: 10.20.2.33, count=1


I already use this file "nsclient.ini" and the command check_nrpe in order to check how many files there are in specifics folders. But not on this nagios-srv (which is located in a different country).
cocoyanouck
 
Posts: 54
Joined: Fri Apr 08, 2016 3:17 am

Re: Check number of files on a directory

Postby tgriep » Mon May 22, 2017 11:04 am

What do you mean by " But not on this nagios-srv (which is located in a different country)."

It looks like the check_nrpe test is working now without generating the Segmentation Error, and the nsclient.log file is not showing any errors.
Is the check_nrpe command that is checking the files in the D:\import\faxin folder functioning for you now?
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
tgriep
Madmin
 
Posts: 5019
Joined: Thu Oct 30, 2014 9:02 am

Re: Check number of files on a directory

Postby cocoyanouck » Tue May 23, 2017 1:49 am

I want to tell you that the command check_nrpe with the check_files was working on my another nagios server but not on this one.

root@nagios-debian:/home/nagios# /usr/local/nagios/libexec/check_nrpe -H 10.20.2.12 -c check_files -a path='C:\\Windows'
Erreur de segmentation

root@nagios-debian:/home/nagios# /usr/local/nagios/libexec/check_nrpe -H 10.20.2.12 -c check_files -a path='D:\\import\\faxin' pattern=*.* 'warning=count>100' 'critical=count>150'
Erreur de segmentation


And on the nsclient.log :

Code: Select all
root@nagios-debian:/home/nagios# /usr/local/nagios/libexec/check_nrpe -H 10.20.2.12 -c check_files -a path='C:\\Windows'
Erreur de segmentation
root@nagios-debian:/home/nagios# /usr/local/nagios/libexec/check_nrpe -H 10.20.2.12 -c check_files -a path='C:\\Windows'^C
root@nagios-debian:/home/nagios# /usr/local/nagios/libexec/check_nrpe -H 10.20.2.12 -c check_files -a path='D:\\import\\faxin' pattern=*.* 'warning=count>100' 'critical=count>150'
Erreur de segmentation


So strange :/
cocoyanouck
 
Posts: 54
Joined: Fri Apr 08, 2016 3:17 am

Re: Check number of files on a directory

Postby tgriep » Tue May 23, 2017 9:35 am

Ok, I understand now.
Lets replace the check_nrpe plugin on the Nagios server and see if that fixes the issue.
Look at this link
https://support.nagios.com/kb/article/nrpe-how-to-install-nrpe-v3-from-source.html
search for this section in the link for the instructions on installing the check_nrpe plugin.
Install check_nrpe Plugin Only
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
tgriep
Madmin
 
Posts: 5019
Joined: Thu Oct 30, 2014 9:02 am

Re: Check number of files on a directory

Postby cocoyanouck » Wed May 24, 2017 4:31 am

So, the installation of nrpe 3.1.0 is OK.

Launched these commands :
Code: Select all
root@nagios-debian:/home/nagios# /usr/local/nagios/libexec/check_nrpe -H 10.20.2.12
Erreur de segmentation
root@nagios-debian:/home/nagios# /usr/local/nagios/libexec/check_nrpe -H 10.20.2.12 -c check_files -a path='D:\\import\\faxin' pattern=*.* 'warning=count>100' 'critical=count>150'
Erreur de segmentation


Results :

Code: Select all
2017-05-24 17:29:29: debug:c:\source\master\include\nrpe/server/protocol.hpp:72: Accepting connection from: 10.20.2.33, count=1
2017-05-24 17:29:29: debug:c:\source\master\include\nrpe/server/protocol.hpp:72: Accepting connection from: 10.20.2.33, count=1
2017-05-24 17:29:29: debug:c:\source\master\include\check_nt/server/protocol.hpp:58: Accepting connection from: 10.20.2.33
2017-05-24 17:29:29: debug:c:\source\master\modules\NSClientServer\NSClientServer.cpp:302: Real command: check_drivesize drive=c warn=free<0 crit=free<0 filter=type='fixed' and mounted = 1 perf-config=used(unit:B)free(unit:B)
2017-05-24 17:29:31: debug:c:\source\master\include\nrpe/server/protocol.hpp:72: Accepting connection from: 10.20.2.33, count=1
2017-05-24 17:29:31: debug:c:\source\master\include\nrpe/server/protocol.hpp:72: Accepting connection from: 10.20.2.33, count=1
2017-05-24 17:29:31: debug:c:\source\master\include\check_nt/server/protocol.hpp:58: Accepting connection from: 10.20.2.33
2017-05-24 17:29:36: debug:c:\source\master\include\check_nt/server/protocol.hpp:58: Accepting connection from: 10.20.2.33
2017-05-24 17:29:36: debug:c:\source\master\modules\NSClientServer\NSClientServer.cpp:302: Real command: check_uptime warn=uptime<0
cocoyanouck
 
Posts: 54
Joined: Fri Apr 08, 2016 3:17 am

Re: Check number of files on a directory

Postby tgriep » Wed May 24, 2017 10:02 am

In the folder that you recompiled the check_nrpe command is a log file called config.log, can you post that file?
Can you run the following commands as root and post the output?
Code: Select all
uname -a
cat /etc/*release*


Can you run the check_nrpe command to another remote host without it crashing?
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
tgriep
Madmin
 
Posts: 5019
Joined: Thu Oct 30, 2014 9:02 am

Previous

Return to Nagios Core

Who is online

Users browsing this forum: Bing [Bot] and 11 guests