Unable to find other hosts

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
User avatar
gshergill
Posts: 231
Joined: Tue Aug 07, 2012 5:08 am

Unable to find other hosts

Post by gshergill »

Hi Nagios Community.

I just finished an install of Nagios on Ubuntu 12.04 and the web interface is working.

However, I have been unable to figure out or find out how to get Nagios to auto-detect, or detect in general, any of the other machines on the network.

I found a link which suggested to edit the hosts.cfg file, but I don't seem to have one... I tried editing localhost.cfg but then the web UI doesn't work and it comes up with the error;
"Unable to locate /usr/local/nagios/var/status.dat file"

I added;

define host{
use generic-host
host_name gateway.gltd.local
alias Gateway Router
address 192.168.3.1
check_command check-host-alive
max_check_attempts 20
notification_interval 240
notification_period 24x7
notification_options d,u,r
}

define hostgroup{
hostgroup_name routers
alias Routers
}


to localhost.cfg (replacing domain with the actual domain).

Anyone can help me on how to get Nagios to detect other machines please?

Thank you.

gshergill
Last edited by gshergill on Tue Aug 07, 2012 10:47 am, edited 1 time in total.
User avatar
gshergill
Posts: 231
Joined: Tue Aug 07, 2012 5:08 am

Re: Unable to find other hosts

Post by gshergill »

UPDATE

I think I've made some sort of progress on this.

I've added to the switch.cfg file a router and it's appearing on the web client.

However, I've been having this issue since the start and I realise it is pretty major;

Status Information
(Return code of 127 is out of bounds - plugin may be missing)

PING
CRITICAL 27m-58s 3 / 3 Aug 07 13:36:29s 2012
(Return code of 127 is out of bounds - plugin may be missing)

Port 1 Bandwidth Usage
CRITICAL 26m-55s 3 / 3 Aug 07 13:32:32s 2012
(Return code of 127 is out of bounds - plugin may be missing)

Port 1 Link Status
CRITICAL 25m-53s 3 / 3 Aug 07 13:33:34s 2012
(Return code of 127 is out of bounds - plugin may be missing)

Uptime
CRITICAL 24m-50s 3 / 3 Aug 07 13:34:37s 2012
(Return code of 127 is out of bounds - plugin may be missing)


Okay so my plugins are all missing apparently.

I installed them using the following steps from the guide at http://nagios.sourceforge.net/docs/3_0/ ... buntu.html;

6) Compile and Install the Nagios Plugins

Extract the Nagios plugins source code tarball.

cd ~/downloads

tar xzf nagios-plugins-1.4.11.tar.gz

cd nagios-plugins-1.4.11

Compile and install the plugins.

./configure --with-nagios-user=nagios --with-nagios-group=nagios

make

make install


I installed them in the same place I installed the nagios tar.gz (/opt/nagios/).
Nagios - /opt/nagios/nagios/
Plugins - /opt/nagios/nagios-plugins-1.4.16/

Please note although they are installed there, all the cfg files are in /usr/local/nagios/

Thank you again
Last edited by gshergill on Wed Aug 08, 2012 4:48 am, edited 1 time in total.
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: Unable to find other hosts

Post by mguthrie »

Your ~nagios/etc/resource.cfg file will contain the location of your plugins directory as a Macro. I'm betting the directory specified in that file might be wrong.
User avatar
gshergill
Posts: 231
Joined: Tue Aug 07, 2012 5:08 am

Re: Unable to find other hosts

Post by gshergill »

Hi mguthrie,

I've been looking for a place to define the plugins location! Thank you.

My plugins were compiled in;
/opt/nagios/nagios-plugins-1.4.16/

In resources.cfg, which path do I define? The directory /opt/nagios/nagios-plugins-1.4.16/ has a lot of files/folders.

ABOUT-NLS config.rpath Makefile po/
acinclude.m4 config.status Makefile.am README
ACKNOWLEDGEMENTS config_test/ Makefile.in release
aclocal.m4 configure mkinstalldirs REQUIREMENTS
AUTHORS configure.in nagios-plugins.spec stamp-h1
BUGS contrib/ nagios-plugins.spec.in SUPPORT
build-aux/ COPYING NEWS tap/
ChangeLog FAQ NPTest.pm test.pl
CODING gl/ NP-VERSION-GEN test.pl.in
command.cfg INSTALL perlmods/ THANKS
command.cfg.in LEGAL pkg/ tools/
config.h lib/ plugins/
config.h.in libtool plugins-root/
config.log m4/ plugins-scripts/

I've tried using /plugins, /plugins/, /plugins-root and /plugins-root/ and none worked.

Thank you.
Last edited by gshergill on Wed Aug 08, 2012 4:49 am, edited 1 time in total.
User avatar
gshergill
Posts: 231
Joined: Tue Aug 07, 2012 5:08 am

Re: Unable to find other hosts

Post by gshergill »

UPDATE

Root partition service is up and running on the localhost =)

Just took a bit of time.
Rest are still down.

This is using opt/nagios/nagios-plugins-1.4.16/plugins/ in the resources.cfg

UPDATE 2

What does it mean by;

# Sets $USER1$ to be the path to the plugins
$USER1$=/opt/nagios/nagios-plugins-1.4.16/plugins/

Set USER1? I need to add USER1 somewhere?

I tried changing it to nagiosadmin, and adding;
contact_name nagiosadmin

to the host or hostgroup, or adding;
contactgroup_name admins

to the host group but neither worked, it comes up with CONFIG error when restarting nagios and doesn't complete the restart (invalid host/hostgroup object) .
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Unable to find other hosts

Post by slansing »

$USER1$ is a macro which stands for the path to the plugins location. Rather than typing out the entire path it is a shorthand version.

These $USERn$ macro's are defined in the resource.cfg file:

Code: Select all

/usr/local/nagios/etc/resource.cfg
Some more information on these can be found here:

http://nagios.sourceforge.net/docs/3_0/ ... ource_file
User avatar
gshergill
Posts: 231
Joined: Tue Aug 07, 2012 5:08 am

Re: Unable to find other hosts

Post by gshergill »

Hi slansing,

Thank you for the reply.

I've been looking into that and found the same link, but to be perfectly honest I found it quite confusing.

I'm not entirely sure why it isn't recognising my plugins, I installed a fresh machine with Nagios 3 and the installation was so simple (aptitude install nagios3) and every file was literally where it was referenced to already.

Do you, or anyone else, know if there's a simple Ubuntu or Debian package for Nagios Core? I'll try re-installing Nagios Core from fresh as well and see if that helps with the plugin issue, but it's quite frustrating that it's not working.

I've read up and I see that Nagios XI has auto-discovery -- does that mean the free version doesn't have it?

One last question if you may, the installation of Nagios 3 keeps saying that every host has 2 users... Is this a known bug or am I doing something wrong?

Thank you again.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Unable to find other hosts

Post by slansing »

Ah Nagios3 is the key word here. The directories that are created when installing from source are what most of the Nagios documentation is based around "this is the unfortunate issue with Nagios3." In your case you would change the $USER1$ path to:

Code: Select all

/usr/lib/nagios/plugins/


For future reference we recently released documentation in installing Nagios Core from source on Ubuntu.

The installation document with Ubuntu specific commands and prerequisites can be found here:

http://library.nagios.com/library/produ ... rom-source
User avatar
gshergill
Posts: 231
Joined: Tue Aug 07, 2012 5:08 am

Re: Unable to find other hosts

Post by gshergill »

Hi again.

Ignoring the Nagios 3 now and back to Nagios Core;

I followed that guide, changing the plugin version to suit, but the same issue =/

In the end, I just moved all the plugins to /usr/lib/nagios/plugins manually and it seems to be working fine.

EDIT

There was an issue with snap - sorted it out.

EDIT

It would appear that the Services are not correctly displaying... It says, for example, 1 user is currently logged in to the router..... 1 user is currently logged into the chat server (when there are in fact about 5 people logged in).

Any reason why?

Ask me if you need any .cfg's posted

Thanks


EDIT

I will repost this as a separate issue, how do I close the thread?
Locked