Unable to successfully add a new host with services

Support requests, bug reports, questions etc.

Unable to successfully add a new host with services

Postby kaplan71 » Sat Dec 03, 2011 00:29

Hi there --

I went through the motions of adding a new host. The sequence of that I used was to first create the host. When that was done, I went to an existing host that had the same series of checks that I wanted the new host to have associated with it. Using the advanced option, I cloned two services. After that, I ran the Generate Nagios Config, and there were no errors reported. The NagiosConfig.tgz file was duly copied to the /usr/local/nagios/etc/objects directory where it was untarred, and its contents placed at that location.

When I tried to restart Nagios, an error message indicating there was a problem with the hosts.cfg file appeared on-screen, and Nagios could not be started on the system. I was forced to restore a backup copy of the Nagios directory in order to get the application to run properly.

What did I do wrong here, and how can I prevent this from happening in the future?
kaplan71
NConf supporter
NConf supporter
 
Posts: 37
Joined: Tue Nov 01, 2011 00:34

Re: Unable to successfully add a new host with services

Postby Tontonitch » Sat Dec 03, 2011 12:01

Hi,

That's very strange that the generated configuration passed the nagios binary check, but failled to be loaded when moved to the nagios directories.

1. could you check that the nagios binary which is used for the generated configuration check (generally located in <nconf_base>/bin) is the same as the one located in the nagios directory (usually located in <nagios_home>/bin)?

2. could you check that you don't have old cfg files loaded, which are not part of the NagiosConfig.tgz archive?
Code: Select all
cat <nagios_base>/etc/nagios.cfg | egrep "cfg_file|cfg_dir"

You should only have the following (or similar):
Code: Select all
cfg_dir=/usr/local/nagios/etc/global
cfg_dir=/usr/local/nagios/etc/Default_collector


BR,
Yannick
User avatar
Tontonitch
NConf addict
NConf addict
 
Posts: 254
Joined: Fri May 07, 2010 10:14
Location: Thionville, France

Re: Unable to successfully add a new host with services

Postby kaplan71 » Sat Dec 03, 2011 15:18

Hi there --

I checked the /var/www/nconf/bin directory, and there was no nagios binary at that location. To ensure the correct binary is being used for the checks, I created a symbolic link that points to the /usr/local/nagios/bin/nagios file.

I ran the check for the old cfg files using the syntax you provided in your posting. The output of the command is shown below:

cfg_file=/usr/local/nagios/etc/objects/checkcommands.cfg
cfg_file=/usr/local/nagios/etc/objects/contacts.cfg
cfg_file=/usr/local/nagios/etc/objects/contactgroups.cfg
cfg_file=/usr/local/nagios/etc/objects/hostextinfo.cfg
cfg_file=/usr/local/nagios/etc/objects/hostgroups.cfg
cfg_file=/usr/local/nagios/etc/objects/hosts.cfg
cfg_file=/usr/local/nagios/etc/objects/services.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
# extension) in a particular directory by using the cfg_dir
#cfg_dir=/usr/local/nagios/etc/servers
#cfg_dir=/usr/local/nagios/etc/printers
#cfg_dir=/usr/local/nagios/etc/switches
#cfg_dir=/usr/local/nagios/etc/routers
# object configuration files (see the cfg_file and cfg_dir options above).
cfg_dir=/usr/local/nagios/etc/check_mk.d


The cfg_dir references to the global and Default_collector folders are not present in the file. Somehow they must have been deleted from it. What appears
to need to be done here is:

1. Add the cfg_dir entries similar to what you posted to the nagios.cfg file.
2. Comment out or remove the remaining cfg_file entries that are present.

Correct?
kaplan71
NConf supporter
NConf supporter
 
Posts: 37
Joined: Tue Nov 01, 2011 00:34

Re: Unable to successfully add a new host with services

Postby kaplan71 » Mon Dec 05, 2011 19:55

Hi there --

I went ahead with the two steps that I mentioned in my posting, and the addition of the new host, and the restart of the Nagios application were both
successful. There is one caveat: The "old method" of configuration had the icons for the hosts that appear on the Nagios pages located in the hostextinfo.cfg file. That file is no longer being used, and now the hosts do not have their respective icons on any page.

The references to the icons are present in the extended_host_info.cfg file. An example of one entry is shown below:

define hostextinfo {
host_name Server One
icon_image_alt Linux
icon_image base/linux40.gif
statusmap_image base/linux40.gd2
}


The question that comes up is: What or where is the base directory that is mentioned in the file? Once that is determined, how can the various hosts that are monitored have their respective icons matched to them?
kaplan71
NConf supporter
NConf supporter
 
Posts: 37
Joined: Tue Nov 01, 2011 00:34

Re: Unable to successfully add a new host with services

Postby Tontonitch » Tue Dec 06, 2011 15:52

Hi,

I went ahead with the two steps that I mentioned in my posting, and the addition of the new host, and the restart of the Nagios application were both
successful.


Great. So you should only have 3 uncommented lines now:
Code: Select all
cat /usr/local/nagios/etc/nagios.cfg | egrep "cfg_file|cfg_dir"
#cfg_file=/usr/local/nagios/etc/objects/checkcommands.cfg
#cfg_file=/usr/local/nagios/etc/objects/contacts.cfg
#cfg_file=/usr/local/nagios/etc/objects/contactgroups.cfg
#cfg_file=/usr/local/nagios/etc/objects/hostextinfo.cfg
#cfg_file=/usr/local/nagios/etc/objects/hostgroups.cfg
#cfg_file=/usr/local/nagios/etc/objects/hosts.cfg
#cfg_file=/usr/local/nagios/etc/objects/services.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
# extension) in a particular directory by using the cfg_dir
#cfg_dir=/usr/local/nagios/etc/servers
#cfg_dir=/usr/local/nagios/etc/printers
#cfg_dir=/usr/local/nagios/etc/switches
#cfg_dir=/usr/local/nagios/etc/routers
# object configuration files (see the cfg_file and cfg_dir options above).
cfg_dir=/usr/local/nagios/etc/global
cfg_dir=/usr/local/nagios/etc/Default_collector
cfg_dir=/usr/local/nagios/etc/check_mk.d


The host icons are indeed referenced in extended_host_info.cfg.
The content of this file is generated based on the OS definitions in the web gui.
Go to the gui:
* Additional Items->OS->Show
this list all the defined OS (OS or whatever, this is for me more a "plateform" definition). You can link here an icon for an OS
* Hosts->Show and edit a host.
You can see a OS attribute. Select the corresponding OS.

Now where is the base directory. This directory should be located in /Monitoring/icinga/share/images/logos/ (or you may need to install there the base.zip package: see http://exchange.nagios.org/directory/Graphics-and-Logos/Images-and-Logos/Base-Images/details)
To have the icons also in the nconf gui (that's nice :-)), you can also copy this base directory in the /Monitoring/icinga-addons/nconf/img/logos/ directory (or a symbolic link to the previous directory with correct permissions)

Hope that help,

BR,
Yannick
User avatar
Tontonitch
NConf addict
NConf addict
 
Posts: 254
Joined: Fri May 07, 2010 10:14
Location: Thionville, France

Re: Unable to successfully add a new host with services

Postby kaplan71 » Thu Dec 08, 2011 21:29

Hi there --

I checked within the NConf gui, and confirmed the gif and gd2 files matched those that have been installed on the server. The location of the image files is the following directory:

/usr/local/nagios/share/images/logos


Since I am using Nagios as opposed to Incinga, the directory that was posted earlier,

/Monitoring/icinga/share/images/logos/


is not present on the server. The nconf directory is located at:

/var/www/nconf


How can logos be referenced in this situation?
kaplan71
NConf supporter
NConf supporter
 
Posts: 37
Joined: Tue Nov 01, 2011 00:34

Re: Unable to successfully add a new host with services

Postby Tontonitch » Wed Dec 14, 2011 00:39

Hi Kaplan,

Location of the logos in your nagios directory:
Code: Select all
/usr/local/nagios/share/images/logos


Location of the logos in your nconf directory:
Code: Select all
/var/www/nconf/img/logos


Download the base.zip file from http://exchange.nagios.org/directory/Gr ... es/details, and unzip in the 2 directories listed above. I recommend that instead of a symbolic link between the 2 directories, to avoid apache realms issues or potential security leaks. You should have a base directory in inside the 2 logos dir now.

Then configure the OS entries in NConf gui as you need, with relative paths to the chosen icon (ex: base/linux.gif)

BR,
Yannick
User avatar
Tontonitch
NConf addict
NConf addict
 
Posts: 254
Joined: Fri May 07, 2010 10:14
Location: Thionville, France


Return to Support (NConf 1.2.6)

Who is online

Users browsing this forum: No registered users and 2 guests

cron