Basics - Adding a Host to Nagios Core

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.

Re: Basics - Adding a Host to Nagios Core

Postby workid » Wed Oct 10, 2018 10:41 am

scottwilkerson wrote:First, I asked you to run the following:

It looks like you are missing the config file

run the following
Code: Select all
ls -al /usr/local/nagios/etc/objects/


Here is the output of the command:

Code: Select all
admin-it@GC-NAGIOS:/usr/local/nagios/bin$ ls -al /usr/local/nagios/etc/objects/
total 88
drwxrwxr-x 2 nagios nagios  4096 Oct 10 15:03 .
drwxrwxr-x 4 nagios nagios  4096 Oct 10 15:25 ..
-rw-rw-r-- 1 nagios nagios  6866 Oct  1 16:24 commands.cfg
-rw-rw-r-- 1 nagios nagios  1809 Oct  9 15:29 contacts.cfg
-rw-r--r-- 1 root   root   12288 Oct  9 15:27 .contacts.cfg.swp
-rw------- 1 root   root   12288 Oct  9 14:38 .hosts.cfg.swp
-rw-rw-r-- 1 nagios nagios  4777 Sep 28 10:54 localhost.cfg
-rw-r--r-- 1 root   root    1924 Oct  9 13:30 ncpa.cfg
-rw-rw-r-- 1 nagios nagios  3001 Sep 28 10:54 printer.cfg
-rw-rw-r-- 1 nagios nagios  3484 Sep 28 10:54 switch.cfg
-rw-rw-r-- 1 nagios nagios 12533 Sep 28 10:54 templates.cfg
-rw-rw-r-- 1 nagios nagios  3512 Sep 28 10:54 timeperiods.cfg
-rw-rw-r-- 1 nagios nagios  3919 Oct 10 14:09 windows.cfg




then, per your previous post you had the following for the configuration
Code: Select all
define host {
use Windows-Server
host_name windows10-thinapp
alias Test
address 172.17.136.147
max_check_attempts 5
check_period 24x7
notification_interval 30
notification_period 24x7
}


There is no check_command defined here, so you would want to see if it is defined in your template you have assigned Windows-Server


this define code was from a hosts.cfg file i created following a guide when i was just trying to add a host in nagios when ncpa wasnt working, do i need a hosts file as well with ncpa?
workid
 
Posts: 26
Joined: Wed Oct 10, 2018 7:28 am

Re: Basics - Adding a Host to Nagios Core

Postby scottwilkerson » Wed Oct 10, 2018 12:04 pm

Maybe I'm confused at what your current error is.

You said you can see the host and services now right?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 12656
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: Basics - Adding a Host to Nagios Core

Postby workid » Thu Oct 11, 2018 8:10 am

Yeah that is correct... adding the ncpa.cfg line in the nagios config file has now shown the host in the web interface.

but it looks as though it will not connect to the host, as it says the host is down, with a status message of :

(Return code of 127 is out of bounds. Check if plugin exists)

The plugin is installed on the windows PC and i can log into the Web API with the token i set on that PC.
workid
 
Posts: 26
Joined: Wed Oct 10, 2018 7:28 am

Re: Basics - Adding a Host to Nagios Core

Postby scottwilkerson » Thu Oct 11, 2018 8:58 am

did you install the check_ncpa.py on the nagios server in /usr/local/nagios/libexec?

See the "Active Checks (check_ncpa.py)" section here
https://www.nagios.org/ncpa/getting-started.php#active-checks
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 12656
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: Basics - Adding a Host to Nagios Core

Postby workid » Fri Oct 12, 2018 4:21 am

Yes i followed this in the guide:
Code: Select all
cd /tmp
wget https://assets.nagios.com/downloads/ncpa/check_ncpa.tar.gz
tar xvf check_ncpa.tar.gz
chown nagios:nagios check_ncpa.py
chmod 775 check_ncpa.py
mv check_ncpa.py /usr/local/nagios/libexec


the only thing is when it says to verify it i get this

Code: Select all
admin-it@GC-NAGIOS:/usr/local/nagios/etc$ sudo /usr/local/nagios/bin/nagios -v /usr/usr/local/nagios/libexec/check_ncpa.py
[sudo] password for admin-it:

Nagios Core 4.4.2
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 2018-08-16
License: GPL

Website: https://www.nagios.org
Reading configuration data...
Error: Cannot open main configuration file '/usr/usr/local/nagios/libexec/check_ncpa.py' for reading!
admin-it@GC-NAGIOS:/usr/local/nagios/etc$ sudo /usr/local/nagios/libexec/check_ncpa.py -v
/usr/bin/env: ‘python’: No such file or directory
workid
 
Posts: 26
Joined: Wed Oct 10, 2018 7:28 am

Re: Basics - Adding a Host to Nagios Core

Postby scottwilkerson » Fri Oct 12, 2018 7:45 am

no, to verify config, you run this

Code: Select all
sudo /usr/local/nagios/bin/nagios -v /usr/usr/local/nagios/etc/nagios.cfg
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 12656
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: Basics - Adding a Host to Nagios Core

Postby workid » Mon Oct 15, 2018 7:52 am

ok, its just in the guide it asked to run:

To verify the version of the check_ncpa.py plugin, run the following command from the command line:

/usr/local/nagios/libexec/check_ncpa.py -V

You should see something like this:

check_ncpa.py, Version 1.1.0


I have ran what you suggested and get this:

Code: Select all
admin-it@GC-NAGIOS:/usr/local/nagios/etc$ sudo /usr/local/nagios/bin/nagios -v /usr/usr/local/nagios/etc/nagios.cfg

Nagios Core 4.4.2
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 2018-08-16
License: GPL

Website: https://www.nagios.org
Reading configuration data...
Error: Cannot open main configuration file '/usr/usr/local/nagios/etc/nagios.cfg' for reading!
workid
 
Posts: 26
Joined: Wed Oct 10, 2018 7:28 am

Re: Basics - Adding a Host to Nagios Core

Postby scottwilkerson » Mon Oct 15, 2018 10:02 am

What is the location of your nagios.cfg ? You need to modify the command with the correct path to your nagios.cfg
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 12656
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: Basics - Adding a Host to Nagios Core

Postby workid » Tue Oct 16, 2018 7:11 am

ah ok, sorry, just noticed there was an extra /usr in your path compared to mine

works now it comes back with no errors

Code: Select all
admin-it@GC-NAGIOS:/usr/local/nagios/etc$     sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
[sudo] password for admin-it:

Nagios Core 4.4.2
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 2018-08-16
License: GPL

Website: https://www.nagios.org
Reading configuration data...
   Read main config file okay...
   Read object config files okay...

Running pre-flight check on configuration data...

Checking objects...
   Checked 11 services.
   Checked 2 hosts.
   Checked 1 host groups.
   Checked 0 service groups.
   Checked 1 contacts.
   Checked 1 contact groups.
   Checked 25 commands.
   Checked 5 time periods.
   Checked 0 host escalations.
   Checked 0 service escalations.
Checking for circular paths...
   Checked 2 hosts
   Checked 0 service dependencies
   Checked 0 host dependencies
   Checked 5 timeperiods
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 0
Total Errors:   0

Things look okay - No serious problems were detected during the pre-flight check
workid
 
Posts: 26
Joined: Wed Oct 10, 2018 7:28 am

Re: Basics - Adding a Host to Nagios Core

Postby scottwilkerson » Tue Oct 16, 2018 7:15 am

That looks better, now you can restart the nagios service for the changes to take affect

Code: Select all
service nagios restart
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 12656
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

PreviousNext

Return to Nagios Core

Who is online

Users browsing this forum: No registered users and 37 guests