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?scottwilkerson wrote:First, I asked you to run the following:
Here is the output of the command:It looks like you are missing the config file
run the followingCode: Select all
ls -al /usr/local/nagios/etc/objects/
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 configurationThere is no check_command defined here, so you would want to see if it is defined in your template you have assigned Windows-ServerCode: 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 }
Basics - Adding a Host to Nagios Core
Re: Basics - Adding a Host to Nagios Core
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Basics - Adding a Host to Nagios Core
Maybe I'm confused at what your current error is.
You said you can see the host and services now right?
You said you can see the host and services now right?
Re: Basics - Adding a Host to Nagios Core
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.
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.
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Basics - Adding a Host to Nagios Core
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-sta ... ive-checks
See the "Active Checks (check_ncpa.py)" section here
https://www.nagios.org/ncpa/getting-sta ... ive-checks
Re: Basics - Adding a Host to Nagios Core
Yes i followed this in the guide:
the only thing is when it says to verify it i get this
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
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
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Basics - Adding a Host to Nagios Core
no, to verify config, you run this
Code: Select all
sudo /usr/local/nagios/bin/nagios -v /usr/usr/local/nagios/etc/nagios.cfg
Re: Basics - Adding a Host to Nagios Core
ok, its just in the guide it asked to run:
I have ran what you suggested and get this: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
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!
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Basics - Adding a Host to Nagios Core
What is the location of your nagios.cfg ? You need to modify the command with the correct path to your nagios.cfg
Re: Basics - Adding a Host to Nagios Core
ah ok, sorry, just noticed there was an extra /usr in your path compared to mine
works now it comes back with no errors
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
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Basics - Adding a Host to Nagios Core
That looks better, now you can restart the nagios service for the changes to take affect
Code: Select all
service nagios restart