Finally got Nagios running, now what?

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
Deaner
Posts: 8
Joined: Tue Jul 08, 2014 9:30 am

Finally got Nagios running, now what?

Post by Deaner »

All,

Total newbie to Nagios, and thanks to the help of the admins I was able to solve my installation issues and I have a functioning installation! But I am struggling to understand the documentation on how to do anything useful.

My biggest current issue is adding hosts. I don't understand why my .cfg files are not working, I have copied templates from all over trying to get a host other than localhost to show up in nagios with no luck. Here's an example of my most recent host file that includes all the directives required according to the documentation.

Code: Select all

define host{
        name                                **HOSTNAME**.cfg         
        host_name                        **FQDN**
        alias                                 **HOSTNAME**
        address                            **IP-ADDR**
        use                                   generic-host                        
        check_period                     24x7                              
        check_interval                   5                                   
        retry_interval                    1                                 
        max_check_attempts         10                                  
        check_command                 check-host-alive                  
        notification_period             workhours                        
        notification_interval           120                               
        notification_options            d,u,r                             
        contact_groups                   admins                          
        }


And I have placed the absolute path of **HOSTNAME**.cfg in the /usr/local/nagios/etc/nagios.cfg file, the **HOSTNAME**.cfg file is located under /usr/local/nagios/etc/objects/. Every time that I attempt to get this working I restart the nagios and httpd services, yet nothing ever appears.

What am I doing wrong?
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Finally got Nagios running, now what?

Post by lmiltchev »

name **HOSTNAME**.cfg
You should have the actual name of the host in the host definition, not the config name... Run the following commands and show us the output:

l

Code: Select all

s -la /usr/local/nagios/etc/objects
grep "<name of your config>" /usr/local/nagios/etc/nagios.cfg
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
service nagios status
Note: Modify the paths if you need to.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Deaner
Posts: 8
Joined: Tue Jul 08, 2014 9:30 am

Re: Finally got Nagios running, now what?

Post by Deaner »

Oops, thought that name was used differently than host_name... Looking back at the documentation I noticed that name wasn't required but host_name is, so I commented out the name line.

Here's my output for the commands that you mentioned (Nagios is using my local account and group instead of nagios/nagcmd due to reasons out of my control)

Code: Select all

ls -la
drwxrwxr-x 3 **NagiosAccount** **NagiosGroup** 4096 Jul 11 13:46 .
drwxr-xr-x 9 root   root      4096 Jul  8 08:10 ..
-rw-rw-r-- 1 **NagiosAccount** **NagiosGroup** 12015 Jul 10 08:40 cgi.cfg
-rw-r--r-- 1 root   root        26 Jul  8 10:37 htpasswd.users
-rw-rw-r-- 1 **NagiosAccount** **NagiosGroup** 44526 Jul 11 13:46 nagios.cfg
drwxrwxr-x 2 **NagiosAccount** **NagiosGroup**  4096 Jul 11 13:46 objects
-rw-rw---- 1**NagiosAccount** **NagiosGroup**  1312 Jul 10 08:40 resource.cfg

Code: Select all

grep myTest.cfg /usr/local/nagios/etc/nagios.cfg 
cfg_file=/usr/local/nagios/etc/objects/myTest.cfg

Code: Select all

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Nagios Core 4.0.7
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 06-03-2014
License: GPL

Website: http://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 16 services.
        Checked 2 hosts.
        Checked 1 host groups.
        Checked 0 service groups.
        Checked 1 contacts.
        Checked 1 contact groups.
        Checked 24 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

Code: Select all

service nagios status
nagios (pid 12247) is running...
Nothing is yelling at me when I restart Nagios, although it has in the past when I mess something up. I'm starting to think that running Nagios without the nagios account is causing this problem, but hopefully someone can prove me wrong. Hopefully I'll have approval to "take-over" the nagios account on the network soon.
Deaner
Posts: 8
Joined: Tue Jul 08, 2014 9:30 am

Re: Finally got Nagios running, now what?

Post by Deaner »

Looking back over the output from the config check, it appears there are 2 hosts now!?

I still only see 1 in the web interface, but maybe things are looking up?
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Finally got Nagios running, now what?

Post by Box293 »

Deaner wrote:I still only see 1 in the web interface, but maybe things are looking up?
Can you explain where you are only seeing 1 host in the web interface please.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked