New install but questions on the config files


#1

Afternoon all

I have just installed nagios 3.0rc1. I’ve got it working but am a bit confused on the config. In the objects directory I have created a new cfg file called linux and routers. What im struggling with is the format of the configs and the best way to use them,

Whats the kind of best practice way for doing hostgroups and service groups. Would having a seperate cfg for hostgroups and service groups work and be a sensible thing to do?

If anyone has some example of doing the services, hosts, groups etc please post


#2

Hy!

I did it by making separate config files for everything: host templates, every host type in separate file using different host templates, services, hostgroups, servicegroups, dependencies, timeperiods and hostextinfo.
It’s easier to read such files and find what you’re looking for in further development of you monitoring process.

I have put them (cfg files) in a separate folder (in my home directory 'till I find them working how I want and stable). I will put them in original folder (/etc/nagios#/conf.d) when I will be sure that already mentioned conditions are satisfied. And beside that, it’s safe to leave those original .cfg files untouched in case anything goes wrong. Backup them somewhere safe.
My .cfg files are named my_hosts.cfg, my_services.cfg to avoid duplicate file names, and again, to ease the finding of my files in future.

nagios.cfg file the must also be modified. Backup it also before you change anything. Comment (#) lines that apply to read those original .cfg files and add lines that lead to the path where are your files.

For the format of the files, you can use the format from original files. Just copy/paste the text from orig. conf files to yours and modify them as needed. They are already written as simple as they can be.

Hope this helps.


#3

Albin

Thanks for the reply. Do hostgroups need to be defined in the same cfg file as the host or can it be in a separate file?

The idea I had was to have the following
localhost
linux
windoes
swiches
routers
firewalls
hostgroups
servicegroups

will that work because im having problmes?
Thanks
Lee


#4

Hostgroups can be in a separate file from hosts. I have done it that way and it works. That will do. All you have to do is to specify all paths to those files in nagios.cfg

For Nagios config files have in mind that it’s not important what’s the name of the file or what’s defined in it. You can define a service or contact in host.cfg as long as the definition sintax for every defined object is respected. Although it’s not recomended just because it’s easier to find defined objects in future if they are sorted in some manner.
Just be sure you have added paths to those files in nagios.cfg.

Your idea is good. :slight_smile:
Wish you luck