Page 1 of 2

Need help In Configuring check_winfile

Posted: Fri Oct 10, 2014 3:41 pm
by sh.shekhar89
Hello Everyone!!

I am new to nagios, i want count files for a particular folder.I searched on net and found plugin check_winfile, which can be used to count number of files.

I am trying to test but i am getting error : CHECK_NRPE: recived 0 bytes from daemon.

for nsclient i am using version 0.4.1.73-x64.

I am attaching nsclient.ini file.please check the configuration file,correct me if am wrong.

Please help me out in fixing the issue.

Re: Need help In Configuring check_winfile

Posted: Fri Oct 10, 2014 5:06 pm
by Box293
NSClient has this functionality built into it:

Check the amount of files in a folder (and sub-folders). Generate a warning if more that 500 files exist, critical if more than 1000 files exist.

Code: Select all

Command:
check_nrpe -H 192.168.142.1 -t 30 -c CheckFiles -a path='C:\\NO BACKUP' pattern=*.* 'master-syntax={%total% Files Found}' MaxWarn=500 MaxCrit=1000

Output:
{12347 Files Found}, found files: 12347 > critical|'found files'=12347;500;1000
There are more examples on my site: http://sites.box293.com/nagios/guides/c ... es-folders

Re: Need help In Configuring check_winfile

Posted: Fri Oct 10, 2014 5:09 pm
by abrist
I presume 192.168.1.4 is your nagios server?
From the nagios server, can you just check the nrpe version?
With ssl:

Code: Select all

./check_nrpe -H <windows ip> 
Without ssl:

Code: Select all

./check_nrpe -H <windows ip> -n
If that does not work, is the port open?

Code: Select all

nmap <windows ip> -p 5666
Finally, is the nsclient service running on the windows server?
Did you restart the nsclient service after making the changes to nsclient.ini?

Re: Need help In Configuring check_winfile

Posted: Fri Oct 10, 2014 11:30 pm
by sh.shekhar89
Hi abrist,
When i do nmap for my windows client i got the following output :
[root@vmNagiosSever libexec]# nmap 192.168.1.150 -p 5666

Starting Nmap 5.51 ( http://nmap.org ) at 2014-10-11 09:56 IST
Nmap scan report for 192.168.1.150
Host is up (0.0020s latency).
PORT STATE SERVICE
5666/tcp open nrpe
MAC Address: 00:0C:29:9B:25:C8 (VMware)

Nmap done: 1 IP address (1 host up) scanned in 0.41 seconds
[root@vmNagiosSever libexec]#

But When i do check_nrpe, i got the following error :
[root@vmNagiosSever libexec]# ./check_nrpe -H 192.168.1.150
CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages.
[root@vmNagiosSever libexec]# ./check_nrpe -H 192.168.1.150 -n
CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages.
[root@vmNagiosSever libexec]#


Please help me to fix the issue. :(

Re: Need help In Configuring check_winfile

Posted: Fri Oct 10, 2014 11:32 pm
by sh.shekhar89
Hi Box293,

Can you explain me how we can monitor?? do i have to add some configuration lines in command.cfg and windows.cfg?? Can you explain me?

suppose if i want to monitor a folder which is in c drvie and number of files should not exceed 3000. than??

Re: Need help In Configuring check_winfile

Posted: Mon Oct 13, 2014 11:58 am
by abrist
Can you check your windows nsclient.log file for any details about the connection failure?

Re: Need help In Configuring check_winfile

Posted: Mon Oct 13, 2014 12:04 pm
by Box293
sh.shekhar89 wrote:But When i do check_nrpe, i got the following error :
[root@vmNagiosSever libexec]# ./check_nrpe -H 192.168.1.150
CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages.
[root@vmNagiosSever libexec]# ./check_nrpe -H 192.168.1.150 -n
CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages.
[root@vmNagiosSever libexec]#
Can you please restart the NSClient service on your windows box and try again.

You will need a command definition like:

Code: Select all

define command {
       command_name                  		check_nrpe
       command_line                  		$USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c $ARG1$ $ARG2$
}
And a service definition like:

Code: Select all

define service {
	host_name			your_host
	service_description		files check
	check_command			check_nrpe!CheckFiles!-a path='C:\\TEST' pattern=*.* 'master-syntax={%total% Files Found}' MaxCrit=3000
	max_check_attempts		5
	check_interval			5
	retry_interval			1
	check_period			24x7
	notification_interval		60
	notification_period		24x7
	register			1
	}	

Re: Need help In Configuring check_winfile

Posted: Sat Oct 18, 2014 5:39 am
by sh.shekhar89
Hi Box293,

I did the same thing but i am getting error, saying " missing arguments"

But when i am trying from nagios server through terminal, i am getting the following output [screen shot attached and configuration files attached]:

Command :
./check_nrpe -H 192.168.1.12 -t 30 -c CheckFiles -a path='C:\Program Files\NSClient++\' pattern=*.* 'syntax={%total% Files Found}' MaxCrit=80

Output :
"{79 Files Found}, {79 Files Found}, {79 Files Found}, {79 Files Found}, {79 Files Found}, {79 Files Found}, {79 Files Found}, {79 Files Found}, {79 Files Found}, {79 Files Found}, {79 Files Found}, {79 Files Found}, {79 Files Found}, {79 Files Found}, {79 Files Found}, {79 Files Found}, {79 Files Found}, {79 Files Found}, {79 Files Found}, {79 Files Found}, {79 Files Found}, {79 Files Found}, {79 Files Found}, {79 Files Found}, {79 Files Found}, {79 Files Found}, {79 Files Found}, {79 Files Found}, {79 Files Found}, {79 Files Found}, {79 Files Found}, "


Any solution to this??

Why i am not able to get the value in nagios?? in wepage its showing "Missing argument"

Here is my Command.cfg ::
"define command{
command_name check_nrpe
command_line /usr/local/nagios/libexec/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}



define command {
command_name check_nrpe_files
command_line /usr/local/nagios/libexec/check_nrpe -H $HOSTADDRESS$ -t 30 -c $ARG1$ $ARG2$
}"

Defination configuration ::
"define service {

use generic-service,srv-pnp
host_name winserver
service_description Files Check
check_command check_nrpe!CheckFiles! -a path='C:\Program Files\NSClient++\' pattern=*.* 'master-syntax={%total% Files Found}' MaxWarn=500 MaxCrit=3000
}
"

Any fix to this error ??

Re: Need help In Configuring check_winfile

Posted: Sat Oct 18, 2014 7:20 am
by sh.shekhar89
Hi abrist,

Please help me in configuring check_winfile.

Re: Need help In Configuring check_winfile

Posted: Mon Oct 20, 2014 11:37 am
by Box293
Use master-syntax instead of syntax
Also, use double back slashes for the folder path

Code: Select all

Command:
./check_nrpe -H 192.168.207.1 -t 30 -c CheckFiles -a path='C:\\Program Files\\NSClient++\\' pattern=*.* 'master-syntax={%total% Files Found}' MaxCrit=80

Output:
{111 Files Found}|'count'=111;0;80