Link to home
Start Free TrialLog in
Avatar of mhdcommunications
mhdcommunications

asked on

Cannot get Nagios 3 on Ubuntu Desktop 8.10 to monitor any hosts

I have installed Ubuntu 8.10 Desktop and all 270MB of updates. I followed the install instructions located here (http://beginlinux.com/blog/2008/11/install-nagios-3-on-ubuntu-810/). Within a few minutes i was using the web-interface to  view the localhost.
I proceeded to the next step; monitoring a Windows host. When i got to the point to edit the windows.cfg file, I noticed the folder /usr/local/nagios does not exist. Instead, all .cfg files were placed in /etc/nagios3/objects. I made all changes necessary to nagios.cfg and windows.cfg according to (http://nagios.sourceforge.net/docs/3_0/monitoring-windows.html) and also verified everything according to (http://www.thegeekstuff.com/2008/07/how-to-monitor-remote-windows-machine-using-nagios-on-linux). I checked my spelling and syntax numerous times on the config files but i still get this when i try to verify my configuration:

root@nagios:/etc/nagios3# nagios3 -v nagios.cfg

Nagios 3.0.2
Copyright (c) 1999-2008 Ethan Galstad (http://www.nagios.org)
Last Modified: 05-19-2008
License: GPL

Reading configuration data...

Error: Template 'windows-server' specified in host definition could not be not found (config file '/etc/nagios3/objects/windows.cfg', starting on line 25)

***> One or more problems was encountered while processing the config files...

     Check your configuration file(s) to ensure that they contain valid
     directives and data defintions.  If you are upgrading from a previous
     version of Nagios, you should be aware that some variables/definitions
     may have been removed or modified in this version.  Make sure to read
     the HTML documentation regarding the config files, as well as the
     'Whats New' section to find out what has changed.

I have checked over and over again and cannot find any problems. I have uploaded my templates.cfg, windows.cfg and nagios.cfg.
Also curious to know, from the looks of the windows.cfg,  will each host need it's own windows.cfg? Does each host need a static IP? If not, how do add more windows machines to monitor? I dont think i'm understanding how this software works,  cause creating a seperate .cfg file for each host that needs to be monitored seems a little ridiculous.
Thanks for any help.
nagios.txt
templates.txt
windows.txt
Avatar of Sanga Collins
Sanga Collins
Flag of United States of America image

the ubuntu quickstart from the nagios website works better since it uses all the standard locations for the nagios install

http://nagios.sourceforge.net/docs/3_0/quickstart-ubuntu.html

since you went a different way i would try using the cfg_dir directive instead and use the cfg_file directive sparingly. below is what i have setup on my nagios. i used the /usr/local/nagios/ as my install, but im sure you can modify to reflect your environment

# OBJECT CONFIGURATION FILE(S)
# These are the object configuration files in which you define hosts,
# host groups, contacts, contact groups, services, etc.
# You can split your object definitions across several config files
# if you wish (as shown below), or keep them all in a single config file.

# You can specify individual object config files as shown below:
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

# Definitions for monitoring the local (Linux) host
#cfg_file=/usr/local/nagios/etc/objects/localhost.cfg

# Definitions for monitoring a Windows machine
#cfg_file=/usr/local/nagios/etc/objects/windows.cfg

# Definitions for monitoring a router/switch
#cfg_file=/usr/local/nagios/etc/objects/switch.cfg

# Definitions for monitoring a network printer
#cfg_file=/usr/local/nagios/etc/objects/printer.cfg


# You can also tell Nagios to process all config files (with a .cfg
# extension) in a particular directory by using the cfg_dir
# directive as shown below:

*****************
This is where is point to all my hosts that are being monitored. since the hosts directory has almost 150 different defenition files its much easier than referencing each host to monitor sperately
******************
cfg_dir=/usr/local/nagios/etc/hosts
cfg_dir=/usr/local/nagios/etc/serviceext

#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
Avatar of mhdcommunications
mhdcommunications

ASKER

The Ubuntu quickstart guide did not work. I spent 3 days using 6.1 desktop and server editions, 7.1 desktop and server editions, and 8.1 desktop and server editions. ALL failed at the same point (make install-webconf *command not found or something of that nature) I tried every variation of the command, and it never worked. Every time i tried, i reloaded the OS from scratch and installed all updates before starting the install of Nagios 3. I finally found the one for 8.1 that used the repositories for the install, and i was up monitoring locally in 3-5 minutes.
I will try the config above and post later. Thanks.

the command make install-webconf simply adds a few lines to your apache sever so that the nagios page works correctly. i dont remeber the lines off top, but they can safely be added manually at a later stage
I have grown extremely frustrated with Nagios. I got past the original error listed, but got a new one - something in regards to a Duplicate host. I remarked ALL config files in the nagios.cfg except a host.cfg that only had one host entered on the entire document, and still got the same erro. I am in the process of starting from scratch. There seems to be something else wrong with my systems as every time i reboot, my NIC changes from a 'Manual' IP to DHCP.
I will be using Ubuntu 8.10 Desktop again and will follow the instructions listed on Nagio's site. Do you suggest any other distro? I would cinsider myself a linux beginner. Although i used Ubuntu for almost 2 years as my only OS, i stopped using it about 2 years ago and have forgotten almost everything, and am teaching myself again. Thanks.
ASKER CERTIFIED SOLUTION
Avatar of Sanga Collins
Sanga Collins
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Wait a minute - are these files which you attached to your post - are your currently used configuration files?
If so - in nagios.cfg (attached as .txt), you should uncomment (by deleting '#' character) line 33 (#cfg_file=/etc/nagios3/objects/templates.cfg).
As for multiple configuration files - you may have just one config file with all your hosts, services, commands, contacs, contact groups, escalations, etc... Having it in separate files is just easier to maintain (especially if you have a lot of hosts/services/etc...).