Adding hosts/clients to Nagios Core 3.5(Red Hat 6.4)

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.
ricardowesley
Posts: 21
Joined: Thu Sep 05, 2013 1:16 pm

Adding hosts/clients to Nagios Core 3.5(Red Hat 6.4)

Post by ricardowesley »

I am new to Nagios....I have recently installed nagios core 3.5 w/nrpe plugin on a Red Hat server. It appears that the installation was successful. I am now trying to add some host and clents to prove that it works. My Nagios web interface is up and monitoring itself.
FYI---In my /usr/local/nagios/etc/objects it contains commands, contacts, localhost, printer, templates, timeperiods, and window.cfg. I thought a host.cfg, hostgroups.cfg, addhost, and service would normally be there also.
Simply, how do I add hosts/clients and to which files to this NEW install. examples please!
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Adding hosts/clients to Nagios Core 3.5(Red Hat 6.4)

Post by sreinhardt »

Those files are not included by default, as each environment can be vastly different and different administrative techniques can also be applied. You will in need to create each host and service by hand. If this is a large environment, I would highly suggest looking into templating and groups.

http://nagios.sourceforge.net/docs/nagios-3.pdf
http://nagios.sourceforge.net/docs/3_0/quickstart.html
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
ricardowesley
Posts: 21
Joined: Thu Sep 05, 2013 1:16 pm

Re: Adding hosts/clients to Nagios Core 3.5(Red Hat 6.4)

Post by ricardowesley »

I created these files populating these according to nagios helps(host.cfg, hostgroups.cfg, addhost, and service.cfg) in the directory. So far, Nagios is not recognizing the nodes(servers, switches, controllers, etc). Suggestions are welcome
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Adding hosts/clients to Nagios Core 3.5(Red Hat 6.4)

Post by slansing »

Are you listing multiple hosts in "host.cfg?" If so, it must be named hosts.cfg and the same for services.cfg. If you are using host.cfg for only one host, be sure to title the CFG as the host's name, also, please share the contents of host.cfg if the above is true.
ricardowesley
Posts: 21
Joined: Thu Sep 05, 2013 1:16 pm

Re: Adding hosts/clients to Nagios Core 3.5(Red Hat 6.4)

Post by ricardowesley »

Here are some of entries in my host.cfg file

define host{
use linux-server
host_name Network_DB_Server
hostgroups solaris-servers
parents 1059_Switch
alias drifter
address drifter
}

define host{
use linux-server
host_name paris2
hostgroups solaris-servers
parents 1059_Switch
alias dhcp
address 10.172.13.129
}

define host{
use linux-server
host_name daldc01
hostgroups solaris-servers
parents 1059_Switch
alias domain controller
address 10. 172.14.112
}

define host{
use linux-server
host_name londondc2
hostgroups solaris-servers
parents 1059_Switch
alias domain controller
address 10. 172.15.79
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Adding hosts/clients to Nagios Core 3.5(Red Hat 6.4)

Post by slansing »

Please run the following and share the output:

Code: Select all

cat /usr/local/nagios/etc/nagios.cfg | grep cfg_file=
I have a sneaking suspicion that the configuration file you are using is named incorrectly. A single configuration file with multiple hosts in it is generally named hosts.cfg by default not host.cfg.
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Adding hosts/clients to Nagios Core 3.5(Red Hat 6.4)

Post by sreinhardt »

Does your nagios.cfg reference each of these files that you have created, or the folder that they contain? It might be most helpful to just tar the etc directory with all of your configurations and post it for us. Of course feel free to censor IPs and passwords!
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
ricardowesley
Posts: 21
Joined: Thu Sep 05, 2013 1:16 pm

Re: Adding hosts/clients to Nagios Core 3.5(Red Hat 6.4)

Post by ricardowesley »

root@plxnagios ~]# cat /usr/local/nagios/etc/nagios.cfg | grep cfg_file=
cfg_file=/usr/local/nagios/etc/objects/commands.cfg
cfg_file=/usr/local/nagios/etc/objects/contacts.cfg
cfg_file=/usr/local/nagios/etc/objects/timeperiods.cfg
cfg_file=/usr/local/nagios/etc/objects/templates.cfg
cfg_file=/usr/local/nagios/etc/objects/localhost.cfg
#cfg_file=/usr/local/nagios/etc/objects/windows.cfg
cfg_file=/usr/local/nagios/etc/objects/switch.cfg
#cfg_file=/usr/local/nagios/etc/objects/printer.cfg
ricardowesley
Posts: 21
Joined: Thu Sep 05, 2013 1:16 pm

Re: Adding hosts/clients to Nagios Core 3.5(Red Hat 6.4)

Post by ricardowesley »

My nagios web interface is monitoring a few of my switches. I am now configuring/tweaking my host.cfg file (Windows portion)because when I run(after I modified
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg>>>>I receive
Error: Could not find any hostgroup matching 'allhosts' (config file '/usr/local/nagios/etc/objects/hosts.cfg', starting on line 165)
Error processing object config files!
****I have changed the hostgroup name several times and get the same message above.more.
I have also simultanaeouly change the windows.cfg hostgroups name to match the hosts.cfg and received the error above. suggestions?
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Adding hosts/clients to Nagios Core 3.5(Red Hat 6.4)

Post by abrist »

Have you defined the "allhosts" hostgroup? You have declared it as a hostgroup for one of your hosts (line 165), but have you actually defined the hostgroup itself?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Locked