Category Archives: Nagios

Nagios monitoring. I still have not got a good handle on this but if I can ever get off the security / hacked treadmill I will come back to it.

SME Server as a Nagios NRPE Client only

If you are wanting to install Nagios on an SME Server version 8 then you will probably start with the Wiki Contribs page for a Nagios Server install. http://wiki.contribs.org/Nagios

Which is going to lead you down a path of installing a complete Nagios Server assuming you overcome the issues with those instructions.

But if you have a Nagios Server elsewhere and you want to just add the SME Server as a client then a different set of instructions can be found in the forums.

http://forums.contribs.org/index.php/topic,48587.msg241615.html#msg241615

Which is really helpful but is missing a couple of key points for a complete set of instructions. So here is a re-write of that instruction set.

NRPE SME Server 8 Installation

1. Configure the dag repository

The following command will configure the dag repository on SME Server.

[text]

/sbin/e-smith/db yum_repositories set dag repository
Name ‘Dag – EL5’
BaseURL ‘<a href="http://apt.sw.be/redhat/el5/en/" target="_blank">http://apt.sw.be/redhat/el5/en/</a>$basearch/dag’
EnableGroups no
GPGCheck yes
GPGKey <a href="http://dag.wieers.com/packages/RPM-GPG-KEY.dag.txt" target="_blank">http://dag.wieers.com/packages/RPM-GPG-KEY.dag.txt</a>
Visible no
Exclude freetype,htop,iptraf,rsync,syslinux
status disabled

[/text]

2. After adding it to the database we have to update the changes to the configuration file:

[text]signal-event yum-modify[/text]

3. Then run this to enable the repo

[text]

/usr/bin/yum –enablerepo=dag install
nagios-plugins
nagios-plugins-setuid
perl-Config-Tiny
perl-Class-Accessor

[/text]

4. Copy nrpe rpm’s

Current download for the files are:

http://pkgs.repoforge.org/nagios/nagios-3.2.1-5.el5.rf.i386.rpm

http://pkgs.repoforge.org/nagios-nrpe/nagios-nrpe-2.5.2-1.el5.rf.i386.rpm

http://pkgs.repoforge.org/nagios-nrpe/nagios-plugins-nrpe-2.5.2-1.el5.rf.i386.rpm

5. Install the nrpe rpm’s

[text]

yum localinstall nagios-3.2.1-5.el5.rf.i386.rpm
yum localinstall nagios-nrpe-2.5.2-1.el5.rf.i386.rpm
yum localinstall nagios-plugins-nrpe-2.5.2-1.el5.rf.i386.rpm

[/text]

6. Modify the nrpe.cfg file to allow the external ip of your Nagios server  (swap vim for your favourite editor)

[text]

vim /etc/nagios/nrpe.cfg

[/text]

the allowed_hosts parameter is already in the file, remove the # from the start of the line and add your nagios server ip

[text]

allowed_hosts=127.0.0.1,nagios.server.ip.here

[/text]

Save the file and exit.

7. Add the service

[text]

cd /etc/rc7.d

cp -s /etc/init.d/nrpe S95nrpe

[/text]

8. Port forward 5666 to localhost (swap vim for your favourite editor)

a)

[text]

mkdir -p /etc/e-smith/templates-custom/etc/hosts.allow/

[/text]

(if you get an error it means the directory already exists.)

b)

[text]

vim /etc/e-smith/templates-custom/etc/hosts.allow/nrpe

[/text]

and add the following lines to the nrpe file, adding your nagios server ip

[text]

{
$OUT="nrpe: " . ($nrpe{HostsAllow} ? $nrpe{HostsAllow} : "127.0.0.1 nagios.server.ip.here" );
}

[/text]

Save the file and exit.

9. Configure the new template

[text]

expand-template /etc/hosts.allow

[/text]

10. Start NRPE

[text]

service nrpe restart

[/text]

And then off to your Nagios server to add the new SME Server as a client.

Nagios error: /etc/init.d/nagios: line 60: /usr/local/nagios/libexec/check_nagios: No such file or directory

This error occurred for me because the nagios/cgi.cfg contained the incorrect settings.

This is on a Debian Lenny platform and I was not the original installer.  I initially thought it was the nrpe settings and spent sometime working out why the correct settings in the nrpe.cfg were not working. 

Apparently the cgi.cfg takes precedence over the nrpe.cfg, at least in my setup it did!