Avatar of lhrslsshahi
lhrslsshahi
 asked on

Nagios config export and install

Hi I have built a new RHEL 5.4VM and need to install Nagios 3.2.x core.  How can I export the configuration settings from the old Nagios VM?  What are the important files for Nagios and Apache?
LinuxApache Web ServerNetwork Management

Avatar of undefined
Last Comment
lhrslsshahi

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Seth Simmons

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
lhrslsshahi

ASKER
Is there a lot of work involved with installing nagios and getting it up and running?  Do you have any good links you can share?

Thanks
SOLUTION
Seth Simmons

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
lhrslsshahi

ASKER
I will give it a go and come back to you.
Sanga Collins

When building a replacement server I literally just copied /usr/local/nagios/etc to the new server. 90% of my settings came up fine and I then tuned the remaining anomalies.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
lhrslsshahi

ASKER
Nagios is now online thanks for all your help, have taken a while back to you guys as I had surgery done!

Only problem I have is I get the following for error (Return code of 127 is out of bounds - plugin may be missing)

The Linux VM that has this problem is also the Nagios monitoring host and remote host not entirely sure what I need to do in regards get the NRPE Addon configuration.

I have no problems monitoring other remote hosts it just can't monitor itself!
Seth Simmons

that error means a command is defined for an executable that is missing

are the nagios plugins installed?
if not, run this:

cd /tmp
wget https://www.nagios-plugins.org/download/nagios-plugins-1.5.tar.gz
tar xzf nagios-plugins-1.4.11.tar.gz
cd nagios-plugins-1.4.11
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install

Open in new window


or, for nrpe:

cd /tmp
wget http://downloads.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz
tar zxf nrpe-2.15.tar.gz
cd nrpe-2.15
./configure
make all

Open in new window

lhrslsshahi

ASKER
@Seth

This has already been done and I had no problems with this, is there special configuration required if the nagios monitoring host and remote host are the same VM?
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Seth Simmons

it's essentially monitoring itself?
lhrslsshahi

ASKER
That's correct
Seth Simmons

ok...is this plugin in question going through nrpe?  how is it configured?
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
lhrslsshahi

ASKER
Its configured through NRPE addon and it was configured with similar code snippets as above.  NRPE add on monitoring host functionality works as it's successfully monitoring other hosts which are configured with NRPE addon remote host.
Sanga Collins

Instead of using NRPE to monitor the nagios host. You can use the example config files for monitoring local host. Usually those are installed with a fresh nagios instance and have all the monitoring parameters already setup. Here are the examples that came with my nagios install. Just call them from a service defenition.

################################################################################
#
# SAMPLE SERVICE CHECK COMMANDS
#
# These are some example service check commands.  They may or may not work on
# your system, as they must be modified for your plugins.  See the HTML 
# documentation on the plugins for examples of how to configure command definitions.
#
# NOTE:  The following 'check_local_...' functions are designed to monitor
#        various metrics on the host that Nagios is running on (i.e. this one).
################################################################################

# 'check_local_disk' command definition
define command{
        command_name    check_local_disk
        command_line    $USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
        }


# 'check_local_load' command definition
define command{
        command_name    check_local_load
        command_line    $USER1$/check_load -w $ARG1$ -c $ARG2$
        }


# 'check_local_procs' command definition
define command{
        command_name    check_local_procs
        command_line    $USER1$/check_procs -C $ARG1$ -w $ARG2$ -c $ARG3$ -s $ARG4$
        }
		

# 'check_local_users' command definition
define command{
        command_name    check_local_users
        command_line    $USER1$/check_users -w $ARG1$ -c $ARG2$
        }


# 'check_local_swap' command definition
define command{
	command_name	check_local_swap
	command_line	$USER1$/check_swap -w $ARG1$ -c $ARG2$
	}


# 'check_local_mrtgtraf' command definition
define command{
	command_name	check_local_mrtgtraf
	command_line	$USER1$/check_mrtgtraf -F $ARG1$ -a $ARG2$ -w $ARG3$ -c $ARG4$ -e $ARG5$
	}

Open in new window

Seth Simmons

since it's local, you don't need to use nrpe locally; it's fine for the remote hosts
you can define the commands for the local host using the direct commands - in other words, instead of having check_nrpe!command -arg1 ,etc. just use check_disk or whatever one it is with it's respective parameters
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
lhrslsshahi

ASKER
Thanks guys however it was working before, is there any logs I can check to see whats causing the problem?
Seth Simmons

there won't be anything in the nagios log except for that out of bounds error
which service check is failing?
lhrslsshahi

ASKER
How do I check which service check is failing?
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
Seth Simmons

look at the nagios interface
it will have the service description on the same line as the status where it says it's out of bounds
lhrslsshahi

ASKER
Service - Uptime
Status   - Critical

Thanks
Seth Simmons

what is the command defined in the config for that item?
check the command and verify the path and file is correct
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Sanga Collins

also check if the command in libexec has an extension.

For example I have "check_disk_snmp.pl" the command definition must also have the extension (.pl). This has caught me off guard a few times and leads to plugin out-of-bounds error message
lhrslsshahi

ASKER
The below did the trick

vim /etc/xinetd.d

# default: on
# description: NRPE (Nagios Remote Plugin Executor)
service nrpe
{
        flags           = REUSE
        socket_type     = stream
        port            = 5666
        wait            = no
        user            = nagios
        group           = nagios
        server          = /usr/local/nagios/bin/nrpe
        server_args     = -c /usr/local/nagios/etc/nrpe.cfg --inetd
        log_on_failure  += USERID
        disable         = no
        only_from       = 192.168.20.11


Changed from 127.0.0.1 to 192.168.20.11

Thanks for all your help Seth