Check_WinFile Nagios NRPE help please

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.
csward
Posts: 46
Joined: Fri Mar 08, 2013 4:37 pm

Check_WinFile Nagios NRPE help please

Post by csward »

I'm new to Nagios and working my way through it. I need to have a file count on one of my server folders and am trying to get the Check_WinFile plugin working. Here is my config so far:

Commands.cfg:

#check_winfile
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ $ARG1$ $ARG2$
}

Windows.cfg:
define service {

host_name CSXENCLUFS
service_description File Count
check_command check_nrpe!check_winfile
use generic-service
notification_interval 0
}

Windows NSClient.ini file:

; check_winfile - Alias for alias_volumes. To configure this item add a section called: /settings/external scripts/alias/alias_volumes
check_winfile = check_winfile.exe --target C:\Traces --warn 10 --critical 25


The plugin is installed in the Scripts folder and the Check_WinFile.exe is located C:\Program Files\NSClient++


I continue to get this error:

Return code of 127 is out of bounds - plugin may be missing)

I have defined the plugin, so I'm not sure why it isn't working here. Any help would be appreciated. Thanks
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Check_WinFile Nagios NRPE help please

Post by slansing »

The definitions are case sensitive, so if the plugin is indeed named:

Code: Select all

Check_WinFile.exe
It must be defined as such, like so:

Code: Select all

check_winfile = Check_WinFile.exe --target C:\Traces --warn 10 --critical 25

Also, if you plan to supply custom warning and critical variables to the plugin you will need to set it up to receive arguments, for example the alias I have shown below calls the runcmd.bat script and passes it $ARG1$ that is set from nagios with the -a flag on the check command. Unless you would like to change the warning and critical values by hand in the NSClient/NSC.ini file you would probably want to set them to receive $ARG2$ and $ARG3$ or something along those lines instead of the hard coded values:

Example definition in a NSC.ini file:

Code: Select all

servicerestart= scripts\runcmd.bat $ARG1$
csward
Posts: 46
Joined: Fri Mar 08, 2013 4:37 pm

Re: Check_WinFile Nagios NRPE help please

Post by csward »

ok, fixed the case sensitive issues. Took out the argument statements and updated my config to something a bit easier as I just want to get it working before adding the arguments. Here is my updated config:

INI file:

; Check File Count
check_winfile = check_winfile.exe --target C:\Traces --warn 10 --critical 25

Define Service:
define service {

host_name CSXENCLUFS
service_description File Count
check_command check_nrpe!check_winfile
use generic-service
notification_interval 0
}

Define Command:#check_winfile
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$
}

So shouldn't this work? the service points to check_nrpe > the command points to the server > the server ini points to the file and should run, yes?
User avatar
jsmurphy
Posts: 989
Joined: Wed Aug 18, 2010 9:46 pm

Re: Check_WinFile Nagios NRPE help please

Post by jsmurphy »

I think your problem is likely that you need to put the full path to Check_WinFile.exe i.e. C:\program files\nsclient++\scripts\Check_WinFile.exe or whatever the path happens to be.

check_winfile = "C:\program files\nsclient++\scripts\Check_WinFile.exe" --target C:\Traces --warn 10 --critical 25

Nine times out of ten return code 127 means it can't find the path to a plugin.

Ninja edit:
I just realised your nrpe command definition is not accepting any arguments either which is more likely to be your problem...
Define Command:#check_winfile
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$
}
Should be:
Define Command:#check_winfile
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
csward
Posts: 46
Joined: Fri Mar 08, 2013 4:37 pm

Re: Check_WinFile Nagios NRPE help please

Post by csward »

update ***I just realised your nrpe command definition is not accepting any arguments either which is more likely to be your problem...***
-This must be it. I'll take a look at it now.



Ok, so now everything shows good (although its not). Looks like nagios is correctly seeing the check_nrpe plugin (I needed to adjust the plugin location), but now nagios isn't giving me any warning or critical alerts as I have more than the amount of files then the .ini file states

Still continues to give me this:
File Count OK 03-19-2013 16:49:22 0d 0h 43m 49s 1/3 I (0,4,1,73 2012-12-17) seem to be doing fine...

It doesn't seem like it is calling the check_winfile.exe

I also tried specifing the full path in my .ini file:

check_winfile = C:\Program Files\NSClient++\scripts\check_winfile.exe --target C:\Traces --warn 5 --critical 25

Here are the logs I saw:
2013-03-19 16:31:33: l:d:\source\nscp\trunk\modules\checkexternalscripts\commands.hpp:100: Failed to parse arguments for command 'check_winfile', using old split string method: unknown escape sequence: check_winfile.exe --target C:\Traces --warn 5 --critical 25
2013-03-19 16:56:37: l:d:\source\nscp\trunk\modules\checkexternalscripts\commands.hpp:100: Failed to parse arguments for command 'check_winfile', using old split string method: unknown escape sequence: C:\Program Files\NSClient++\scripts\check_winfile.exe --target C:\Traces --warn 5 --critical 25

Any ideas?
csward
Posts: 46
Joined: Fri Mar 08, 2013 4:37 pm

Re: Check_WinFile Nagios NRPE help please

Post by csward »

Well, now i'm getting this error. I have adjusted the definitions to be:

#check_winfile
define command{
command_name check_nrpe
command_line /usr/local/src/nagios-plugins-1.4.16/plugins/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}



define service {

host_name CSXENCLUFS
service_description File Count
check_command check_nrpe!check_winfile
use generic-service
notification_interval 0
}


INI File
; Check File Count
check_winfile = C:\Program Files\NSClient++\scripts\check_winfile.exe --target C:\Traces --warn 5 --critical 8


This is the output I'm getting now:
(No output returned from plugin)

Any reason why this wouldn't be sending the data back?

Thanks
User avatar
jsmurphy
Posts: 989
Joined: Wed Aug 18, 2010 9:46 pm

Re: Check_WinFile Nagios NRPE help please

Post by jsmurphy »

Which version of NSClient++ is this? If it's v0.3.x then make sure that the command is under the [NRPE Handlers] heading or NSclient will think you're a crazy person.

I'm still not 100% clear with 0.4.x how all this works as we are only just starting to put it into production ourselves, the problem is the documentation on the nsclient++ site hasn't quite caught up yet. With my current understanding of 0.4 it would go under the external scripts/scripts heading... so it would look like this:

[/settings/external scripts/scripts]
check_winfile="C:\Program Files\NSClient++\Scripts\Check_WinFile.exe" --target C:\\Traces --warn 5 --critical 25

I believe a valid alternative format for the command is:
check_winfile=scripts\\Check_WinFile.exe --target C:\\Traces --warn 5 --critical 25

The error message you posted says to me it's trying to escape something so double backslashes should solve that.
csward
Posts: 46
Joined: Fri Mar 08, 2013 4:37 pm

Re: Check_WinFile Nagios NRPE help please

Post by csward »

Thanks for the help on this. I'm still a little confused on:

With my current understanding of 0.4 it would go under the external scripts/scripts heading...

I am using nsclient 0.4x

Are you saying there should be a specific area in the INI file that this goes under? Where are the NRPE handlers?
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Check_WinFile Nagios NRPE help please

Post by abrist »

In 0.4.x, the NRPE handlers section was absorbed into the "External Scripts" section. Do you have the section "[/settings/external scripts/scripts]" in your 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.
csward
Posts: 46
Joined: Fri Mar 08, 2013 4:37 pm

Re: Check_WinFile Nagios NRPE help please

Post by csward »

The closest I have (I'm guessing this is it) is this:


; A list of aliases available. An alias is an internal command that has been "wrapped" (to add arguments). Be careful so you don't create loops (ie check_loop=check_a, check_a=check_loop)
[/settings/external scripts/alias]


It is under that section. I have attached my INI file to this post.
Attachments
nsclient.ini
INI File
(7.34 KiB) Downloaded 620 times
Locked