Need help In Configuring check_winfile

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.
sh.shekhar89
Posts: 52
Joined: Fri Oct 10, 2014 3:17 pm

Need help In Configuring check_winfile

Post 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.
Attachments
nsclient.ini
nsclient file
(21.2 KiB) Downloaded 151 times
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Need help In Configuring check_winfile

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Need help In Configuring check_winfile

Post 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?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
sh.shekhar89
Posts: 52
Joined: Fri Oct 10, 2014 3:17 pm

Re: Need help In Configuring check_winfile

Post 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. :(
sh.shekhar89
Posts: 52
Joined: Fri Oct 10, 2014 3:17 pm

Re: Need help In Configuring check_winfile

Post 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??
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Need help In Configuring check_winfile

Post by abrist »

Can you check your windows nsclient.log file for any details about the connection failure?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Need help In Configuring check_winfile

Post 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
	}	
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
sh.shekhar89
Posts: 52
Joined: Fri Oct 10, 2014 3:17 pm

Re: Need help In Configuring check_winfile

Post 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 ??
Attachments
nsclient.ini
Windows Nsclient configuration File
(21.2 KiB) Downloaded 142 times
Error
Error
sh.shekhar89
Posts: 52
Joined: Fri Oct 10, 2014 3:17 pm

Re: Need help In Configuring check_winfile

Post by sh.shekhar89 »

Hi abrist,

Please help me in configuring check_winfile.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Need help In Configuring check_winfile

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