I can't find the error in my .cfg file

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.
Locked
jbruyet
Posts: 235
Joined: Wed Dec 28, 2011 12:14 pm

I can't find the error in my .cfg file

Post by jbruyet »

Hey all, I'm creating a .cfg file so I can monitor services on my Windows file servers but I'm getting this when I test the file:

Processing object config file '/usr/local/nagios/etc/objects/WinServer_nrpe.cfg'...
Error: Unexpected start of object definition in file '/usr/local/nagios/etc/objects/WinServer_nrpe.cfg' on line 167. Make sure you close preceding objects before starting a new one.
Error processing object config files!

Here's my Service Definitions section:

###############################################################################
# SERVICE DEFINITIONS
###############################################################################

define service {
use generic-service
hostgroup winserver_nrpegroup
service_description CPU Check
check_command check_nrpe!checkCPU -a warn=100 crit=100 time=1 warn=95 crit=99 time=5 warn=90 crit=95 tim$
}

define service {
use generic-service
hostgroup winserver_nrpegroup
service_description Hard Disk Check
check_command check_nrpe!CheckDriveSize -a ShowAll MinWarnFree=10% MinCritFree=5% Drive=c:\
}

define service {
use generic-service
hostgroup winserver_nrpegroup
service_description Memory Check
check_command check_nrpe!CheckMEM -a MaxWarn=80% MaxCrit=90% ShowAll type=physical
}

define service {
use generic-service
hostgroup winserver_nrpegroup
service_description System Uptime
check_command check_nrpe!CheckUpTime -a MinWarn=1d MinCrit=12h
}


The bolded line is line 167. AND, if I comment out the last two service definitions in the file I get this:

Processing object config file '/usr/local/nagios/etc/objects/WinServer_nrpe.cfg'...
Error: Unexpected EOF in file '/usr/local/nagios/etc/objects/WinServer_nrpe.cfg' on line 180 - check for a missing closing bracket.
Error processing object config files!

I've gone through and confirmed that all brackets are there. I even went through and deleted and replaced all of the curly brackets in the entire file. A couple of times now. Anyone have any ideas on what's happening? As much as I hate to say it I copied a working .cfg file for my XP workstations to my Windows workstation and did a Cut and Paste so I wouldn't have to type everything and risk having an error stop me. I used WordPad for the cutting and pasting :roll: . Is it possible there's a format artifact in my file now that's causing me this grief? Any and all ideas, suggestions and recommendations are welcome.

Thanks,

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

Re: I can't find the error in my .cfg file

Post by jsmurphy »

Something about this line smells funny:

check_command check_nrpe!checkCPU -a warn=100 crit=100 time=1 warn=95 crit=99 time=5 warn=90 crit=95 tim$

Specifically that bit at the end that says tim$, I haven't actually read through the config thoroughly but it looks like you are opening a macro here that never ends (or never starts).
agriffin
Posts: 876
Joined: Mon May 09, 2011 9:36 am

Re: I can't find the error in my .cfg file

Post by agriffin »

I think it is more likely that the backslash at the end of this line is causing the issue:

Code: Select all

check_command check_nrpe!CheckDriveSize -a ShowAll MinWarnFree=10% MinCritFree=5% Drive=c:\
Try doubling up the backslash so that there are two of them.
User avatar
jsmurphy
Posts: 989
Joined: Wed Aug 18, 2010 9:46 pm

Re: I can't find the error in my .cfg file

Post by jsmurphy »

agriffin wrote:I think it is more likely that the backslash at the end of this line is causing the issue:

Code: Select all

check_command check_nrpe!CheckDriveSize -a ShowAll MinWarnFree=10% MinCritFree=5% Drive=c:\
Try doubling up the backslash so that there are two of them.
I considered that, but all the examples on the NSclient++ wiki are written exactly in that manner which made me think that perhaps the end of line character negated the need for it. Maybe the NSC wiki needs updating.

Ninja edit: Noticed that the config example does have the backslash it's the command line examples that don't.
Last edited by jsmurphy on Thu May 17, 2012 6:17 pm, edited 1 time in total.
jbruyet
Posts: 235
Joined: Wed Dec 28, 2011 12:14 pm

Re: I can't find the error in my .cfg file

Post by jbruyet »

Thanks agriffin and jsmurphy. I gave agriffin top billing here because the issue was indeed the single backslash at the end of the line. I added a second backslash and we rolled right on by.

Thanks for the help,

Joe B
agriffin
Posts: 876
Joined: Mon May 09, 2011 9:36 am

Re: I can't find the error in my .cfg file

Post by agriffin »

Glad everything got worked out.
Locked