Any assistance will be greatly appreciated


#1

A brief account of what I have done so far:

  1. Installed and compiled Nagios 1.3 (New installation)

  2. Installed and compiled Nagios Plugin 1.4.2 (New installation)

Problem arise when I’m doing some verifying thing: …/bin/nagios -v nagios.cfg
(Taken from onlamp.com/pub/a/onlamp/2002 … agios.html)

I will hit the below error:

Reading configuration data…
Error: Unexpected token or statement in file ‘/usr/local/nagios/etc/checkcommands.cfg’ on line 49.

***> One or more problems was encountered while processing the config files…

 Check your configuration file(s) to ensure that they contain valid
 directives and data defintions.  If you are upgrading from a previous
 version of Nagios, you should be aware that some variables/definitions
 may have been removed or modified in this version.  Make sure to read
 the HTML documentation on the main and host config files, as well as the
 'Whats New' section to find out what has changed.

===============================================

Anyone has any ideas what went wrong? Because my nagios installation is a new setup and not an upgrade. Any assistance will be greatly appreciated.


#2

Hi

Can you post your /usr/local/nagios/etc/checkcommands.cfg file. Usually this is caused by typos or syntax errors, or trying to reference something (like a plugin or host/service) that does not exist or is inaccessable.

Check to make sure that the appropriate plugin exists in /usr/local/nagios/libexec. Check the syntax of the command that is flagging the error. You may want to su to the nagios user and ensure that the user can read and exicute the required files.

Hope this helps and good luck with your implementation.

Steve


#3

Thanks Steve! :slight_smile:

You have also made me realised that although my installation was successful, my Nagios folder does not comes with etc (I created the etc folder manually) and libexec folder (Even I followed the manual closely :x )

Anyway here’s my checkcommands.cfg (I have copied all samples files from the sample-config folder to the manually created etc folder)

========================================================

These are some example service check commands. They may or may not work on

your system, as they must be modified to work with the version of the plugins

you are using!

command[check_tcp]=$USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$
command[check_udp]=$USER1$/check_udp -H $HOSTADDRESS$ -p $ARG1$
command[check_ftp]=$USER1$/check_ftp -H $HOSTADDRESS$
command[check_pop]=$USER1$/check_pop -H $HOSTADDRESS$
command[check_smtp]=$USER1$/check_smtp -H $HOSTADDRESS$
command[check_nntp]=$USER1$/check_nntp -H $HOSTADDRESS$
command[check_http]=$USER1$/check_http -H $HOSTADDRESS$
command[check_telnet]=$USER1$/check_tcp -H $HOSTADDRESS$ -p 23
command[check_ping]=$USER1$/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p 5

These are examples of commands for checking “local” services - i.e. things

on this machine that cannot be checked from remote machines. If you want

to monitor disk space, users, processes, etc. on remote machines, look into

using the check_snmp or check_by_ssh plugins or by using an addon like NRPE.

command[check_local_disk]=$USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
command[check_local_users]=$USER1$/check_users -w $ARG1$ -c $ARG2$
command[check_local_procs]=$USER1$/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
command[check_local_load]=$USER1$/check_load -w $ARG1$ -c $ARG2$

This command checks to see if a host is “alive” by pinging it

Note: The warning and critical thresholds are pretty high for real use,

but this works as an example

command[check-host-alive]=$USER1$/check_ping -H $HOSTADDRESS$ -w 2000.0,60% -c 5000.0,100% -p 5

Should I perform a re-installation again? Or should I just focus on this particular problem instead? Anyway thanks again Steve!


#4

The information you sent looks fine, but you are still getting the message: Error: Unexpected token or statement in file ‘/usr/local/nagios/etc/checkcommands.cfg’ on line 49

if so this is a syntax error in the checkcommands.cfg. Look at the checkcommand on line 49 in your check commands file somewhere in that checkcommand is an error. Nagios is pretty picky in regards to syntax. I was looking through the defauld installation and I could run the nagios process from these. My commands look much different than the ones you posted:

‘check_tcp’ command definition

define command{
command_name check_tcp
command_line $USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$
}

‘check_udp’ command definition

define command{
command_name check_udp
command_line $USER1$/check_udp -H $HOSTADDRESS$ -p $ARG1$
}

‘check_ftp’ command definition

define command{
command_name check_ftp
command_line $USER1$/check_ftp -H $HOSTADDRESS$
}

Also I remember having problems when there were blank spaces on lines. I tried to comment stuff out but left spaces in front of the # and recieved syntax errors.

I would suggest to setup small test commands/services/hosts so you can have minimal problems getting the initial app to work and then master it. You will notice that nagios configuration is repetitive and once it works once, you will be able to add on to it easily and identify problems as you go.

good luck


#5

etc missing: did you run “make install-config”?
libexec missing: did the configure part of the plugins install recognize nagios? it hould install the plugins to the agios libexec directory on make install…

Check you don’t have some unwanted new lines hanging around. possibly copying the files you changed something? By the problems you already had it looks like this install isn’t going really well, i’d recommend redoing it from scratch, at least you’d be sure you avoid hitting some misterious permission problems further on.

Luca


#6

Thanks again Steve! Will take note of it (I’m building it from scratch again but the information you have given me is valuable too!).

Thanks Luca! I miss the make install-configure portion, anyway I building Nagios from scratch again.

Thank you for sharing both of you. Thanks! :slight_smile:


#7

after make, make install, check the output from make, it should give you all possible alternatives. there should be the init file installation and the config files and some more.

Luca