# nagios remote host monitor

## Joseph_sys

I'm trying to configure nagios to monitor the remote host but it is up-hill battle.

Gentoo instructions are outdated:

http://www.gentoo.org/doc/en/nagios-guide.xml

I have emerged "nrpe" and started on both server and client, is it correct?

On the server I have created directory:

/etc/nagios/objects 

does this directory have to have ownership "nagios:nagios" ?

Inside this directory I have have created files:

```
nrpe-command.cfg 

define command {

  command_name check_nrpe

  command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$

}
```

```
nrpe-hosts.cfg 

define host {

  use linux-server

  host_name clinic-atom

  alias Gentoo Linux Web Server

  address 192.168.141.1

}
```

```
nrpe-services.cfg

define service {

  use generic-service

  host_name clinic-atom

  service_description Current Load

  check_command check_nrpe!check_load

}

define service {

  use generic-service

  host_name clinic-atom

  service_description Root Partition

  check_command check_nrpe!check_disk

}
```

On the client I just emerge nrpe and started it.  Why isn't it working?

Is there any easier package to use?

----------

## Princess Nell

The default configuration may allow access from localhost only.

----------

## Joseph_sys

 *Princess Nell wrote:*   

> The default configuration may allow access from localhost only.

 

Yes, I know that. That is how I had configured.

My question is how to enable remote host to talk to local server that monitors it, that part is not clear to me.

----------

## Princess Nell

You need to allow remote access on the client. The check_nrpe plugin on the server needs to communicate with the nrpe daemon on the client.

----------

## Joseph_sys

 *Princess Nell wrote:*   

> You need to allow remote access on the client. The check_nrpe plugin on the server needs to communicate with the nrpe daemon on the client.

 

I think I figure it out.

According to nagios documentation, the nrpe suppose to be installed on the client and since "nrpe" installs "check_nrpe" it must be emerged on the monitoring server as well.  As "check_nrpe" connect to nrpe on the client.

In addition I need to create "nagios" user and group on the client.

The whole setup is getting too complicated and it is hard to obtain any support or answer anywhere on nagios, so I gave up.

I was trying to use it to monitor Asterisk server on the remote client as it sometimes I can not restart it, I get:

```
/etc/init.d/asterisk restart

 * Caching service dependencies ...           [ ok ]

 * Killing wrapper script ...                 [ ok ]

 * Stopping asterisk PBX gracefully ...

* Waiting for asterisk to shutdown .............................................................

 * Failed.
```

When I run /etc/init.d/asterisk status

I get: "* status: started"

At this point I have to kill the process ID

"zap" it (/etc/init.d/asterisk zap)

and restart it.

----------

## Princess Nell

I'm pretty emerge does all the right things. I installed nrpe temporarily to check the default config file, then unmerged. Still have:

```

# grep nagios /etc/[ps][ah][as]*

/etc/passwd:nagios:x:120:993:added by portage for nagios-plugins:/var/nagios/home:/bin/bash

/etc/shadow:nagios:!:15667::::::

# 

```

nagios-plugins are a required dependency of nrpe, so it gets installed when you emerge nrpe. Normally  :Smile: 

----------

## bbgermany

 *Joseph_sys wrote:*   

>  *Princess Nell wrote:*   You need to allow remote access on the client. The check_nrpe plugin on the server needs to communicate with the nrpe daemon on the client. 
> 
> I think I figure it out.
> 
> According to nagios documentation, the nrpe suppose to be installed on the client and since "nrpe" installs "check_nrpe" it must be emerged on the monitoring server as well.  As "check_nrpe" connect to nrpe on the client.
> ...

 

Hi,

nrpe works different from the normal checks. The Nagios Server pokes via a local nrpe client the remote nrpe client to run the check command on the host where you need a check. 

```

NAGIOS Server -> nrpe-nagios-server -> nrpe-client -> check_command

```

So if you want to check for the load on a remote server you need nrpe and the nagios-plugins installed there. Then check your nrpe.cfg file for the line similiar to the following:

```

command[check_load]=/usr/lib/nagios/plugins/check_load -w 15,10,5 -c 30,25,20

```

so if you run on the Nagios Server a definition for like this:

```

nrpe-services.cfg

define service {

  use generic-service

  host_name clinic-atom

  service_description Current Load

  check_command check_nrpe!check_load

} 

```

it will run the check_load command between the brackets after command in your nrpe.cfg file (as long as the nrpe deamon is running on the client).

bb

----------

