Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I want to define new command in nagios for remote host but i can't find out where should i write this thing

define command   {


}

on remote host i have only this file

 vim /usr/local/nagios/etc/nrpe.cfg

Should i write that in above file or i have to write that on nagios host not on remote computer

There is no commands.cfg file on my remote host

share|improve this question
    
You really need to learn to read documentation. Start here: nagios.org/documentation –  John Gardeniers Aug 23 '10 at 4:03

3 Answers 3

up vote 3 down vote accepted

Which Nagios packages do you have installed? On my CentOS 5.4 boxes, the Nagios config is in /etc/nagios. Take a look there. The filename is /etc/nagios/nagios.cfg

Edit

On the remote side, you need an entry in the nrpe.cfg that looks like command[something]=/some/path/to/command/binary. Then, on the Nagios host, you do your define service { }. The important part is that the command to run is going to look like check_nrpe!something, where something is the same as the one in nrpe.cfg.

share|improve this answer
    
i have nagios 3.2. and i am talking bout remote machine. the only cfg file i have is /usr/local/nagios/etc/nrpe.cfg I am taking about NRPE plugin –  John Aug 23 '10 at 1:38
    
Actually i have that nagios.cfg but that is on host where nagios monitoring system is installed. i am talking about where nagios plugin and NRPE plugin is installed. where do i have to define command and in which file. EITHER on host or remote computer –  John Aug 23 '10 at 1:43
    
Oh, ok. You need to have two parts for NRPE to work. I'll update my answer with it so I can get some formatting. –  Bill Weiss Aug 23 '10 at 1:57

You can define the commands in the file /usr/local/nagios/etc/objects/commands.cfg on the nagios host. Open that file and you should see examples for the syntax there.

share|improve this answer

If you are configuring to monitor a remote host, you will have to add a command in your nrpe.cfg found at /usr/local/nagios/etc/.

This command should be on the remote host. The sample commands that are already defined are :

/usr/local/nagios/libexec/check_nrpe -H localhost -c check_users

/usr/local/nagios/libexec/check_nrpe -H localhost -c check_load

/usr/local/nagios/libexec/check_nrpe -H localhost -c check_hda1

/usr/local/nagios/libexec/check_nrpe -H localhost -c check_total_procs

/usr/local/nagios/libexec/check_nrpe -H localhost -c check_zombie_procs

Then adding the command definition to the any of the config file that you have specified in nagios.cfg

define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}

And finally your host and service

Correct me if i am wrong. I am not sure if nagios would reset the settings back to default for commands.cfg.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.