Monitored host not displaying

An open discussion forum for obtaining help with Nagios Core. Nagios Core users of all experience levels are welcome here. Subforum have been created for the discussion of Nagios Core and Nagios Plugin development.

NOTE: The SourceForge.net mailing lists have been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

Monitored host not displaying

Postby karl » Wed Oct 11, 2017 4:39 am

Hi all,

I'm brand new to this so please excuse my ignorance.

I have built an Ubuntu Server 17.04 on one of our Hyper-V hosts onto which I then loaded Nagios Core 4.3.2 following the step by step guide on the Nagios support pages (https://support.nagios.com/kb/article/n ... tml#Ubuntu)

I then installed the NCPA 2.0.5 onto a brand new Windows Server 2008 R2 machine that I built last week to use as a web server. To install the NCPA I again used the guide on the Nagios support pages (https://www.nagios.org/ncpa/getting-started.php)

I've created my commands.cfg and ncpa.cfg files as outlined in the guide the only thing I wasn't too sure about was when creating the commands.cfg file I entered this info:

define command {
command_name check_ncpa
command_line $USER1$/check_ncpa.py -H $HOSTADDRESS$ $ARG1$
}


I substituted $USER1$ for the username on my Nagios - in this instance administrator, the $HOSTADDRESS$ I put the IP Address of the Windows server I wanted to monitor however I didn't know what I had to put for $ARG1$ so i've left it as that. So mine looks like this:

define command {
command_name check_ncpa
command_line $administrator$/check_ncpa.py -H $192.168.1.1$ $ARG1$
}


I don't know what i'm doing wrong as i've literally followed the guide to the letter but when I go to my Nagios URL and look at hosts & host groups it is still only listing the localhost.

I've checked the firewall on the Windows Server and port 5693 is allowed all traffic, i've checked my token is correct. I've even uninstall the NCPA and started again.

Can anyone offer any advice?

Thanks

Karl
karl
 
Posts: 5
Joined: Wed Oct 11, 2017 4:16 am

Re: Monitored host not displaying

Postby npolovenko » Wed Oct 11, 2017 10:14 am

Have you imported your ncpa.cfg file into the nagios.cfg file?
Code: Select all
cfg_file=/usr/local/nagios/etc/ncpa.cfg

And the commands.cfg file should allready exist in the objects folder. Can you paste your commands inside that file?
Code: Select all
/usr/localnagios/etc/objects

After that please run
Code: Select all
service nagios restart
in the command line.
User avatar
npolovenko
 
Posts: 93
Joined: Mon May 15, 2017 5:00 pm

Re: Monitored host not displaying

Postby karl » Thu Oct 12, 2017 3:21 am

Morning,

Thanks for the info. I have followed your steps and when I try to start the nagios service again I get this error saying that it failed to start the service with this reason:

Check your configuration file(s) to ensure that they contain valid directives and data definitions. If you are upgrading from a previous version of Nagios, you should be aware that some variables/definitions may have been removed or modified in this version. Make sure to read the HTML documentation regarding the config files, as well as the 'Whats New' section to find out what's changed


All i've done is ran that first command you supplied

Code: Select all
cfg_file=/usr/local/nagios/etc/ncpa.cfg


And then moved the commands.cfg from
Code: Select all
/usr/local/nagios/etc
and moved it to
Code: Select all
/usr/local/nagios/etc/objects
using
Code: Select all
sudo mv
karl
 
Posts: 5
Joined: Wed Oct 11, 2017 4:16 am

Re: Monitored host not displaying

Postby npolovenko » Thu Oct 12, 2017 10:34 am

Hi,@karl. Can you upload your nagios.cfg, ncpa.cfg and commands.cfg files here? Also, please run the following command and show us the output:
Code: Select all
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
User avatar
npolovenko
 
Posts: 93
Joined: Mon May 15, 2017 5:00 pm

Re: Monitored host not displaying

Postby karl » Fri Oct 13, 2017 2:54 am

Hiya,

I can't seem to copy and paste so instead I've taken screenshots I hope it comes out OK. For security I've blanked out any IP addresses or passwords.

The forum will only allow me to upload a max of 20 URL's and unfortunately there are a few more than that so instead I have uploaded them to my file sharing account and can be viewed on this link (i'd suggest sorting them by name as it's uploaded them in reverse!):

https://app.box.com/s/pj7vqp9bgiti3zlzo22cnygmf7dgsbdl

Below is the result from the command you asked me to run:

Image

Any problems please let me know, i'm in the office today (Friday 13th) then out until Tuesday 17th however if you reply i'll get an e-mail and I can check it.

Thanks again for all your help
karl
 
Posts: 5
Joined: Wed Oct 11, 2017 4:16 am

Re: Monitored host not displaying

Postby npolovenko » Fri Oct 13, 2017 9:34 am

Hi, @karl. Thanks for the screenshots. Can you put this line inside your nagios.cfg file(as on the screenshot)
Code: Select all
cfg_file=/usr/local/nagios/etc/ncpa.cfg
1.jpg

After that try restarting nagios one more time and see if you get any errors.
Code: Select all
service nagios restart

Let us know how it goes.
User avatar
npolovenko
 
Posts: 93
Joined: Mon May 15, 2017 5:00 pm

Re: Monitored host not displaying

Postby karl » Fri Oct 13, 2017 9:50 am

Hiya,

Added as suggested.

When I tried to restart I got this:

Image

So I ran
Code: Select all
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
again and got this:

Image
karl
 
Posts: 5
Joined: Wed Oct 11, 2017 4:16 am

Re: Monitored host not displaying

Postby npolovenko » Fri Oct 13, 2017 11:14 am

@ karl, As far as this command from your first post:
Code: Select all
define command {
command_name check_ncpa
command_line $USER1$/check_ncpa.py -H $HOSTADDRESS$ $ARG1$
}
You din't need to change it at all. Basically, $USER1$ is Macro that will get automatically replaced by Nagios to point to /usr/local/nagios/libexec folder on your machine. That's the folder where you have all Nagios plugins, including check_ncpa.py
$HOSTADDRESS$ is the host's IP address that will get automatically taken from the host definition. And $ARG1$ corresponds to any arguments that will be passed to the check_ncpa.py in the future. You should change that back to what it was.
Code: Select all
https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/3/en/macros.html

After that try to restart your Nagios server again.
If that doesn't help please upload here or you can pm me the whole /usr/local/nagios/etc/ folder. I highly recommend using WinSCP or Filezilla for that.
Code: Select all
https://winscp.net/eng/download.php
Then put the whole /usr/local/nagios/etc/ folder in a ZIP archive and send it.
User avatar
npolovenko
 
Posts: 93
Joined: Mon May 15, 2017 5:00 pm

Re: Monitored host not displaying

Postby npolovenko » Tue Oct 17, 2017 12:07 pm

@karl, I received your files. Seems like when you were adding check_ncpa command in /usr/local/nagios/etc/objects/commands.cfg , you deleted all the standard commands for localhost services, defined in localhost.cfg.
I attached the commands.cfg file that includes all the commands for localhost. Go ahead and replace your commands.cfg file. After that restart nagios server. Let us know how it goes.
Attachments
commands.cfg
(7.61 KiB) Downloaded 3 times
User avatar
npolovenko
 
Posts: 93
Joined: Mon May 15, 2017 5:00 pm

Re: Monitored host not displaying

Postby karl » Wed Oct 18, 2017 4:36 am

Hiya,

Thanks for all your help. I've got the commands file uploaded and the service restarted with no errors.

I have the NCPA installed on a windows server and that's now displaying under hosts which is great! Only problem is it's displaying a new error now:

(Return code of 127 is out of bounds - plugin may be missing : (No output on stdout) stderr: /usr/bin/env: ‘python’: No such file or directory))

I know you're probably fed up of helping a novice like me, i'd like to now add our routers at each site to monitor for outages what's the easiest way of doing this?

Thanks again
karl
 
Posts: 5
Joined: Wed Oct 11, 2017 4:16 am

Next

Return to Nagios Core

Who is online

Users browsing this forum: Bing [Bot], dwasswa, ikekim and 26 guests