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.
User avatar
gshergill
Posts: 231
Joined: Tue Aug 07, 2012 5:08 am

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

Post by gshergill »

Hi ricardowesley,

You posted the below result;

Code: Select all

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
I may be mistaken, bit it looks like you are missing the hosts.cfg and hostgroups.cfg defined in nagios.cfg?

Code: Select all

cfg_file=/usr/local/nagios/etc/objects/hosts.cfg
cfg_file=/usr/local/nagios/etc/objects/hostgroups.cfg
The names of you files may not be hosts.cfg and hostgroups.cfg, but just replace them with what you have.

For future, you also look to be missing services.cfg (where you define the services for the hosts in hosts.cfg).

Kind Regards,

Gary Shergill
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 a group allhosts in hostgroups.cfg located in /usr/local/nagios/etc/objects.
When I run /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg prior this change... I receive this message
Warning: Duplicate definition found for hostgroup 'linux-servers' (config file '/usr/local/nagios/etc/objects/localhost.cfg', starting on line 46)
Error: Could not add object property in file '/usr/local/nagios/etc/objects/localhost.cfg' on line 47.
Error processing object config files!
Where and I how do I correct this problem?...It is preventing me from moving on.
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 »

I bet that the "linux-servers" hostgroup is not only defined in the localhost.cfg file, but also in the hostgroups.cfg file. Remove one of the declarations (probably from the localhost.cfg file) and try to verify once again.
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.
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 »

Do you have the hostgroup 'linux-servers' defined multiple times in that configuration file? I'd start by taking the line it told you the issue was revolving around and figure out where and what you need to remove, after each change "such as removing a hostgroup definition" verify your configurations as you did above and eventually you will run out of errors to fix!
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 »

Yes, My Nagios web interface is now showing the configured nodes....Thanks
Locked