wouldn't located host.cfg file in Linux Mint Nagios3

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
thuyen
Posts: 7
Joined: Tue Jan 17, 2012 12:00 pm

wouldn't located host.cfg file in Linux Mint Nagios3

Post by thuyen »

I have installed the Nagios3 into my server HP Proliant DL380 G5 which is running on Linux Mint. According from the installation instruction, Nagios3 has pre-created on Linux Mint so I just insert command lines to run the installation. I got the locahost webpage but wouldn't located the host configuration files. All I have in /etc/nagios3 are contacts_nagios2.cfg, extifo_nagios2.cfg, generic-host_nagios2, localhost_nagios2, services_nagios2, timeperiod_nagios2, apache2, cgi, commands, htpasswd, nagios, resource. Please help so I can continue to get my work done.
thank you so much
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: wouldn't located host.cfg file in Linux Mint Nagios3

Post by lmiltchev »

hosts.cfg file should be in the objects folder. Can you run in terminal?

Code: Select all

# updatedb
# locate hosts.cfg
If this file doesn't exist, you can create it, for example:

Code: Select all

# vi hosts.cfg

define host{
		use					generic-host
		host_name			web
		alias				 Web Server
		address			  192.168.0.55
			}
Be sure to check out our Knowledgebase for helpful articles and solutions!
thuyen
Posts: 7
Joined: Tue Jan 17, 2012 12:00 pm

Re: wouldn't located host.cfg file in Linux Mint Nagios3

Post by thuyen »

thanks for your reply. I didn't see the file exit, so I create the content inside the terminal. but how to save it as a configuration file? or do you mean creating one text file in ~/nagios/etc/objects?
when I restart the nagios service, it shows error: Restaring nagios (via systemctl): job failed. see system logs and "systemctl status for detail". [failed]. and it's unable to connect to localhost.
would you please advice..

thanks again
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: wouldn't located host.cfg file in Linux Mint Nagios3

Post by lmiltchev »

When you run "vi hosts.cfg", you create a config file. Your host has to have some services as well. In a similar way, you can create a services.cfg file in the objects directory if you don't have it, for example:

Code: Select all

# vi services.cfg

define service{
		use							generic-service
		host_name					web
		service_description	  HTTP
		check_command			  check_http
			}
You should probably check to see if you have these paths (to the hosts.cfg and services.cfg) set in the nagios.cfg file. Check also if the commands that you are using are actually defined in commands.cfg.

To verify the configuration, you run in terminal:

Code: Select all

# /usr/local/nagios/bin/nagios -v /etc/nagios3/nagios.cfg
Check for warnings and errors. If you see any errors, you should fix them first, otherwise you are not going to restart nagios.

Note: I don't have Nagios installed on Mint but I think, that this is the correct path for you (to verify the configuration). Mine is different:

Code: Select all

# /usr/bin/nagios3 -v /usr/local/nagios/etc/nagios.cfg
Hope this helps.
Be sure to check out our Knowledgebase for helpful articles and solutions!
thuyen
Posts: 7
Joined: Tue Jan 17, 2012 12:00 pm

Re: wouldn't located host.cfg file in Linux Mint Nagios3

Post by thuyen »

I swap out Linux Mint since it didn't work out well and now having Ubuntu 11.10 running. Although I follow the instructions in the link you sent (also on Nagios documents for quick start installation), the hosts.cfg still not appear in my system files (/etc/nagios3/conf.d). As you suggested in the earlier notes, I tried to create a config file for hosts. I ran # vi hosts.cfg and add the define hosts info in the content, however, this config file is a plain text document (text/plain) type and when restart the nagios service, it's still not showing up in the localhosts/nagios.
Locked